Security Assist
Once again thanks for you help, I really do appreciate it. When I test the register page in my browser, all the input goes into my local database. Then it redirects me to a login page. When I use the username and password to login, it sends me to the email page, instead of the profile page. I also checked the password on the local sever and it is there, but it is not encrypted. Here is the code on the register page:
<?php
// *** Redirect if username exists
$MM_flag="MM_insert";
if (isset($_POST[$MM_flag])) {
$MM_dupKeyRedirect="";
$loginUsername = $_POST['RegID'];
$LoginRS__query = "SELECT RegID FROM registrants WHERE RegID='" . $loginUsername . "'";
mysql_select_db($database_NICOFTIME, $NICOFTIME);
$LoginRS=mysql_query($LoginRS__query, $NICOFTIME) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
//if there is a row in the database, the username was found - can not add the requested username
if($loginFoundUser){
$MM_qsChar = "?";
//append the username to the redirect page
if (substr_count($MM_dupKeyRedirect,"?") >=1) $MM_qsChar = "&";
$MM_dupKeyRedirect = $MM_dupKeyRedirect . $MM_qsChar ."requsername=".$loginUsername;
header ("Location: $MM_dupKeyRedirect");
exit;
}
}
?>
<?php
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
?>
<?php
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "WAATKRegistrationForm")) {
$insertSQL = sprintf("INSERT INTO registrants (RegUserName, RegPassword, RegFirstName, RegLastName, RegTitle, RegCompanyName, RegBillingAddress1, RegBillingAddress2, RegCity, RegState, RegZip, RegCountry, RegPhone, RegExtension, RegFax, RegEmail, RegNotes) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['RegUserName'], "text"), GetSQLValueString($_POST['RegPassword'], "text"), GetSQLValueString($_POST['RegFirstName'], "text"), GetSQLValueString($_POST['RegLastName'], "text"), GetSQLValueString($_POST['RegTitle'], "text"), GetSQLValueString($_POST['RegCompanyName'], "text"), GetSQLValueString($_POST['RegBillingAddress1'], "text"), GetSQLValueString($_POST['RegBillingAddress2'], "text"), GetSQLValueString($_POST['RegCity'], "text"), GetSQLValueString($_POST['RegState'], "text"), GetSQLValueString($_POST['RegZip'], "text"), GetSQLValueString($_POST['RegCountry'], "text"), GetSQLValueString($_POST['RegPhone'], "text"), GetSQLValueString($_POST['RegExtension'], "text"), GetSQLValueString($_POST['RegFax'], "text"), GetSQLValueString($_POST['RegEmail'], "text"), GetSQLValueString($_POST['RegNotes'], "text"));
mysql_select_db($database_NICOFTIME, $NICOFTIME);
$Result1 = mysql_query($insertSQL, $NICOFTIME) or die(mysql_error());
$insertGoTo = "registrants_LogIn.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Registration</title>
<link href="WA_SecurityAssist/styles/Refined_Pacifica.css" rel="stylesheet" type="text/css" />
<link href="WA_SecurityAssist/styles/Tahoma.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="RegistrationContainer" class="WAATK">
<form action="<?php echo $editFormAction; ?>" method="post" name="WAATKRegistrationForm" id="WAATKRegistrationForm">
<h1>Registration</h1>
<table class="WAATKDataTable" cellpadding="0" cellspacing="0" border="0">
<tr>
<th>RegUserName:</th>
<td><input type="text" class="WAATKTextField" name="RegUserName" id="RegUserName" value="" size="32" /></td>
</tr>
<tr>
<th>RegPassword:</th>
<td><input type="text" class="WAATKTextField" name="RegPassword" id="RegPassword" value="" size="32" /></td>
</tr>
<tr>
<th>RegFirstName:</th>
<td><input type="text" class="WAATKTextField" name="RegFirstName" id="RegFirstName" value="" size="32" /></td>
</tr>
<tr>
<th>RegLastName:</th>
<td><input type="text" class="WAATKTextField" name="RegLastName" id="RegLastName" value="" size="32" /></td>
</tr>
<tr>
<th>RegTitle:</th>
<td><input type="text" class="WAATKTextField" name="RegTitle" id="RegTitle" value="" size="32" /></td>
</tr>
<tr>
<th>RegCompanyName:</th>
<td><input type="text" class="WAATKTextField" name="RegCompanyName" id="RegCompanyName" value="" size="32" /></td>
</tr>
<tr>
<th>RegBillingAddress1:</th>
<td><input type="text" class="WAATKTextField" name="RegBillingAddress1" id="RegBillingAddress1" value="" size="32" /></td>
</tr>
<tr>
<th>RegBillingAddress2:</th>
<td><input type="text" class="WAATKTextField" name="RegBillingAddress2" id="RegBillingAddress2" value="" size="32" /></td>
</tr>
<tr>
<th>RegCity:</th>
<td><input type="text" class="WAATKTextField" name="RegCity" id="RegCity" value="" size="32" /></td>
</tr>
<tr>
<th>RegState:</th>
<td><input type="text" class="WAATKTextField" name="RegState" id="RegState" value="" size="32" /></td>
</tr>
<tr>
<th>RegZip:</th>
<td><input type="text" class="WAATKTextField" name="RegZip" id="RegZip" value="" size="32" /></td>
</tr>
<tr>
<th>RegCountry:</th>
<td><input type="text" class="WAATKTextField" name="RegCountry" id="RegCountry" value="" size="32" /></td>
</tr>
<tr>
<th>RegPhone:</th>
<td><input type="text" class="WAATKTextField" name="RegPhone" id="RegPhone" value="" size="32" /></td>
</tr>
<tr>
<th>RegExtension:</th>
<td><input type="text" class="WAATKTextField" name="RegExtension" id="RegExtension" value="" size="32" /></td>
</tr>
<tr>
<th>RegFax:</th>
<td><input type="text" class="WAATKTextField" name="RegFax" id="RegFax" value="" size="32" /></td>
</tr>
<tr>
<th>RegEmail:</th>
<td><input type="text" class="WAATKTextField" name="RegEmail" id="RegEmail" value="" size="32" /></td>
</tr>
<tr>
<th>RegNotes:</th>
<td><input type="text" class="WAATKTextField" name="RegNotes" id="RegNotes" value="" size="32" /></td>
</tr>
</table>
<div class="WAATKButtonRow">
<input type="image" hspace="0" vspace="0" border="0" name="Register" id="Register" value="Register" alt="Register" src="WA_SecurityAssist/images/Pacifica/Refined_register.gif" />
<input type="hidden" name="MM_insert" value="WAATKRegistrationForm">
</div>
</form>
</div>
</body>
</html>
------------------------------------------------------------------------------------------------------
Once again thanks, and I really do appreciate your support. I also really thought this would be a little easier.
- When I am trying to do is have my client register, login to their profile ( updated it if needed), then be able to have someone come to my site and search my database of client by catagory and zipcode (displaying there selected results).