Advertisement
Guest User

Untitled

a guest
Apr 5th, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.83 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Login and Sign Up - Page</title>
  6. <script type="text/javascript">
  7. function validateForm()
  8. {
  9. if (document.getElementById('username').value=="") //username check
  10. {
  11. alert("Username is required");
  12. return false;
  13. }
  14. if (document.getElementById('fullname').value=="") //full name check
  15. {
  16. alert("Full name is required");
  17. return false;
  18. }
  19.  
  20. //check that password is long enough and that the two passwords match
  21. var phoneno = "/^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/";
  22. if(string(document.getElementById(telephone)).value.match(phoneno))
  23. {
  24. return true;
  25. }
  26. else
  27. {
  28. alert("phonenumber did not meet the given form");
  29. return false;
  30. }
  31.  
  32. //check that password is long enough and that the two passwords match
  33. var passw= /^[A-Za-z]\w{7,14}$/;
  34. var inputtxt1 = document.getElementById(password1);
  35. var inputtxt2 = document.getElementById(password2);
  36.  
  37. if(inputtxt1.value.match(passw))
  38. {
  39. if ((inputtxt1 == inputtxt2))
  40. {
  41. return true;
  42. }
  43. else
  44. {
  45. alert("The two passwords you entered do not match.");
  46. return false;
  47. }
  48. }
  49. else
  50. {
  51. alert("Password needs to be at least 7 characters long.");
  52. return false;
  53. }
  54.  
  55. //check that the email contains a domain name
  56. var mailformat = "/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/";
  57. if(document.getElementById(email).value.match(mailformat))
  58. {
  59. return true;
  60. }
  61. else
  62. {
  63. alert("You have entered an invalid email address.");
  64. return false;
  65. }
  66.  
  67. }
  68. //action="login.php" action="register.php"
  69. </script>
  70. </head>
  71. <body>
  72. <h1>login and Register Page</h1>
  73. <h2>Login</h2>
  74. <br>
  75.  
  76. <form method="post" >
  77. Username: <br>
  78. <input type="text" id="loginusername" name="username" required>
  79. <br>
  80. Password: <br>
  81. <input type="Password" id="loginpassword" name="password" >
  82. <br>
  83. <input type="submit" value="Log in">
  84. </form>
  85. <br>
  86. <h2>Sign up</h2>
  87. <form method="post" onsubmit="return validateForm()" autocomplete="off" >
  88. Username: <br><input type="text" name="username" id="username"><br>
  89. Full name: <br><input type="text" name="fullname" id="fullname"><br>
  90. Telephone number: <br><input type="text" name="telephone" id="telephone"><br> in format XXX-XXX-XXXX <br>
  91. Email Address: <br><input type="text" name="email" id="email"><br>
  92. Password: <br><input type="text" name="password" id="password1"><br> minimum of seven characters <br>
  93. Rewrite password: <br><input type="text" name="password" id="password2"><br>
  94. <input type="submit" value="Submit" name="submit_userinfo" id="submit">
  95.  
  96. </form>
  97.  
  98. </body>
  99.  
  100. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement