Guest User

Index admin

a guest
Sep 15th, 2017
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1.  
  2. <!DOCTYPE html>
  3. <html>
  4. <head>
  5. <meta charset="utf-8">
  6. <title>Login</title>
  7. <link rel="stylesheet" type="text/css" href="css/stylelogin.css" media="screen" />
  8. </head>
  9. <body>
  10. <div class="container">
  11. <section id="content">
  12. <form action="index.php" method="post">
  13. <h1>Admin Login</h1>
  14. <div>
  15. <input type="text" placeholder="Username" required="" name="username"/>
  16. </div>
  17. <div>
  18. <input type="password" placeholder="Password" required="" name="password"/>
  19. </div>
  20. <div>
  21. <input type="submit" value="Log in" name="submit" />
  22. </div>
  23. </form><!-- form -->
  24.  
  25. </section><!-- content -->
  26. </div><!-- container -->
  27. </body>
  28. </html>
  29. <?php
  30.  
  31. session_start();
  32.  
  33. include('../connections/connections.php');
  34.  
  35. if (isset($_POST['submit'])) {
  36. # code...
  37.  
  38.  
  39. $name=$_POST['username'];
  40.  
  41. $password=$_POST['password'];
  42.  
  43.  
  44. $error="";
  45.  
  46.  
  47. if(empty($name)||empty($password)){
  48.  
  49. $error="Enter Complete details";
  50. }
  51.  
  52.  
  53. $sql="SELECT * FROM admin where username='$name' and password='$password'";
  54.  
  55. $result=mysqli_query($connect,$sql);
  56. if(mysqli_num_rows($result)>0) {
  57.  
  58. header("location: main.php");
  59. }
  60.  
  61. else {
  62. echo"Email or password is not correct";
  63. }
  64. }
  65. ?>
Add Comment
Please, Sign In to add comment