After the script moves the info into the new database it does not delete the row.
[php]<?php
include(‘config.php’);
if($_SERVER[“REQUEST_METHOD”] == “POST”)
{
// Username from link
$username=htmlentities($_GET[‘username’]);
$confirm_code=htmlentities($_GET[‘confirm_code’]);
$tbl_name1=“forgetpass”;
// 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 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_members_db”
if($count==1){
;
$rows=mysql_fetch_array($result1);
$username=$rows[‘username’];
}else{
$password=mysql_real_escape_string($_POST[‘password1’]);
if(!$_POST[“password1”] || !$_POST[“password2”]){
$error=“Please fill the required fields”;
}else if(empty($username)){
$error=“No Confirmation Link Sent”;
}else if($_POST[“password1”] != $_POST[“password2”]){
$error=“PASSWORDS do not match!”;
//validate password length
}else if(strlen($_POST[“password1”]) < 6){
$error=“PASSWORD is too short! Must be 6 characters long”;
}else{
$password=$_POST[‘password1’];
// it is acceptable, so hash it
$encrypt_password=“Some Hashing”;
// Insert data into database
$sql2="UPDATE user SET password = '$encrypt_password' WHERE username = '$username'";
$result2=mysql_query($sql2);
// if suceesfully inserted data into database, send confirmation link to email
if($result2){
$status="Your Password Has Been Reset";
// Delete information of this user from table "temp_members_db" that has this passkey
$sql3="DELETE FROM $tbl_name1 WHERE confirm_code = '$confirm_code'";
$result3=mysql_query($sql3);
}
}
}
}
}
?>[/php]