Advertisement
Guest User

Untitled

a guest
Aug 18th, 2018
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.72 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <?php include_once "Config.php"; ?>
  3. <head>
  4.     <title>Registration/Login</title>
  5. </head>
  6.         <body>
  7.         <center>
  8.             <div>
  9.                 <form  method="post" action="RegistrationCompletion.php">
  10.  
  11.                     Registration<br><br>
  12.  
  13.                     Username: <input type="text" id="username" name="username" maxlength="20" minlength="4" value="<?php
  14.                     if (isset($_POST["username"])) {
  15.                         echo $_POST["username"];
  16.                     }
  17.                     ?>" required> <?php
  18.                         // Check if unique username
  19.                     ?>
  20.                     <br><br>
  21.  
  22.                     Password: <input type="password" id="password" name="password" maxlength="20" minlength="8" value="<?php
  23.                     if (isset($_POST["password"])) {
  24.                         echo $_POST["password"];
  25.                     }
  26.                         ?>" required><br><br>
  27.                     Repeat password: <input type="password" id="reppassword" name="reppassword" required/><br><br>
  28.  
  29.                     E-mail: <input type="email" id="usermail" name="usermail"value="<?php
  30.                     if(isset($_POST["usermail"])){
  31.                         echo $_POST['usermail'];
  32.                     }
  33.                     ?>" required/><?php
  34.                     // Check if unique email
  35.                     ?>
  36.  
  37.                     <br><br>
  38.                     <?php
  39.                     if(isset($_POST["password"]) and isset($_POST["reppassword"])) {
  40.                         if (trim($_POST["password"]) == "" or trim($_POST["reppassword"]) == "") {
  41.                             echo("All fields are required");
  42.                         }
  43.                         else if (($_POST["password"]) != ($_POST["reppassword"])) {
  44.                             echo("Passwords do not match");
  45.                         }
  46.                     }
  47.                     ?>
  48.  
  49.                     <br><br>
  50.                     <input type="submit" name="register" value="Submit"/><br><br>
  51.                 </form>
  52.                 <form method="post" >
  53.  
  54.                     Login<br><br>
  55.  
  56.                     Username: <input type="text" id="logusername" name="logusername" value="<?php
  57.                         if(isset($_POST["logusername"])){
  58.                             echo $_POST["logusername"];
  59.                         }
  60.                     ?>" required/><br><br>
  61.  
  62.                     Password: <input type="password" id="logpassword" name="logpassword" required/><br><br>
  63.                     <?php
  64.                         if(isset($_POST["logusername"])) {
  65.                                 $logusername = $_POST["logusername"];
  66.                                 $logpassword = $_POST["logpassword"];
  67.                                 $querry = $connection->prepare("
  68.                                    SELECT * FROM users WHERE username=:logusername AND password=md5(:logpassword);
  69.                                 ");
  70.  
  71.                                 $querry->execute(array('logusername' => $logusername, 'logpassword' => $logpassword));
  72.  
  73.                                 $exists=$querry->fetch(PDO::FETCH_OBJ);
  74.                                 if(!$exists){
  75.                                     echo "Username or password do not match";
  76.                             }
  77.                         }
  78.                     ?><br><br>
  79.                     <input type="submit" name="login" value="Submit"/><br><br>
  80.  
  81.                 </form>
  82.             </div>
  83.             <div>
  84.                 <a href="Home.php">
  85.                     <input type="button" name="back" value="Back"/>
  86.                 </a>
  87.             </div>
  88.                 </center>
  89.         </body>
  90. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement