Advertisement
Guest User

Untitled

a guest
May 12th, 2018
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.80 KB | None | 0 0
  1. <!------------------------------------------------------PHP------------------------------------------------------->
  2.  
  3. <?php include 'connectDB.php';
  4. $username='';
  5. $password='';
  6.  
  7. if (isset($_POST['submit'])) {
  8.     $username = $_POST['username'];
  9.     $password = $_POST['password'];
  10.  
  11. $result=mysqli_query($con,"SELECT * from lab5_user WHERE username='$username' AND password='$password'");
  12.  
  13.         if(mysqli_num_rows($result)>0)
  14.         {  
  15.             echo '<script>';
  16.             echo 'alert("Login Successful");';
  17.             echo 'window.location.href = "mainPage.php";';            
  18.             echo '</script>';
  19.         }
  20.         else
  21.         {
  22.             echo '<script>';
  23.             echo 'alert("Login Failed");';
  24.             echo '</script>';
  25.         }
  26. }
  27. ?>
  28.  
  29. <!------------------------------------------------------CS------------------------------------------------------->
  30.  
  31. <style>
  32.     body{
  33.     background-image: url(images/cover2.jpg) ;
  34.     background-size: 100%;
  35.     background-repeat: no-repeat;
  36.     background-position: center;
  37. }
  38.  
  39. .containerlogin{
  40.     text-align: center;
  41.     margin:0px;
  42.     padding-top:100px;
  43. }  
  44.  
  45. input[type=text],input[type=password],button[type=submit],select {
  46.     width: 20%%;
  47.     padding: 12px 20px;
  48.     margin: 8px 0;
  49.     display: inline-block;
  50.     border: 2px solid #000000;
  51.     border-radius: 14px;
  52.     box-sizing: border-box;
  53.     text-align: center
  54. }
  55.  
  56. h3{
  57.     font-family: Arial, Helvetica, sans-serif;
  58.     font-size: 80px;    
  59.     color: #f2f2f2;
  60.     margin:20px;
  61.  
  62. }
  63.  
  64. .btnsubmit:hover {
  65.     background-color: #ffffff; /* Green */
  66.     color: black;
  67. }
  68.  
  69. p{
  70.      font-size:20px;
  71.     font-weight: bold;
  72.     color:white;
  73. }
  74.  
  75. a{
  76.     color: white;
  77.     font-size:23px;
  78.     font-weight: bold;
  79.  
  80. }
  81. a:hover{
  82.     color: black;    
  83. }
  84. </style>
  85.  
  86. <!------------------------------------------------------JAVASCRIPT------------------------------------------------------->
  87. <script>
  88. function setData(){
  89.     var username= document.getElementById("username").value;
  90.     document.cookie="username="+username;
  91. }
  92.    
  93. </script>
  94.  
  95.  
  96. <!------------------------------------------------------HTML------------------------------------------------------->
  97.  
  98. <body>
  99.     <div class="containerlogin">
  100.         <h3>Login Panel</h3>
  101.         <form method="post">
  102.                 <input type=text id="username" name="username" placeholder="Username" required>
  103.                 <br>
  104.                 <input type=password id="password" name="password" placeholder="Password" required>
  105.                 <br>
  106.                 <button class=btnsubmit type="submit" name="submit" id=submit onclick="setData()">Submit</button>
  107.                 <br>
  108.                 <p>Dont have an account?</p><a href="registerPage.php">Create Now</a>
  109.         </form>
  110.     </div>
  111. </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement