austin6118 Posted May 3, 2009 Share Posted May 3, 2009 I get my program to send a confirmation link to an email address but that link does nothing when I click it. My program consists of a user signing up a registration and it sends to my database. When they sign up, the confirmation email gets sent. I'm trying to make it that once they click link, their information gets moved from the temp database to the register database to signify they clicked the confirmation link. Here is what i have so far... <?php include('connectDB.php'); // Passkey that got from link $passkey={$_REQUEST['passkey']}; // Retrieve data from table where row that match this passkey $sql1="SELECT * FROM temp WHERE confirm_code ='$passkey'"; $result1=mysql_query($sql1); // If successfully queried if($result1){ // Count how many row has this passkey $count=mysql_num_rows($result1); // if found this passkey in our database, retrieve data from table "temp" if($count==1){ $rows=mysql_fetch_array($result1); $name=$rows['name']; $email=$rows['email']; $password=$rows['password']; // Insert data that retrieves from "temp" into table "reminder" $sql2="INSERT INTO register(name, email, password,) VALUES('$name', '$email', '$password')"; $result2=mysql_query($sql2); } // if not found passkey, display message "Wrong Confirmation code" else { echo "Wrong Confirmation code"; } // if successfully moved data from table"temp" to table "reminder" displays message "Your account has been activated" and don't forget to delete confirmation code from table "temp_members_db" if($result2){ echo "Your account has been activated"; // Delete information of this user from table "temp_members_db" that has this passkey $sql3="DELETE FROM $temp WHERE confirm_code = '$passkey'"; $result3=mysql_query($sql3); } } ?> Link to comment https://forums.phpfreaks.com/topic/156622-email-confirmation-link-is-not-working/ Share on other sites More sharing options...
Ken2k7 Posted May 3, 2009 Share Posted May 3, 2009 http://www.phpfreaks.com/page/forum-rules Read #13. Also, your architectural work is a bit off. Why can't you add a status column into your users or register table that tells you if the user is registered? I would use a int(1) and 4 = registered, 0 = validating. You can have more. I just left a gap there in case you want 2 to be banned or whatever. It's up to you. Link to comment https://forums.phpfreaks.com/topic/156622-email-confirmation-link-is-not-working/#findComment-824708 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.