Advertisement
Guest User

Untitled

a guest
Apr 18th, 2014
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.79 KB | None | 0 0
  1. $db->beginTransaction();
  2. $ipaddress = getenv('REMOTE_ADDR');
  3. $stmt2 = $db->prepare("INSERT INTO members (username, email, password, signup_date, ipaddress) VALUES (:username, :email1, :bcrypt, now(), :ipaddress)");
  4. $stmt2->bindParam(':username', $username, PDO::PARAM_STR);
  5. $stmt2->bindParam(':email1', $email1, PDO::PARAM_STR);
  6. $stmt2->bindParam(':bcrypt',$bcrypt, PDO::PARAM_STR);
  7. $stmt->bindParam(':ipaddress', $ipaddress, PDO::PARAM_INT);
  8. $stmt->execute();
  9. //get the last id inserted to the db which is now this users id for activation and member folder creation///
  10. $lastId = $db->lastInsertId();
  11. $stmt3 = $db->prepare("INSERT INTO activate (user, token) VALUES (:lastId , :token)");
  12. $stmt3->bindValue(':lastId', $lastId, PDO::PARAM_STR);
  13. $stmt3->bindValue(':token', $token, PDO::PARAM_STR);
  14. $stmt3->execute();
  15. //send email activation to new user///
  16. $from = "From: Auto Responder @ geekifyme <admin@geekifyme.org>";
  17. $subject = "IMPORTANT: Activate your geekifyme account";
  18. $link = "http://www.geekifyme.org/scripts/activate.php?user='.$lastId.'$token='.$token.";
  19. //strt email body////
  20. $message = "
  21. Thanks for registering an account at GeekifyMe! There is just one last step in setting up your account. Please click the link below to confirm your identity and get started. If the link below is not active please copy and paste it into your browser bar.
  22.  
  23. $link
  24. ";
  25. //set headers////
  26. $headers = 'MIME-Version: 1.0' . "rn";
  27. $headers .= "Content_type: textrn";
  28. $headers .= "From: $fromrn";
  29. //send the email now/////
  30. mail($email1, $subject, $message, $headers);
  31. $db->commit();
  32. echo 'Thanks for joining! Check your email in a few moments to activate your account so that you may log in.';
  33. $db = null;
  34. exit();
  35. }
  36. catch(PDOException $e){
  37. $db->rollBack();
  38. echo $e->getMessage();;
  39. $db = null;
  40. exit();
  41. }
  42.  
  43. $stmt2 = $db->prepare("INSERT INTO members (username, email, password, signup_date, ipaddress) VALUES (:username, :email1, :bcrypt, now(), :ipaddress)");
  44. ^---- note the 2
  45. $stmt->bindParam(':ipaddress', $ipaddress, PDO::PARAM_INT);
  46. ^--- note the LACK of a 2
  47. $stmt->execute();
  48. ^--- ditto
  49.  
  50. $stmt2 = $db->prepare("INSERT INTO members (username, email, password, signup_date, ipaddress) VALUES (:username, :email1, :bcrypt, now(), :ipaddress)");
  51. $stmt2->bindParam(':username', $username, PDO::PARAM_STR);
  52. $stmt2->bindParam(':email1', $email1, PDO::PARAM_STR);
  53. $stmt2->bindParam(':bcrypt',$bcrypt, PDO::PARAM_STR);
  54. $stmt2->bindParam(':ipaddress', $ipaddress, PDO::PARAM_INT);
  55. $stmt2->execute();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement