Location: PHPKode > projects > PhpProMembers > phpProMembers3/public_html/member_renew.php
<?php require_once('file:///W|/public_html/chad/Connections/dbConnection.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}

$editFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
  $editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
}

if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "form1")) {
  $insertSQL = sprintf("INSERT INTO current_members_waiting_approval (first_name, last_name, address1, address2, city, `state`, postal_code, country, telephone_number, e_mail_address, website, user_name, user_password, payment_type, account_type_name, name_on_card, card_number, exp_date, billing_address1, billing_address2, billing_city, billing_state, billing_postal_code, billing_country, start_date) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                       GetSQLValueString($HTTP_POST_VARS['first_name'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['last_name'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['address1'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['address2'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['city'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['state'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['postal_code'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['country'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['telephone_number'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['e_mail_address'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['website'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['user_name'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['user_password'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['payment_type'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['account_type_name'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['name_on_card'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['card_number'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['exp_date'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['billing_address1'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['billing_address2'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['billing_city'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['billing_state'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['billing_postal_code'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['billing_country'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['start_date'], "date"));

  mysql_select_db($database_dbConnection, $dbConnection);
  $Result1 = mysql_query($insertSQL, $dbConnection) or die(mysql_error());
}

$colname_rsMember = "1";
if (isset($HTTP_SESSION_VARS['valid_user'])) {
  $colname_rsMember = (get_magic_quotes_gpc()) ? $HTTP_SESSION_VARS['valid_user'] : addslashes($HTTP_SESSION_VARS['valid_user']);
}
mysql_select_db($database_dbConnection, $dbConnection);
$query_rsMember = sprintf("SELECT * FROM members WHERE user_name = '%s'", $colname_rsMember);
$rsMember = mysql_query($query_rsMember, $dbConnection) or die(mysql_error());
$row_rsMember = mysql_fetch_assoc($rsMember);
$totalRows_rsMember = mysql_num_rows($rsMember);

$colname_rsMembership = "1";
if (isset($HTTP_SESSION_VARS['valid_user'])) {
  $colname_rsMembership = (get_magic_quotes_gpc()) ? $HTTP_SESSION_VARS['valid_user'] : addslashes($HTTP_SESSION_VARS['valid_user']);
}
mysql_select_db($database_dbConnection, $dbConnection);
$query_rsMembership = sprintf("SELECT * FROM memberships WHERE user_name = '%s'", $colname_rsMembership);
$rsMembership = mysql_query($query_rsMembership, $dbConnection) or die(mysql_error());
$row_rsMembership = mysql_fetch_assoc($rsMembership);
$totalRows_rsMembership = mysql_num_rows($rsMembership);

mysql_select_db($database_dbConnection, $dbConnection);
$query_rsPayment = "SELECT * FROM method_of_payment WHERE active = 1 ORDER BY payment_type ASC";
$rsPayment = mysql_query($query_rsPayment, $dbConnection) or die(mysql_error());
$row_rsPayment = mysql_fetch_assoc($rsPayment);
$totalRows_rsPayment = mysql_num_rows($rsPayment);

$colname_rsAccountTypes = "1";
if (isset($HTTP_GET_VARS['mem'])) {
  $colname_rsAccountTypes = (get_magic_quotes_gpc()) ? $HTTP_GET_VARS['mem'] : addslashes($HTTP_GET_VARS['mem']);
}
mysql_select_db($database_dbConnection, $dbConnection);
$query_rsAccountTypes = sprintf("SELECT * FROM account_types WHERE account_name = '%s'", $colname_rsAccountTypes);
$rsAccountTypes = mysql_query($query_rsAccountTypes, $dbConnection) or die(mysql_error());
$row_rsAccountTypes = mysql_fetch_assoc($rsAccountTypes);
$totalRows_rsAccountTypes = mysql_num_rows($rsAccountTypes);
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#CCCCCC">
<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
  <table align="center" cellpadding="2" cellspacing="1">
    <tr valign="baseline"> 
      <td align="right" nowrap bgcolor="#0000CC"><strong><font color="#FFFFFF" face="Arial, Helvetica, sans-serif">First 
        Name:</font></strong></td>
      <td bgcolor="#FFFFFF">
<input type="text" name="first_name" value="<?php echo $row_rsMember['first_name']; ?>" size="32"></td>
    </tr>
    <tr valign="baseline"> 
      <td align="right" nowrap bgcolor="#0000CC"><strong><font color="#FFFFFF" face="Arial, Helvetica, sans-serif">Last 
        Name:</font></strong></td>
      <td bgcolor="#FFFFFF">
<input type="text" name="last_name" value="<?php echo $row_rsMember['last_name']; ?>" size="32"></td>
    </tr>
    <tr valign="baseline"> 
      <td align="right" nowrap bgcolor="#0000CC"><strong><font color="#FFFFFF" face="Arial, Helvetica, sans-serif">Address1:</font></strong></td>
      <td bgcolor="#FFFFFF">
<input type="text" name="address1" value="<?php echo $row_rsMember['address1']; ?>" size="32"></td>
    </tr>
    <tr valign="baseline"> 
      <td align="right" nowrap bgcolor="#0000CC"><strong><font color="#FFFFFF" face="Arial, Helvetica, sans-serif">Address2:</font></strong></td>
      <td bgcolor="#FFFFFF">
<input type="text" name="address2" value="<?php echo $row_rsMember['address2']; ?>" size="32"></td>
    </tr>
    <tr valign="baseline"> 
      <td align="right" nowrap bgcolor="#0000CC"><strong><font color="#FFFFFF" face="Arial, Helvetica, sans-serif">City:</font></strong></td>
      <td bgcolor="#FFFFFF">
<input type="text" name="city" value="<?php echo $row_rsMember['city']; ?>" size="32"></td>
    </tr>
    <tr valign="baseline"> 
      <td align="right" nowrap bgcolor="#0000CC"><strong><font color="#FFFFFF" face="Arial, Helvetica, sans-serif">State:</font></strong></td>
      <td bgcolor="#FFFFFF">
<input type="text" name="state" value="<?php echo $row_rsMember['state']; ?>" size="32"></td>
    </tr>
    <tr valign="baseline"> 
      <td align="right" nowrap bgcolor="#0000CC"><strong><font color="#FFFFFF" face="Arial, Helvetica, sans-serif">Postal 
        Code:</font></strong></td>
      <td bgcolor="#FFFFFF">
<input type="text" name="postal_code" value="<?php echo $row_rsMember['postal_code']; ?>" size="32"></td>
    </tr>
    <tr valign="baseline"> 
      <td align="right" nowrap bgcolor="#0000CC"><strong><font color="#FFFFFF" face="Arial, Helvetica, sans-serif">Country:</font></strong></td>
      <td bgcolor="#FFFFFF">
<input type="text" name="country" value="<?php echo $row_rsMember['country']; ?>" size="32"></td>
    </tr>
    <tr valign="baseline"> 
      <td align="right" nowrap bgcolor="#0000CC"><strong><font color="#FFFFFF" face="Arial, Helvetica, sans-serif">Telephone 
        Number:</font></strong></td>
      <td bgcolor="#FFFFFF">
<input type="text" name="telephone_number" value="<?php echo $row_rsMember['telephone_number']; ?>" size="32"></td>
    </tr>
    <tr valign="baseline"> 
      <td align="right" nowrap bgcolor="#0000CC"><strong><font color="#FFFFFF" face="Arial, Helvetica, sans-serif">EMail 
        Address:</font></strong></td>
      <td bgcolor="#FFFFFF">
<input type="text" name="e_mail_address" value="<?php echo $row_rsMember['e_mail_address']; ?>" size="32"></td>
    </tr>
    <tr valign="baseline"> 
      <td align="right" nowrap bgcolor="#0000CC"><strong><font color="#FFFFFF" face="Arial, Helvetica, sans-serif">Website:</font></strong></td>
      <td bgcolor="#FFFFFF">
<input type="text" name="website" value="<?php echo $row_rsMember['website']; ?>" size="32"></td>
    </tr>
    <tr valign="baseline"> 
      <td align="right" nowrap bgcolor="#0000CC"><strong><font color="#FFFFFF" face="Arial, Helvetica, sans-serif">Payment 
        Type:</font></strong></td>
      <td bgcolor="#FFFFFF"> 
        <select name="payment_type">
          <?php 
do {  
?>
          <option value="<?php echo $row_rsAccountTypes['account_name']?>" <?php if (!(strcmp($row_rsAccountTypes['account_name'], $row_rsMembership['payment_type']))) {echo "SELECTED";} ?>><?php echo $row_rsAccountTypes['id']?></option>
          <?php
} while ($row_rsAccountTypes = mysql_fetch_assoc($rsAccountTypes));
?>
        </select> </td>
    <tr valign="baseline"> 
      <td align="right" nowrap bgcolor="#0000CC"><strong><font color="#FFFFFF" face="Arial, Helvetica, sans-serif">Name 
        On Card:</font></strong></td>
      <td bgcolor="#FFFFFF">
<input type="text" name="name_on_card" value="<?php echo $row_rsMember['name_on_card']; ?>" size="32"></td>
    </tr>
    <tr valign="baseline"> 
      <td align="right" nowrap bgcolor="#0000CC"><strong><font color="#FFFFFF" face="Arial, Helvetica, sans-serif">Card 
        Number:</font></strong></td>
      <td bgcolor="#FFFFFF">
<input type="text" name="card_number" value="" size="32"></td>
    </tr>
    <tr valign="baseline"> 
      <td align="right" nowrap bgcolor="#0000CC"><strong><font color="#FFFFFF" face="Arial, Helvetica, sans-serif">Exp 
        Date:</font></strong></td>
      <td bgcolor="#FFFFFF">
<input type="text" name="exp_date" value="" size="32"></td>
    </tr>
    <tr valign="baseline"> 
      <td align="right" nowrap bgcolor="#0000CC"><strong><font color="#FFFFFF" face="Arial, Helvetica, sans-serif">Billing 
        Address1:</font></strong></td>
      <td bgcolor="#FFFFFF">
<input type="text" name="billing_address1" value="<?php echo $row_rsMember['billing_address1']; ?>" size="32"></td>
    </tr>
    <tr valign="baseline"> 
      <td align="right" nowrap bgcolor="#0000CC"><strong><font color="#FFFFFF" face="Arial, Helvetica, sans-serif">Billing 
        Address2:</font></strong></td>
      <td bgcolor="#FFFFFF">
<input type="text" name="billing_address2" value="<?php echo $row_rsMember['billing_address2']; ?>" size="32"></td>
    </tr>
    <tr valign="baseline"> 
      <td align="right" nowrap bgcolor="#0000CC"><strong><font color="#FFFFFF" face="Arial, Helvetica, sans-serif">Billing 
        City:</font></strong></td>
      <td bgcolor="#FFFFFF">
<input type="text" name="billing_city" value="<?php echo $row_rsMember['billing_city']; ?>" size="32"></td>
    </tr>
    <tr valign="baseline"> 
      <td align="right" nowrap bgcolor="#0000CC"><strong><font color="#FFFFFF" face="Arial, Helvetica, sans-serif">Billing 
        State:</font></strong></td>
      <td bgcolor="#FFFFFF">
<input type="text" name="billing_state" value="<?php echo $row_rsMember['billing_state']; ?>" size="32"></td>
    </tr>
    <tr valign="baseline"> 
      <td align="right" nowrap bgcolor="#0000CC"><strong><font color="#FFFFFF" face="Arial, Helvetica, sans-serif">Billing 
        Postal Code:</font></strong></td>
      <td bgcolor="#FFFFFF">
<input type="text" name="billing_postal_code" value="<?php echo $row_rsMember['billing_postal_code']; ?>" size="32"></td>
    </tr>
    <tr valign="baseline"> 
      <td align="right" nowrap bgcolor="#0000CC"><strong><font color="#FFFFFF" face="Arial, Helvetica, sans-serif">Billing 
        Country:</font></strong></td>
      <td bgcolor="#FFFFFF">
<input type="text" name="billing_country" value="<?php echo $row_rsMember['billing_country']; ?>" size="32"></td>
    </tr>
    <tr valign="baseline"> 
      <td colspan="2" align="right" nowrap><input type="submit" value="Insert Record"></td>
    </tr>
  </table>
  <input type="hidden" name="user_name" value="<?php echo $row_rsMember['user_name']; ?>">
  <input type="hidden" name="user_password" value="<?php echo $row_rsMember['user_password']; ?>">
  <input type="hidden" name="account_type_name" value="<?php echo $row_rsMembership['package']; ?>">
  <input type="hidden" name="start_date" value="<?php echo $row_rsMembership['start_date']; ?>">
  <input type="hidden" name="MM_insert" value="form1">
</form>
<p>&nbsp;</p>
  
</body>
</html>
<?php
mysql_free_result($rsMember);

mysql_free_result($rsMembership);

mysql_free_result($rsPayment);

mysql_free_result($rsAccountTypes);
?>

Return current item: PhpProMembers