Advertisement
Guest User

Untitled

a guest
Mar 30th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.09 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en-US" class="Html" id="Main" dir="auto">
  3. <head class="Head" id="Main">
  4. <link rel="stylesheet" type="text/css" href="style.css">
  5. <meta name="description" content="123">
  6. <meta name="author" content="123">
  7. <title class="Title" id="Title">Registration</title>
  8. </head>
  9. <body class="Body" id="Main">
  10. <nav>
  11. <ul>
  12. <li><a href="home.php">Home</a></li>
  13. <li><a href="about.php">About</a></li>
  14. <li><a href="albums.php">The Albums</a></li>
  15. <li><a href="shoppingcart.php">Shopping Cart</a></li>
  16. </ul>
  17. </nav>
  18. <div class="a00">Registration</div>
  19.  
  20.  
  21. <script type="text/javascript">
  22.  
  23. function FormValidation(theForm) {
  24. var errors = "";
  25. var email = /^w+@[a-zA-Z_]+?.[a-zA-Z]{2,3}$/;
  26. var username = /^[a-zA-Z0-9]{3,15}$/;
  27. var password = /^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*][a-zA-Z0-9!@#$%^&*]{8,16}$/;
  28.  
  29. if (theForm.one.value == "") {
  30. errors += "Please enter your username name! n";
  31. }
  32.  
  33. else if (!username.test(theForm.one.value)) {
  34. errors += "Username is wrong! n";
  35. errors += "Username includes wrong characters! n";
  36. errors += "Username must include only alphabetical and numeric characters! n";
  37. errors += "Username must be between 3 and 15 characters! n";
  38. }
  39.  
  40. if (theForm.two.value == "") {
  41. errors += "Please enter your password! n";
  42. }
  43.  
  44. else if (!password.test(theForm.two.value)) {
  45. errors += "Password is wrong! n";
  46. errors += "Password includes wrong characters! n";
  47. errors += "Password must include at least one uppercase alphabetical character! n";
  48. errors += "Password must include at least one lowercase alphabetical character! n";
  49. errors += "Password must include at least one numerical character! n";
  50. errors += "Password must include at least one special character! n";
  51. errors += "Username must be between 8 and 16 characters! n";
  52. }
  53.  
  54. if (theForm.three.value == "") {
  55. errors += "Please enter your e-mail address! n";
  56. }
  57.  
  58. else if (!email.test(theForm.three.value)) {
  59. errors += "E-mail address is wrong n";
  60. errors += "E-mail address must be in the right format! n";
  61. }
  62.  
  63. if (!errors == "") {
  64. alert("LIST OF ERRORS: n" + errors);
  65. return false;
  66. } else {
  67. return true;
  68. }
  69. }
  70.  
  71. function ShowHelpUsername() {
  72. document.getElementById("demo1").innerHTML = "Help: Fill in your username. It must be unique and easy to remmeber.";
  73. }
  74.  
  75. function ShowHelpPassword() {
  76. document.getElementById("demo1").innerHTML = "Help: Fill in your password. It must include 1 uppercase alphabetical character, 1 lowercase alphabetical character, 1 numeric character, and 1 special character.";
  77. }
  78.  
  79. function ShowHelpEmail() {
  80. document.getElementById("demo1").innerHTML = "Help: Fill in your personal electronic mail.";
  81. }
  82.  
  83. </script>
  84.  
  85.  
  86. <?php
  87. $con = mysqli_connect("", "","", "");
  88. if (!$con) {
  89. die("Error: " . mysqli_connect_error());
  90. }
  91.  
  92. if (isset($_POST['register'])) {
  93.  
  94. $username=mysql_real_escape_string($_POST['one']);
  95. $email=mysql_real_escape_string($_POST['three']);
  96. $password=mysql_real_escape_string($_POST['two']);
  97. $mysqlget="INSERT INTO users (username,email,password) VALUES ('$username','$email','$password')";
  98.  
  99. mysqli_query($con, $mysqlget) or die ("Error: " . mysql_error($con));
  100.  
  101. }
  102. ?>
  103.  
  104. <form method="POST" action="registration.php" class="myForm" name="myForm" onSubmit="javascript:return FormValidation(this)">
  105. <div class="form-group-username">
  106. <label for="username">Username</label><br>
  107. <input type="text" placeholder="Between 3 and 15 characters" class="form-control-1" id="one" name="one" onfocus="ShowHelpUsername()">
  108. </div>
  109. <div class="form-group-password">
  110. <label for="password">Password</label><br>
  111. <input type="password" placeholder="Between 8 and 16 characters" class="form-control-2" id="two" name="two" onfocus="ShowHelpPassword()">
  112. </div>
  113. <div class="form-group-email">
  114. <label for="e-mail">E-mail</label><br>
  115. <input type="text" placeholder="For safety purposes" class="form-control-3" id="three" name="three" onfocus="ShowHelpEmail()">
  116. </div>
  117. <div class="form-group-submit">
  118. <input type="submit" name="register" class="submit_form_55" value="Create Account">
  119. </div>
  120. <div class="form-group-help">
  121. <p id="demo1"></p>
  122. </div>
  123.  
  124. </form>
  125. </body>
  126. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement