This is driving me insane, please help
Posted: Wed Mar 03, 2010 4:16 pm
ok i have been over this function many times and tried many different approaches and yet when i look at the code I dont see why it isnt working. Basically the code works until it reaches this section
When it reaches this section after verifying that the password matches the "confirm pass" it should be checking the database to verify if the username or email address exists.. if it does then it should error, when it doesnt error then it returns no error and the information is passed to the database... However for some reason it seems to be skipping the database login and email check. Im quite sure it is opening the database because the rest of my script uses a similar piece of code to open the database in other functions and it works fine..
Please help... i really need this to work otherwise im going to have people registering multiple times with the same email or username. Whats really sad is when i initially wrote this code I could of sworn i tested it and it worked perfectly fine. (NOTE: I can not take credit for all of the code a lot of it is from another persons work, but i have also done a lot of my own additions and modifications to it as well)
Error Codes:
==================
Code: Select all
if ($pass1 == $pass2) {
$owner=mysql_fetch_array(mysql_db_query($db_name, "SELECT * FROM $tbl_member"));
if ($login == $owner[login]){
$error="10";
}
elseif ($email == $owner[email]){
$error="12";
}
else{$error="";}
When it reaches this section after verifying that the password matches the "confirm pass" it should be checking the database to verify if the username or email address exists.. if it does then it should error, when it doesnt error then it returns no error and the information is passed to the database... However for some reason it seems to be skipping the database login and email check. Im quite sure it is opening the database because the rest of my script uses a similar piece of code to open the database in other functions and it works fine..
Please help... i really need this to work otherwise im going to have people registering multiple times with the same email or username. Whats really sad is when i initially wrote this code I could of sworn i tested it and it worked perfectly fine. (NOTE: I can not take credit for all of the code a lot of it is from another persons work, but i have also done a lot of my own additions and modifications to it as well)
Code: Select all
function validate_member ($login, $pass1, $pass2, $email) {
global $db_name, $tbl_member;
$login_count = strlen($login);
$pass_count = strlen($pass1);
if ($pass_count >= 6) {
if ($pass_count <= 30) {
if ($login_count >= 3) {
if (eregi("^[a-z0-9_-]+$",$login)) {
if (eregi( "^[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z]{2,4}$" , $email)) {
if ($pass1 == $pass2) {
$owner=mysql_fetch_array(mysql_db_query($db_name, "SELECT * FROM $tbl_member"));
if ($login == $owner[login]){
$error="10";
}
elseif ($email == $owner[email]){
$error="12";
}
else{$error="";}
} else {$error="20";}
} else {$error="30";}
} else {$error="02";}
} else {$error="01";}
} else {$error="04";}
} else {$error="03";}
//} else {$error="12";}
//} else {$error="10";}
return $error;
}
==================
Code: Select all
<?
/* $Id: include/error.php,v 0.2 2002/10/13 15:11:55 wibi Exp $ */
$strError01= "Your login must be no less than four characters in length.";
$strError02= "Your login may only contain alpha-numeric combinations, and you may only use the dash \"-\" or the underscore \"_\", spaces are not allowed.";
$strError03= "Your password must be no less than six characters in length.";
$strError04= "Your password must be no more than 30 characters in length.";
$strError10= "The username you have chosen is already in use, please choose another username.";
$strError12= "The email address has already been used for registration";
$strError15= "You are not logged in yet. Please login first.";
$strError20= "Verify Password Failed";
$strError25= "You must agree to the terms & conditions";
$strError30= "Invalid Email";
$strError40= "Reserved Character";
$strError50= "Verify New Password Failed";
$strError60= "Account Disabled, If you feel this is an error please <a href=contact.php>contact us</a>.";
$strError61= "You must be an administrator to access this feature.";
$strError70= "Invalid login or password combination";
$strError75= "Invalid login name";
$strError80= "You have not fully completed the required fields";
$strError81= "Error in adding event";
$strError85= "You must fill out all fields before continuing";
$strError99 = "The username and password combination doesnt match our database";
$strError5= "You are logged in $login, <a href=logout.php>Please logout before continuing</a>";
?>