Advertisement
Guest User

Untitled

a guest
Dec 10th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 2.71 KB | None | 0 0
  1. <?php
  2.  
  3. function sanitizeFormField($inputText, $toLower = false)  {
  4.  
  5.     $inputText = strip_tags($inputText);
  6.     $inputText = str_replace(" ", "", $inputText);
  7.     if($toLower)
  8.         $inputText = ucfirst(strtolower($inputText));
  9.  
  10.     return $inputText;
  11. }
  12.  
  13. if(isset($_POST['loginButton'])) {
  14.     //Register button has been pressed
  15. }
  16.  
  17. if(isset($_POST["registerButton"])) {
  18.     //Register button has been pressed
  19.  
  20.     $userName = sanitizeFormField($_POST['userName']);
  21.     $firstName = sanitizeFormField($_POST['firstName'], true);
  22.     $lastName = sanitizeFormField($_POST['lastName'], true);
  23.     $email = sanitizeFormField($_POST['email'], true);
  24.     $confirmEmail = sanitizeFormField($_POST['confirmEmail'], true);
  25.     $password = sanitizeFormField($_POST['password']);
  26.     $confirmPassword = sanitizeFormField($_POST['confirmPassword']);
  27. }
  28.  
  29. ?>
  30.  
  31. <html>
  32. <head>
  33.     <title></title>
  34. </head>
  35. <body>
  36.     <div id="inputContainer">
  37.         <form id="loginForm" action="register.php" method="POST">
  38.             <h2>Login to your account</h2>
  39.             <p>
  40.                 <label for="loginUsername">Username</label>
  41.                 <input id="loginUsername" name="loginUsername" type="text" placeholder="e.g. Pr3k0" required>
  42.             </p>
  43.             <p>
  44.                 <label for="loginPassword">Password</label>
  45.                 <input id="loginPassword" name="loginPassword" type="password" placeholder="Your password" required>
  46.             </p>
  47.  
  48.             <button type="submit" name="loginButton">LOG IN</button>
  49.         </form>
  50.  
  51.         <form id="registerForm" action="register.php" method="POST">
  52.             <h2>Create your account</h2>
  53.             <p>
  54.                 <label for="userName">Username</label>
  55.                 <input id="userName" name="userName" type="text" placeholder="e.g. Pr3k0" required>
  56.             </p>
  57.  
  58.             <p>
  59.                 <label for="firstName">First name</label>
  60.                 <input id="firstName" name="firstName" type="text" placeholder="e.g. Istvan" required>
  61.             </p>
  62.  
  63.             <p>
  64.                 <label for="lastName">Last name</label>
  65.                 <input id="lastName" name="lastName" type="text" placeholder="e.g. Orban" required>
  66.             </p>
  67.  
  68.             <p>
  69.                 <label for="email">Email address</label>
  70.                 <input id="email" name="email" type="email" placeholder="e.g. istvanorban@gmail.com" required>
  71.             </p>
  72.  
  73.             <p>
  74.                 <label for="confirmEmail">Confirm email address</label>
  75.                 <input id="confirmEmail" name="confirmEmail" type="email" placeholder="e.g. istvanorban@gmail.com" required>
  76.             </p>
  77.  
  78.             <p>
  79.                 <label for="password">Password</label>
  80.                 <input id="password" name="password" type="password" placeholder="Your password" required>
  81.             </p>
  82.  
  83.             <p>
  84.                 <label for="confrimPassword">Password</label>
  85.                 <input id="confirmPassword" name="password" type="password" placeholder="Your password" required>
  86.             </p>
  87.  
  88.             <button type="submit" name="registerButton">SIGN UP</button>
  89.         </form>
  90.     </div>
  91. </body>
  92. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement