Advertisement
Guest User

Untitled

a guest
Aug 14th, 2016
436
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.84 KB | None | 0 0
  1. <?php
  2. $MonthArray = array(
  3. 1=>"January",
  4. 2=> "February",
  5. 3=> "March",
  6. 4=> "April",
  7. 5=> "May",
  8. 6=> "June",
  9. 7=> "July",
  10. 8=> "August",
  11. 9=> "September",
  12. 10=> "October",
  13. 11=> "November",
  14. 12=> "December",
  15. );
  16. ?>
  17.  
  18. <!DOCTYPE html>
  19. <html>
  20. <head>
  21. <title>Sign up</title>
  22. </head>
  23. <body>
  24. <div id="container">
  25. <div id="signup">
  26. <form action="SignupProcess.php" method="POST">
  27. <!-- Complete Name -->
  28. <div class="Name">
  29. <label><span style="font-weight:bold">Name</span></label>
  30. <br>
  31. <input type="text" name="firstname" size="15" placeholder="First" required>
  32. <input type="text" name="lastname" size="15" placeholder="Last" required>
  33. </div>
  34. <br>
  35.  
  36. <!-- Username -->
  37. <div class="Username">
  38. <label><span style="font-weight:bold">Choose your username</span></label><br>
  39. <input type="text" name="username" size="35" required>
  40. </div>
  41. <br>
  42.  
  43. <!-- Password -->
  44. <div class="Password">
  45. <label><span style="font-weight:bold">Create a password</span></label><br>
  46. <input type="password" name="createpassword" size="35" required>
  47. <br><br>
  48.  
  49. <label><span style="font-weight:bold">Confirm your password</span></label><br>
  50. <input type="password" name="confirmpassword" size="35" required>
  51. </div>
  52. <br>
  53.  
  54. <!-- Birthdate -->
  55. <div class="Birthdate">
  56. <select name="month" required>
  57. <option disabled selected>Month</option>
  58. <?php foreach($MonthArray as $monthkey => $value) { ?>
  59. <option value="<?php echo $monthkey ?>"><?php echo $value ?></option>
  60. <?php }?>
  61. </select>
  62.  
  63. <input type="text" name="day" placeholder="Day" size="5" required>
  64.  
  65. <select name="year" required>
  66. <?php
  67. foreach(range(1990, (int)date("Y")) as $year) {
  68. echo "t<option value='".$year."'>".$year."</option>nr";
  69. rsort($year);
  70. }
  71. ?>
  72. </select>
  73. </div>
  74.  
  75. <!-- Buttons -->
  76. <div class="Buttons">
  77. <input type="submit" id="signup" name="signupsubmit">
  78. <input type="reset" id="reset" name="signupreset">
  79. </div>
  80.  
  81. </form>
  82. </div>
  83. </div>
  84. </body>
  85. </html>
  86.  
  87. <?php
  88. include("CreateConnection.php");
  89.  
  90. //Get values from form Signup.php file
  91. $FirstName = mysqli_real_escape_string($connect, $_POST['firstname']);
  92. $LastName = mysqli_real_escape_string($connect, $_POST['lastname']);
  93. $Username = mysqli_real_escape_string($connect, $_POST['username']);
  94. $CreatePassword = mysqli_real_escape_string($connect, $_POST['createpassword']);
  95. $ConfirmPassword = mysqli_real_escape_string($connect, $_POST['confirmpassword']);
  96. $Month = mysqli_real_escape_string($connect, $_POST['month']);
  97. $Day = mysqli_real_escape_string($connect, $_POST['day']);
  98. $Year = mysqli_real_escape_string($connect, $_POST['year']);
  99. //Removes back slashes in input
  100. $FirstName = stripcslashes($FirstName);
  101. $LastName = stripcslashes($LastName);
  102. $Username = stripcslashes($Username);
  103. $CreatePassword = stripcslashes($CreatePassword);
  104. $ConfirmPassword = stripcslashes($ConfirmPassword);
  105. $Month = stripcslashes($Month);
  106. $Day = stripcslashes($Day);
  107. $Year = stripcslashes($Year);
  108.  
  109. if($CreatePassword != $ConfirmPassword)
  110. {
  111. echo "<script type='text/javascript'>alert('Password does not match please check.');</script> ";
  112. echo "<script>setTimeout("location.href = 'Signup.php'", 0)</script>";
  113. }
  114. else
  115. {
  116. //Query Insert into tablereminders
  117. $query = mysqli_query($connect, "INSERT INTO `tablereminders`(`username`, `password`, `firstname`, `lastname`, `Month`, `Day`, `Year`)
  118. VALUES ('$Username','$ConfirmPassword','$FirstName','$LastName','$Month','$Day','$Year')");
  119. }
  120. //Error connection and query
  121. if(mysqli_query($connect, $query))
  122. {
  123. echo "New record created successfully";
  124. echo "<script>setTimeout("location.href = 'LoginReminder.php'", 500)</script>";
  125. }
  126.  
  127. ?>
  128.  
  129. if($CreatePassword != $ConfirmPassword)
  130. {
  131. echo "<script type='text/javascript'>alert('Password does not match please check.');</script> ";
  132. echo "<script>setTimeout("location.href = 'Signup.php'", 0)</script>";
  133. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement