Jump to content

Recommended Posts

I have a user sign up and then an email confirmation link gets send to them. When they register I set their status as 0. When they click the click I want the database to be updated to status as 1. Thanks in advance


<?php
include('connectDB.php');

// Passkey that got from link
$passkey=$_REQUEST['passkey'];



// Retrieve data from table where row that match this passkey
$sql1="SELECT 'confirm_code' 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);
$username=$rows['username'];
$email=$rows['email'];
$password=$rows['password'];




// Insert data that retrieves from "temp" into table "reminder"
$sql2="UPDATE 'temp' SET status='1' WHERE username='$username' and password='$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";


}

}
?>

 

[attachment deleted by admin]

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.