Lorem Ipsum
Member
- Pronoun
- x
For all my sins, I'm using PHP to code a little pet project to try and get me to get back into coding, but I've stumbled at one of the first hurdles and can't identify what the problem is.
Basically, User A signs up to the service and receives a unique ID number and verification code, and for others to join User A's group, they have to enter both of these numbers when registering. The code for User A's registration works fine, and it all enters into the database wonderfully.
My problem is the registration of User B - I've set up a rudimentary check to see whether the verification code matches the verification assigned to the user ID in the database, and if it doesn't, it sends you back and tells you to fill out the registration form again. The only problem is that even if they ARE the same, it sends you back regardless.
The only thing I can imagine is wrong is that the code to check the database verification ID is somehow flawed, but I can't see where. Any help on this would be greatly appreciated! Code below:
Basically, User A signs up to the service and receives a unique ID number and verification code, and for others to join User A's group, they have to enter both of these numbers when registering. The code for User A's registration works fine, and it all enters into the database wonderfully.
My problem is the registration of User B - I've set up a rudimentary check to see whether the verification code matches the verification assigned to the user ID in the database, and if it doesn't, it sends you back and tells you to fill out the registration form again. The only problem is that even if they ARE the same, it sends you back regardless.
The only thing I can imagine is wrong is that the code to check the database verification ID is somehow flawed, but I can't see where. Any help on this would be greatly appreciated! Code below:
PHP:
$sid = $_POST['schoolid'];
$ver = $_POST['verificationid'];
$title = $_POST['title'];
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$pwd = $_POST['pwd1'];
$conf = $_POST['pwd2'];
// MySQL login data goes here
$con = mysql_connect($mysql_host,$mysql_user,$mysql_password);
$getsid = mysql_query(
"SELECT *
FROM schools
WHERE uid='$sid'");
while($row = mysql_fetch_array($getsid)) {
$origver = $row['verification'];
}
if ($pwd != $conf) {
header('Location: register.php?error=1');
}
elseif ($ver != $original) {
header('Location: register.php?error=2');
}
// Further, unimportant code