Jump to content

problem with confirmation key


elexion

Recommended Posts

hey everyone, i've recently made a email function that sends every user a email to activate his account by clicking on the included link. I have to email and the confirmation key all settled there's just one problem. For some reason my script wont move the data from my temporary table to the permanent one, i cant figure out what's wrong and i was hoping someone could take a look and give me some pointers

<html><head><title>game media</title><?phpinclude("connect.php");?></head><body><?// Passkey that got from link$passkey=$_GET['passkey'];$tbl_name1="tmp_members";// Retrieve data from table where row that match this passkey$sql1="SELECT * FROM $tbl_name1 WHERE confirm_code='$passkey'";$result1=mysql_query($sql1);// If successfully queriedif($result1){// Count how many row have this passkey$count=mysql_num_rows($result1);// if found this passkey in our database, retrieve dataif($count==1){$rows=mysql_fetch_array($result1);$voornaam=$rows['voornaam'];$achternaam=$rows['achternaam'];$email=$rows['email'];$woonadres=$rows['woonadres'];$afleveradres=$rows['afleveradres'];$land=$rows['land'];$afleveradress=$rows['afleveradress'];$tbl_name2="registered_members";// Insert data that retrieves from "temp_members_db" into table "registered_members"$sql2="INSERT INTO $tbl_name2(voornaam, achternaam, email, woonadres, afleveradres, land, afleveradress)VALUES('$voornaam', '$achternaam', '$email', '$woonadres', '$afleveradres', '$land', '$afleveradress')";$result2=mysql_query($sql2);}// if not found passkey, display message "Wrong Confirmation code"else {echo "Wrong Confirmation code";}

yes i know i'm missing a few tags in the bottom but that's intended so i don't have to copy paste a giant wall of text :)So yes this is the code that's giving me a hard time inserting the data into the first table goes perfect smooth but when i click on the confirmation link i get a blank screen. at this point I've noticed that could indicate a syntax error.

Link to comment
Share on other sites

The best to try is using or die(mysql_error());I suggest using one table (profile table) with columns confirm_code and activated and when you check activation update row to 1. And default will be 0, or whatever.

Link to comment
Share on other sites

If you think there's a syntax error, one way is to have a file set the error settings, then include the file with the problem. e.g.:

<?phpini_set('display_errors', 1);error_reporting(E_ALL);include 'file.php';?>

If there's a syntax error in file.php, that will show the error message in the browser. Otherwise, make sure your page gives output no matter what happens. There might be a path through the if statements that results in a blank screen even though there was no error. I don't see any output if the user was added to the other table.

Link to comment
Share on other sites

This might be worth putting down though i doubt it's helpfull

$message = "http://www.host.net/confirm.php?passkey=$confirm_code";

it's the link in the confirmation email which needs to be clicked one to validate an account

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...