Advertisement
Guest User

Untitled

a guest
Aug 19th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 KB | None | 0 0
  1. <?php
  2. /*
  3. Author: Javed Ur Rehman
  4. Website: http://www.allphptricks.com/
  5. */
  6. ?>
  7.  
  8. <!DOCTYPE html>
  9. <html>
  10. <head>
  11. <meta charset="utf-8">
  12. <title>Registration</title>
  13. <link rel="stylesheet" href="css/style.css" />
  14. </head>
  15. <body>
  16. <?php
  17. require('db.php');
  18. // If form submitted, insert values into the database.
  19. if (isset($_REQUEST['username'])){
  20. $username = stripslashes($_REQUEST['username']); // removes backslashes
  21. $username = mysqli_real_escape_string($con,$username); //escapes special characters in a string
  22. $password = stripslashes($_REQUEST['password']);
  23. $password = mysqli_real_escape_string($con,$password);
  24. $pin = stripslashes($_REQUEST['pin']);
  25. $pin = mysqli_real_escape_string($con,$pin);
  26.  
  27. $trn_date = date("Y-m-d H:i:s");
  28.  
  29. //$d = stripslashes($_REQUEST['d']);
  30. //$d = mysqli_real_escape_string($con,$d);
  31.  
  32.  
  33. if(isset($_POST['d']) &&
  34.  
  35. $_POST['d'] == 'Yes')
  36.  
  37.  
  38. $query = "INSERT into `users` (username, password, pin, trn_date,d) VALUES ('$username', '".($password)."', '$pin', '$trn_date','$d')";
  39. $result = mysqli_query($con,$query);
  40.  
  41. // $d = (isset($_REQUEST['d']) ? true : false;
  42.  
  43.  
  44.  
  45.  
  46. if($result){
  47. echo "<div class='form'><h3>You are registered successfully.</h3><br/>Click here to <a href='login.php'>Login</a></div>";
  48. }
  49. }else{
  50. ?>
  51. <div class="form">
  52. <h1>Registration</h1>
  53. <form name="registration" action="" method="post">
  54. <input type="text" name="username" placeholder="Username" required />
  55. <input type="password" name="password" placeholder="Password" required />
  56. <input type="password" name="password" placeholder="Password repeat" required />
  57. <input type="password" name="pin" placeholder="(4 Digit Minimum) Pin" required />
  58. <br />
  59. <br />
  60.  
  61. Do you have a
  62. <br />
  63. dream market account?
  64. <input type="checkbox" name="d" value="Yes" />
  65. <br />
  66. <br />
  67. (this will give you a free vendor account)
  68. <br />
  69. <br />
  70.  
  71. <input type="submit" name="submit" value="Register" />
  72. </form>
  73. <br /><br />
  74. </div>
  75. <?php } ?>
  76. </body>
  77. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement