Mercurial > hg > ywww
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 5:55445b456ad0 | 6:077b0a0a3e6d |
|---|---|
| 1 <?PHP | |
| 2 include "../../private/db.php"; | |
| 3 | |
| 4 | |
| 5 // Passkey that got from link | |
| 6 $passkey=$_GET['passkey']; | |
| 7 $tbl_name1="temp_user"; | |
| 8 $loc = 1; | |
| 9 | |
| 10 // Retrieve data from table where row that match this passkey | |
| 11 $sql1="SELECT * FROM $tbl_name1 WHERE confirm_code ='$passkey'"; | |
| 12 //echo $sql1; | |
| 13 $result1=mysqli_query($link,$sql1); | |
| 14 | |
| 15 // If successfully queried | |
| 16 if($result1){ | |
| 17 | |
| 18 // Count how many row has this passkey | |
| 19 $count=mysqli_num_rows($result1); | |
| 20 //echo $count; | |
| 21 // if found this passkey in our database, retrieve data from table | |
| 22 if($count==1){ | |
| 23 | |
| 24 $rows=mysqli_fetch_array($result1, MYSQLI_ASSOC); | |
| 25 $email=$rows['Email']; | |
| 26 $password=$rows['Password']; | |
| 27 $fname=$rows['FirstName']; | |
| 28 $sname=$rows['Surname']; | |
| 29 | |
| 30 $tbl_name2="user"; | |
| 31 | |
| 32 // Insert data that retrieves from "temp_members_db" into table "registered_members" | |
| 33 //$add = 'insert into user values (null,\'' . $email . '\',\'' . $password . '\');'; | |
| 34 $add="CALL addNewUser('$email', '$password', '$fname', '$sname', $loc)"; | |
| 35 | |
| 36 //echo $add; | |
| 37 $result2 = mysqli_query($link, $add); | |
| 38 } | |
| 39 // if not found passkey, display message | |
| 40 else { | |
| 41 echo "Invalid Confirmation code"; | |
| 42 } | |
| 43 | |
| 44 // 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" | |
| 45 if($result2){ | |
| 46 //Would prefer to create the cookie here, but GWT doesn't seem able to read it | |
| 47 /*session_start(); | |
| 48 $_SESSION['email']=$email; | |
| 49 //session_id(); | |
| 50 $DURATION = 1209600000;//(1000 * 60 * 60 * 24 * 14); | |
| 51 //Cookies.setCookie("bookWhacksid", sessionID, expires, null, "/", false); | |
| 52 setcookie("bookWhacksid", session_id(), time()+$DURATION);*/ | |
| 53 //echo "Thank you, your account has been activated\nwww.bookwhack.co.uk"; | |
| 54 $redirectURL = "redirect.html"; | |
| 55 header("Location:$redirectURL"); | |
| 56 | |
| 57 // Delete information of this user from table "temp_members_db" that has this passkey | |
| 58 $sql3="DELETE FROM $tbl_name1 WHERE confirm_code = '$passkey'"; | |
| 59 $result3=mysqli_query($link,$sql3); | |
| 60 } | |
| 61 | |
| 62 } | |
| 63 ?> |
