daily pastebin goal
16%
SHARE
TWEET

Untitled

a guest Mar 20th, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.   $pageTitle = "Bookmark - Register";
  3.   $cssPath = "../css/register.css";
  4.   $resetPath = "../css/reset.css";
  5.   include("../header.php");
  6.   include("../connect.php");
  7. ?>
  8.  
  9. <div class="logo">
  10.   <img src="../img/bookmarkLogo.png" alt="Bookmark">
  11. </div>
  12.  
  13. <div class="registerContainer">
  14.   <div class="registerWindow">
  15.     <h1>Register</h1>
  16.     <br>
  17.     <img class="dividerLine" src="../img/divider.png" alt="fancy divider">
  18.     <br>
  19.     <form name="register" action="regsuccess.php" method="POST" onsubmit="return validateForm(this)">
  20.       <ul>
  21.         <li>
  22.           <label for="username">Username*: </label>
  23.           <input type="text" name="username">
  24.         </li>
  25.         <li>
  26.           <label for="email">E-Mail*: </label>
  27.           <input type="text" name="email">
  28.         </li>
  29.         <li>
  30.           <label for="name">Name: </label>
  31.           <input type="text" name="name">
  32.         </li>
  33.         <li>
  34.           <label for="surname">Surname: </label>
  35.           <input type="text" name="surname">
  36.         </li>
  37.         <li>
  38.           <label for="password">Password*: </label>
  39.           <input type="password" name="password">
  40.         </li>
  41.         <li>
  42.           <label for="confirmPw">Confirm password*: </label>
  43.           <input type="password" name="confirmPw">
  44.         </li>
  45.         <li>
  46.           <input type="submit" name="register" value="Register">
  47.         </li>
  48.       </ul>
  49.       <p>* - field is required</p>
  50.       <p id="warningUsername">Username is required!</p>
  51.       <p id="warningNoEmail">E-Mail is required!</p>
  52.       <p id="warningBadEmail">Please enter a valid E-mail!</p>
  53.       <p id="warningPassword">Password is required!</p>
  54.       <p id="warningConfPw">Passwords don't match!</p>
  55.     </form>
  56.   </div>
  57. </div>
  58.  
  59. <script type="text/javascript">
  60.   function validateForm(form) {
  61.     var username = form.username.value;
  62.     var email = form.email.value;
  63.     var password = form.password.value;
  64.     var confPw = form.confirmPw.value;
  65.     var submit = false;
  66.  
  67.     if (username.length === 0) {
  68.       document.getElementById("warningUsername").style.display = "flex";
  69.       submit = false;
  70.     } else {
  71.       document.getElementById("warningUsername").style.display = "none";
  72.       submit = true;
  73.     }
  74.  
  75.     if (email.length === 0) {
  76.       document.getElementById("warningNoEmail").style.display = "flex";
  77.       submit = false;
  78.     } else if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(form.email.value))) {
  79.       document.getElementById("warningBadEmail").style.display = "flex";
  80.       document.getElementById("warningNoEmail").style.display = "none";
  81.       submit = false;
  82.     } else {
  83.       document.getElementById("warningBadEmail").style.display = "none";
  84.       document.getElementById("warningNoEmail").style.display = "none";
  85.       submit = true;
  86.     }
  87.  
  88.     if (password.length === 0) {
  89.       document.getElementById("warningPassword").style.display = "flex";
  90.       submit = false;
  91.     } else if (password !== confPw) {
  92.       document.getElementById("warningConfPw").style.display = "flex";
  93.       document.getElementById("warningPassword").style.display = "none";
  94.       submit = false;
  95.     } else {
  96.       document.getElementById("warningConfPw").style.display = "none";
  97.       document.getElementById("warningPassword").style.display = "none";
  98.       submit = true;
  99.     }
  100.  
  101.     return submit;
  102.   }
  103. </script>
  104.  
  105. <?php
  106.   include("../footer.php");
  107. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top