Mercurial > hg > ywww
diff user/uk/confirmation.php @ 6:077b0a0a3e6d
remaining originals according to dependency walk
author | Robert Boland <robert@markup.co.uk> |
---|---|
date | Thu, 16 Feb 2017 22:29:02 +0000 |
parents | |
children | 385ddd7c4b55 a67bf725e87b |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/user/uk/confirmation.php Thu Feb 16 22:29:02 2017 +0000 @@ -0,0 +1,63 @@ +<?PHP +include "../../private/db.php"; + + +// Passkey that got from link +$passkey=$_GET['passkey']; +$tbl_name1="temp_user"; +$loc = 1; + +// Retrieve data from table where row that match this passkey +$sql1="SELECT * FROM $tbl_name1 WHERE confirm_code ='$passkey'"; +//echo $sql1; +$result1=mysqli_query($link,$sql1); + +// If successfully queried +if($result1){ + +// Count how many row has this passkey +$count=mysqli_num_rows($result1); +//echo $count; +// if found this passkey in our database, retrieve data from table +if($count==1){ + + $rows=mysqli_fetch_array($result1, MYSQLI_ASSOC); + $email=$rows['Email']; + $password=$rows['Password']; + $fname=$rows['FirstName']; + $sname=$rows['Surname']; + + $tbl_name2="user"; + + // Insert data that retrieves from "temp_members_db" into table "registered_members" + //$add = 'insert into user values (null,\'' . $email . '\',\'' . $password . '\');'; + $add="CALL addNewUser('$email', '$password', '$fname', '$sname', $loc)"; + + //echo $add; + $result2 = mysqli_query($link, $add); +} +// if not found passkey, display message +else { +echo "Invalid Confirmation code"; +} + +// if successfully moved data from table"temp_members_db" to table "registered_members" displays message "Your account has been activated" and don't forget to delete confirmation code from table "temp_members_db" +if($result2){ + //Would prefer to create the cookie here, but GWT doesn't seem able to read it + /*session_start(); + $_SESSION['email']=$email; + //session_id(); + $DURATION = 1209600000;//(1000 * 60 * 60 * 24 * 14); + //Cookies.setCookie("bookWhacksid", sessionID, expires, null, "/", false); + setcookie("bookWhacksid", session_id(), time()+$DURATION);*/ + //echo "Thank you, your account has been activated\nwww.bookwhack.co.uk"; + $redirectURL = "redirect.html"; + header("Location:$redirectURL"); + +// Delete information of this user from table "temp_members_db" that has this passkey +$sql3="DELETE FROM $tbl_name1 WHERE confirm_code = '$passkey'"; +$result3=mysqli_query($link,$sql3); +} + +} +?> \ No newline at end of file