Advertisement
Guest User

iaindenhouting

a guest
Feb 5th, 2016
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.65 KB | None | 0 0
  1.  
  2. <html>
  3.     <head>
  4.         <link href="css/stylesheetlogin.css" type="text/css" rel="stylesheet"/>
  5.     </head>
  6.         <body background="img/Orange-and-blue-twill-background_1920x1080.jpg" style="background-repeat: 0px">
  7.             <form name="Registration"  onsubmit="return validateForm();" method="post">
  8.                 <div class="registrationDiv">
  9.                         <p>Login</p>
  10.                         <div id="Username"><input type="Username" name="userNameLogin" placeholder="Username" /><br/></div>
  11.                         <div id="Passwords"><input type="Password" name="passwordLogin" placeholder="Password"/></div>
  12.                         <div id="login"><input id="insert" onclick="return IsEmpty();" type="submit" name="Login" value="Login" style="margin-left: 35%;"/></div>
  13.             </form>
  14.                         <div class="error">
  15.                 <?php
  16.                 session_start();
  17.                 $servername = "localhost";
  18.                 $username = "root";
  19.                 $password = "";
  20.                 $dbname = "registration";
  21.                 $conn = new mysqli($servername, $username, $password, $dbname);
  22.                 //check connection
  23.                 if ($conn ->connect_error)
  24.                     {
  25.                         die("connection failed:" . $conn->connect_error);
  26.                     }
  27.                
  28.                 if(isset($_POST['Login']))
  29.                 {
  30.                     $Username = $_POST['userNameLogin'];
  31.                     $Password = $_POST['passwordLogin'];
  32.                    
  33.                     $sql = "SELECT * FROM registrationlist WHERE '$Username' = Name AND '$Password' = Password";
  34.                     $result = $conn->query($sql);
  35.                    
  36.                     if ($result->num_rows > 0)
  37.                     {
  38.                         $_SESSION['loggedIn'] = true;
  39.                         header("location: LoggedIn.php");  
  40.                     }
  41.                     else
  42.                     {
  43.                         echo "Username does not exist or password does not match";
  44.                     }
  45.    
  46.                 $conn->close();
  47.                 }
  48.                 ?>
  49.                 </div>     
  50.             </div>
  51.     </body>
  52. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement