Advertisement
Guest User

Untitled

a guest
May 5th, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. <?php
  2. error_reporting(E_ALL);
  3. mysql_connect("localhost", "root", "");
  4. mysql_select_db("blog1");
  5. ?>
  6. <html>
  7. <head>
  8. <link rel="stylesheet" type="text/css" href="style/stylesheet.css"/>
  9. <title>Admin Login</title>
  10. </head>
  11. <body
  12.  
  13. <div class="login">
  14. <?php
  15. if(isset($_POST['submit'])){
  16. $name = $_POST['name'];
  17. $pass = $_POST['pass'];
  18.  
  19. $result = mysql_query("SELECT * FROM users WHERE name='".$name."' AND password='".$pass."'");
  20. $num = mysql_num_rows($result);
  21. echo $num;
  22. }else{
  23. ?>
  24. <p>Welcome to the Admin area</p>
  25. <p>please log in!</p>
  26. <form action='login.php' method='post'>
  27. Username: <input type='text' name='name' /><br />
  28. Password: <input type='password' name='password' /><br />
  29. <input type='submit' name='submit' value='login!' />
  30. </form>
  31. </div>
  32. <?php
  33. }
  34. ?>
  35. </body>
  36. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement