Mercurial > hg > ywww
view user/confirmation.php @ 35:86f79bc1d142
refactor to split out shareable fn to actually do an Amazon API request
author | Charlie Root |
---|---|
date | Fri, 04 Jan 2019 12:54:12 -0500 |
parents | 077b0a0a3e6d |
children | 385ddd7c4b55 a67bf725e87b |
line wrap: on
line source
<?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']; $loc=$rows['LocID']; $displayName=$rows['DisplayName']; $age=$rows['AgeGroup']; $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, '$displayName', $age)"; //echo $add; $result2 = mysqli_query($link, $add); } // if not found passkey, display message else { echo "Invalid Confirmation code"; } mysqli_use_result($link); // 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"; // Delete information of this user from table "temp_members_db" that has this passkey mysqli_close($link); $sql3="DELETE FROM $tbl_name1 WHERE confirm_code = '$passkey'"; //echo $sql3; include "../../private/db.php"; //need to reinclude otherwise an error is thrown $result3=mysqli_query($link,$sql3); mysqli_close($link); $message = "<HTML><STYLE>.chrome-seo_meta-nofollow,.chrome-seo_meta-nofollow *{outline:2px dashed #ffb400!important;outline-offset:1px;}.chrome-seo_nofollow,.chrome-seo_nofollow *{outline:2px dotted #e90000!important;outline-offset:1px;}</STYLE><HEAD><META http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\"> <TITLE> Welcome to YourNextRead and YourNextFilm </TITLE> </HEAD><BODY><TABLE width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" bgcolor=\"#232323\" align=\"center\"> <TBODY><TR><TD> <TABLE width=\"600\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" bgcolor=\"#ffffff\" align=\"center\"> <TBODY> <TR> <tr> <td bgcolor=\"#232323\" width=\"15\"></td> <td bgcolor=\"#232323\"> <center><font face=\"verdana, sans-serif, arial\" color=\"#ffffff\" style=\"font-size:10px;\" size=\"1\"> Having trouble viewing this email? See it <a rel=\"nofollow\" target=\"_blank\" href=\"http://www.yournextread.com/welcome.html\" style=\"color:#ffffff;\">online<font face=\"verdana, sans-serif, arial\" color=\"#ffffff\" style=\"font-size:10px;\" size=\"1\"></font></a>. To help stop our emails being seen as spam, please add <strong><span style=\"border-bottom-style: dashed; border-bottom-width: 1px; border-bottom-color: rgb(0, 102, 204); cursor: pointer; \">newsletter@YourNextRead.com</span></strong> to your address book. <br><br> </font></center> </td> <td bgcolor=\"#232323\" width=\"15\"></td> </tr> <TR> <TD colspan=\"3\" bgcolor=\"#232323\"><IMG src=\"http://www.yournextread.com/images/top_email.jpg\" style=\"display:block;\" width=\"600\" height=\"63\" alt=\"\"></TD> </TR> <TR> <TD bgcolor=\"#ffffff\" colspan=\"2\"> <TABLE width=\"600\" cellpadding=\"5\" cellspacing=\"0\" border=\"0\" bgcolor=\"#ffffff\"> <TBODY> <TR> <td bgcolor=\"#594f43\"> <font face=\"verdana, sans-serif, arial\" color=\"#ffffff\" style=\"font-size:12px;\">" . date("F d, Y") . " </font> </td> </TR> <TR> <TD bgcolor=\"#f2b234\"> <FONT style=\"font-size:12px;\"> </FONT> <FONT face=\"verdana, sans-serif, arial\" color=\"#232323\" style=\"font-size:20px; font-weight:bold;\"> Welcome to YourNextRead and YourNextFilm </FONT> <BR> <FONT face=\"verdana, sans-serif, arial\" color=\"#232323\" style=\"font-size:12px; font-weight:bold;\"> Thanks for registering and a warm welcome </FONT> </TD> </TR> </TBODY> </TABLE> </TD> </TR> <TR> <TR> <TD bgcolor=\"#ffffff\" colspan=\"3\"> <TABLE width=\"570\" cellpadding=\"10\" cellspacing=\"0\" border=\"0\" bgcolor=\"#ffffff\"> <TBODY> <TR> <TD> <FONT face=\"verdana, sans-serif, arial\" color=\"#0000000\" style=\"font-size:12px;\"> Please read on to find out how you can discover and share with YourNextRead and YourNextFilm... </FONT> <BR> <UL style=\"list-style:none;padding:4px;margin:3px;\"> <LI style=\"font-family:verdana, sans-serif, arial;padding:0px;margin:0px;font-weight:100;color:#594f43;font-size:14px;line-height:15px;\">1. <A rel=\"nofollow\" href=\"#first\" style=\"font-weight:bold;color:#594f43;\"><SPAN class=\"yshortcuts\" id=\"lw_1276845861_0\">What are YourNextRead and YourNextFilm?</SPAN></A></LI> <LI style=\"font-family:verdana, sans-serif, arial;padding:0px;margin:0px;font-weight:100;color:#594f43;font-size:14px;line-height:15px;\">2. <A rel=\"nofollow\" href=\"#second\" style=\"font-weight:bold;color:#594f43;\"><SPAN class=\"yshortcuts\" id=\"lw_1276845861_2\">Support us!</SPAN></A></LI> <LI style=\"font-family:verdana, sans-serif, arial;padding:0px;margin:0px;font-weight:100;color:#594f43;font-size:14px;line-height:15px;\">3. <A rel=\"nofollow\" href=\"#fourth\" style=\"font-weight:bold;color:#594f43;\"><SPAN class=\"yshortcuts\" id=\"lw_1276845861_3\">New features</SPAN></A></LI> <LI style=\"font-family:verdana, sans-serif, arial;padding:0px;margin:0px;font-weight:100;color:#594f43;font-size:14px;line-height:15px;\">4. <A rel=\"nofollow\" href=\"#fifth\" style=\"font-weight:bold;color:#594f43;\"><SPAN class=\"yshortcuts\" id=\"lw_1276845861_3\">Six degrees of recommendations...</SPAN></A></LI> </UL> <BR> <P style=\"font-family:verdana, sans-serif, arial;font-weight:100;color:#f2b234;font-size:20px;line-height:22px;font-weight:bold;letter-spacing:-1px;padding:0px;margin:0px;\"> <A rel=\"nofollow\" name=\"first\" style=\"color:#594f43;\"> 1. What are YourNextRead and YourNextFilm? </A></P> <DIV style=\"border-bottom:solid;border-bottom-width:3px;border-bottom-color:#f2b234;height:1px;width:570px;margin-top:5px;margin-bottom:5px;\"></DIV> <P style=\"font-family:verdana, sans-serif, arial;font-weight:100;color:#433f40;font-size:13px;line-height:14px;\"> YourNextRead.com and YourNextFilm.com help you discover your next book and film. Discovering becomes fun and enjoyable with us. We combine reviews, opinions and bring together the online crowd to make discovery simple. </P> <P style=\"font-family:verdana, sans-serif, arial;font-weight:100;color:#433f40;font-size:13px;line-height:14px;\"> YourNextRead and Film are uniquely powered by our users. We combine simple one page navigation with multiple reviews and user recommendations. YourNextRead and Film go beyond simply collecting reviews to actually summarising group opinion. We make recommending simple. </P> <P style=\"font-family:verdana, sans-serif, arial;font-weight:100;color:#433f40;font-size:13px;line-height:14px;\"> To find out more please go to the <A rel=\"nofollow\" target=\"_blank\" href=\"http://www.yournextread.com/further-info.html\" style=\"font-weight:bold;color:#594f43;\">YNRead - Further info</A> or <A rel=\"nofollow\" target=\"_blank\" href=\"http://www.yournextfilm.com/further-info.html\" style=\"font-weight:bold;color:#594f43;\">YNFilm - Further info</A> pages. </P> <DIV style=\"border-bottom:solid;border-bottom-width:2px;border-bottom-color:#f2b234;height:1px;width:570px;margin-top:8px;margin-bottom:10px;\"></DIV> <P style=\"font-family:verdana, sans-serif, arial;font-weight:100;color:#f2b234;font-size:20px;line-height:22px;font-weight:bold;letter-spacing:-1px;padding:0px;margin:0px;\"> <A rel=\"nofollow\" name=\"second\" style=\"color:#594f43;\"> 2. Support us! </A></P> <DIV style=\"border-bottom:solid;border-bottom-width:3px;border-bottom-color:#f2b234;height:1px;width:570px;margin-top:5px;margin-bottom:5px;\"></DIV> <P style=\"font-family:verdana, sans-serif, arial;font-weight:100;color:#433f40;font-size:13px;line-height:14px;\"> Each time you buy anything (book, car, zebra...) from Amazon you can <A rel=\"nofollow\" target=\"_blank\" href=\"http://www.yournextread.com/us/#!SupportUs\" style=\"font-weight:bold;color:#594f43;\">Support Us</A>. All you need to do is drag the Amazon buy now button to your bookmark buy from the <A rel=\"nofollow\" target=\"_blank\" href=\"http://www.yournextread.com/us/#!SupportUs\" style=\"font-weight:bold;color:#594f43;\">Support Us</A> page. </P> <DIV style=\"border-bottom:solid;border-bottom-width:2px;border-bottom-color:#f2b234;height:1px;width:570px;margin-top:8px;margin-bottom:10px;\"></DIV> <P style=\"font-family:verdana, sans-serif, arial;font-weight:100;color:#f2b234;font-size:20px;line-height:22px;font-weight:bold;letter-spacing:-1px;padding:0px;margin:0px;\"> <A rel=\"nofollow\" name=\"fourth\" style=\"color:#594f43;\"> 3. New features </A></P> <DIV style=\"border-bottom:solid;border-bottom-width:3px;border-bottom-color:#f2b234;height:1px;width:570px;margin-top:5px;margin-bottom:5px;\"></DIV> <P style=\"font-family:verdana, sans-serif, arial;font-weight:100;color:#433f40;font-size:13px;line-height:14px;\"> We want to make YourNextRead and Film websites where you discover and share your next book and film. To make discovery and sharing as easy as possible we are continuely adding new features to YourNextRead and YourNextFilm. </P> <P style=\"font-family:verdana, sans-serif, arial;font-weight:100;color:#433f40;font-size:13px;line-height:14px;\"> We want to hear from you how we can make YourNextRead and Film better. If you have any suggestions then please email us <A rel=\"nofollow\" target=\"_blank\" href=\"mailto:feedback@yournextread.com\" style=\"font-weight:bold;color:#594f43;\">YNRead - feedback</A> or <A rel=\"nofollow\" target=\"_blank\" href=\"mailto:feedback@yournextread.com\" style=\"font-weight:bold;color:#594f43;\">YNFilm - feedback</A> </P> <DIV style=\"border-bottom:solid;border-bottom-width:2px;border-bottom-color:#f2b234;height:1px;width:570px;margin-top:8px;margin-bottom:10px;\"></DIV> <P style=\"font-family:verdana, sans-serif, arial;font-weight:100;color:#f2b234;font-size:20px;line-height:22px;font-weight:bold;letter-spacing:-1px;padding:0px;margin:0px;\"> <A rel=\"nofollow\" name=\"fifth\" style=\"color:#594f43;\"> 4. Six degrees of recommendations... </A></P> <DIV style=\"border-bottom:solid;border-bottom-width:3px;border-bottom-color:#f2b234;height:1px;width:570px;margin-top:5px;margin-bottom:5px;\"></DIV> <P style=\"font-family:verdana, sans-serif, arial;font-weight:100;color:#433f40;font-size:13px;line-height:14px;\"> During some down time (yes we sometimes take a break) the YourNextRead and Film team use the map of books and films to discover new and bizarre relationships. We discovered that our map (intentionally of course) can be used in the same way as 6 degrees of separation (the theory that everyone is at most six steps away from any other person on Earth). This rarely leads to dead ends but if you find one and know the book or film, then add a new recommendation for others to keep discovering. So start playing and recommending.... </P> <DIV style=\"border-bottom:solid;border-bottom-width:2px;border-bottom-color:#f2b234;height:1px;width:570px;margin-top:8px;margin-bottom:10px;\"></DIV> <P style=\"font-family:verdana, sans-serif, arial;font-weight:100;color:#433f40;font-size:13px;line-height:14px;\">We will keep you up to date with new features and events<BR></P> <P style=\"font-family:verdana, sans-serif, arial;font-weight:100;color:#433f40;font-size:13px;line-height:14px;\">Thanks for signing up,</P> <P style=\"font-family:verdana, sans-serif, arial;font-weight:100;color:#433f40;font-size:13px;line-height:14px;\">The YourNextRead and Film Communities</P> <DIV style=\"border-bottom:solid;border-bottom-width:1px;border-bottom-color:#cccccc;height:1px;width:480px;margin-top:20px;margin-bottom:15px;\"></DIV> </TD> </TR> </TBODY> </TABLE> </TD> </TR> <TR> <TD colspan=\"3\" bgcolor=\"#232323\"><BR> <FONT face=\"arial, verdana, sans-serif\" color=\"#ffffff\" size=\"1\" style=\"font-size:10px;\"> Terms and Conditions <BR> This is a genuine email from <SPAN style=\"border-bottom-style: dashed; border-bottom-width: 1px; border-bottom-color: rgb(0, 102, 204); cursor: pointer; \">YourNextRead/YourNextFilm</SPAN>. However, if you receive an email which you are concerned does not legitimately originate from us, you can report it via <A rel=\"nofollow\" target=\"_blank\" href=\"mailto:feedback@yournextread.com\" style=\"color:#ffffff;\"><SPAN class=\"yshortcuts\">emailing us</SPAN></A> before deleting it. <BR> You have received this email because you have opted in to receive news, updates and offers from YourNextRead and YourNextFilm <BR> You can <A rel=\"nofollow\" target=\"_blank\" href=\"http://www.yournextread.com/user/unsubscribe.php?email=$email\" style=\"color:#ffffff;\"><SPAN>unsubscribe here</SPAN></A>, however as the majority of our communications are via email, you'll be missing out. <BR> </FONT> </TD> </TR> </TBODY></TABLE> </TD></TR></TBODY></TABLE> </BODY></HTML>"; if (substr($email,0,1) != "@") { $header="from: YourNextRead <newsletter@YourNextRead.com>\nContent-Type: text/html; charset=iso-8859-1"; $to=$email; $subject="Welcome to YourNextRead"; $sentmail = mail($to,$subject,$message,$header); } $redirectURL = "redirect.html"; header("Location:$redirectURL"); } } ?>