PageRenderTime 47ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 0ms

/mybookbag/activate.php

https://bitbucket.org/s2223902/mybookbag
PHP | 88 lines | 72 code | 14 blank | 2 comment | 10 complexity | e204ef66ca73402351c1bc1af63f149e MD5 | raw file
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <link href='http://fonts.googleapis.com/css?family=Varela+Round' rel='stylesheet' type='text/css'>
  6. <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
  7. <link rel="stylesheet" href="css/formstyles.css" type="text/css" />
  8. <script type="text/javascript" src="js/Placeholders.js"></script>
  9. <script type="text/javascript">
  10. Placeholders.init({
  11. live: true,
  12. hideOnFocus: true});
  13. </script>
  14. <link href="css/toolbar.css" rel="stylesheet" type="text/css" />
  15. <title>MyBookBag Activation</title>
  16. </head>
  17. <body><?php
  18. include ('db_connection.php');
  19. if (isset($_GET['email']) && preg_match('/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/', $_GET['email']))
  20. {
  21. $email = $_GET['email'];
  22. }
  23. if (isset($_GET['key']) && (strlen($_GET['key']) == 32))//The Activation key will always be 32 since it is MD5 Hash
  24. {
  25. $key = $_GET['key'];
  26. }
  27. if (isset($email) && isset($key))
  28. {
  29. // Update the database to set the "activation" field to null
  30. $query_activate_account = "UPDATE users SET activation=NULL WHERE(email ='$email' AND activation='$key')LIMIT 1";
  31. $result_activate_account = mysql_query($query_activate_account) ;
  32. // Print a customized message:
  33. if (mysql_affected_rows($dbc) == 1)//if update query was successfull
  34. {
  35. echo
  36. '
  37. <div id="carbonForm">
  38. <div id="logo">
  39. <img src="img/logo.png" />
  40. </div>
  41. <h1>Success!</h1>
  42. <div class="fieldContainer">
  43. <p>Your bookbag is now ready to go!</p><br />
  44. <p>Wy wait? Go <a href="index.php">grab it</a>!</p>
  45. </div> <!-- Closing fieldContainer -->
  46. </div>';
  47. } else
  48. {include ("php/random-bg.php");
  49. echo
  50. '
  51. <div id="carbonForm">
  52. <div id="logo">
  53. <img src="img/logo.png" />
  54. </div>
  55. <h1>Oops!</h1>
  56. <div class="fieldContainer">
  57. <p>Your account could not be activated.</p><br />
  58. <p>Perhaps your account already is activated? Try to <a href="index.php">login</a>.</p>
  59. </div> <!-- Closing fieldContainer -->
  60. </div>';
  61. }
  62. mysql_close($dbc);
  63. } else {
  64. echo '<div class="errormsgbox">Error Occured .</div>';
  65. }
  66. ?>
  67. </body>
  68. </html>