Advertisement
Guest User

adibtes

a guest
Nov 9th, 2016
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.35 KB | None | 0 0
  1. <?php
  2. session_start();
  3. require_once 'class.user.php';
  4.  
  5. $reg_user = new USER();
  6.  
  7. if($reg_user->is_logged_in()!="")
  8. {
  9. $reg_user->redirect('home.php');
  10. }
  11.  
  12.  
  13. if(isset($_POST['btn-signup']))
  14. {
  15. $uname = trim($_POST['txtuname']);
  16. $email = trim($_POST['txtemail']);
  17. $uadib = trim($_POST['txtadib']);
  18. $upass = trim($_POST['txtpass']);
  19. $code = md5(uniqid(rand()));
  20.  
  21. $stmt = $reg_user->runQuery("SELECT * FROM tbl_users WHERE userEmail=:email_id");
  22. $stmt->execute(array(":email_id"=>$email));
  23. $row = $stmt->fetch(PDO::FETCH_ASSOC);
  24.  
  25. if($stmt->rowCount() > 0)
  26. {
  27. $msg = "
  28. <div class='alert alert-error'>
  29. <button class='close' data-dismiss='alert'>&times;</button>
  30. <strong>Sorry !</strong> email allready exists , Please Try another one
  31. </div>
  32. ";
  33. }
  34. else
  35. {
  36. if($reg_user->register($uname,$email,$uadib,$upass,$code))
  37. {
  38. $id = $reg_user->lasdID();
  39. $key = base64_encode($id);
  40. $id = $key;
  41.  
  42. $message = "
  43. Hello $uname,
  44. <br /><br />
  45. Welcome to Coding Cage!<br/>
  46. To complete your registration please , just click following link<br/>
  47. <br /><br />
  48. <a href='http://localhost/x/verify.php?id=$id&code=$code'>Click HERE to Activate :)</a>
  49. <br /><br />
  50. Thanks,";
  51.  
  52. $subject = "Confirm Registration";
  53.  
  54. $reg_user->send_mail($email,$message,$subject);
  55. $msg = "
  56. <div class='alert alert-success'>
  57. <button class='close' data-dismiss='alert'>&times;</button>
  58. <strong>Success!</strong> We've sent an email to $email.
  59. Please click on the confirmation link in the email to create your account.
  60. </div>
  61. ";
  62. }
  63. else
  64. {
  65. echo "sorry , Query could no execute...";
  66. }
  67. }
  68. }
  69. ?>
  70. <!DOCTYPE html>
  71. <html>
  72. <head>
  73. <title>Signup | Coding Cage</title>
  74. <!-- Bootstrap -->
  75. <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
  76. <link href="bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet" media="screen">
  77. <link href="assets/styles.css" rel="stylesheet" media="screen">
  78. <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
  79. <!--[if lt IE 9]>
  80. <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
  81. <![endif]-->
  82. <script src="js/vendor/modernizr-2.6.2-respond-1.1.0.min.js"></script>
  83. </head>
  84. <body id="login">
  85. <div class="container">
  86. <?php if(isset($msg)) echo $msg; ?>
  87. <form class="form-signin" method="post">
  88. <h2 class="form-signin-heading">Sign Up</h2><hr />
  89. <input type="text" class="input-block-level" placeholder="Username" name="txtuname" required />
  90. <input type="email" class="input-block-level" placeholder="Email address" name="txtemail" required />
  91. <input type="text" class="input-block-level" placeholder="Adib tes" name="txtadib" required />
  92. <input type="password" class="input-block-level" placeholder="Password" name="txtpass" required />
  93. <hr />
  94. <button class="btn btn-large btn-primary" type="submit" name="btn-signup">Sign Up</button>
  95. <a href="index.php" style="float:right;" class="btn btn-large">Sign In</a>
  96. </form>
  97.  
  98. </div> <!-- /container -->
  99. <script src="vendors/jquery-1.9.1.min.js"></script>
  100. <script src="bootstrap/js/bootstrap.min.js"></script>
  101. </body>
  102. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement