Copy link to clipboard
Copied
the check username script is a nice solution to check to make sure a record doesn't already exist... however... i need to check against two items and this wasn't designed to work this way. whats the best way to do this?
Copy link to clipboard
Copied
php/mysql
i prefer non theoretical answers.
here is the block of code that dreamweaver has entered for over 5 years now to "check username"
// *** Redirect if username exists
$MM_flag="MM_insert";
if (isset($_POST[$MM_flag])) {
$MM_dupKeyRedirect="redirecturl.php";
$loginUsername = $_POST['username'];
$LoginRS__query = sprintf("SELECT username FROM database WHERE username=%s", GetSQLValueString($loginUsername, "text"));
mysql_select_db($database_123, $123);
$LoginRS=mysql_query($LoginRS__query, $123) 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;
}
}
converting that to check multiple items.
and if this block of default code is garbage, a better suited way to do this. each item needs to have it's own check, and own trigger, and own resulting error message for users identified, preferably without using a url redirect to avoid the use of url parameters if possible. thanks in advance.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now