Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Login and Sign Up - Page</title>
- <script type="text/javascript">
- function validateForm()
- {
- if (document.getElementById('username').value=="") //username check
- {
- alert("Username is required");
- return false;
- }
- if (document.getElementById('fullname').value=="") //full name check
- {
- alert("Full name is required");
- return false;
- }
- //check that password is long enough and that the two passwords match
- var phoneno = "/^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/";
- if(string(document.getElementById(telephone)).value.match(phoneno))
- {
- return true;
- }
- else
- {
- alert("phonenumber did not meet the given form");
- return false;
- }
- //check that password is long enough and that the two passwords match
- var passw= /^[A-Za-z]\w{7,14}$/;
- var inputtxt1 = document.getElementById(password1);
- var inputtxt2 = document.getElementById(password2);
- if(inputtxt1.value.match(passw))
- {
- if ((inputtxt1 == inputtxt2))
- {
- return true;
- }
- else
- {
- alert("The two passwords you entered do not match.");
- return false;
- }
- }
- else
- {
- alert("Password needs to be at least 7 characters long.");
- return false;
- }
- //check that the email contains a domain name
- var mailformat = "/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/";
- if(document.getElementById(email).value.match(mailformat))
- {
- return true;
- }
- else
- {
- alert("You have entered an invalid email address.");
- return false;
- }
- }
- //action="login.php" action="register.php"
- </script>
- </head>
- <body>
- <h1>login and Register Page</h1>
- <h2>Login</h2>
- <br>
- <form method="post" >
- Username: <br>
- <input type="text" id="loginusername" name="username" required>
- <br>
- Password: <br>
- <input type="Password" id="loginpassword" name="password" >
- <br>
- <input type="submit" value="Log in">
- </form>
- <br>
- <h2>Sign up</h2>
- <form method="post" onsubmit="return validateForm()" autocomplete="off" >
- Username: <br><input type="text" name="username" id="username"><br>
- Full name: <br><input type="text" name="fullname" id="fullname"><br>
- Telephone number: <br><input type="text" name="telephone" id="telephone"><br> in format XXX-XXX-XXXX <br>
- Email Address: <br><input type="text" name="email" id="email"><br>
- Password: <br><input type="text" name="password" id="password1"><br> minimum of seven characters <br>
- Rewrite password: <br><input type="text" name="password" id="password2"><br>
- <input type="submit" value="Submit" name="submit_userinfo" id="submit">
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement