Guest User

Untitled

a guest
Apr 9th, 2018
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.17 KB | None | 0 0
  1. <?php
  2. session_start();
  3. include_once ('config.php');
  4.  
  5. ob_start();
  6.  
  7. if(isset($_POST['submit']) && !empty($_POST['username']) && !empty($_POST['password'])) {
  8.  
  9. $username = $_POST['username'];
  10. $password = $_POST['password'];
  11. $username = mysql_real_escape_string($username);
  12. $password = md5($password);
  13. $sql = mysql_query("SELECT * FROM users WHERE username = '$username' AND password = '$password'");
  14. $nr = mysql_num_rows($sql);
  15. if($nr == 0) {
  16. echo '<div class="errormsg">Username or Password is incorrect</div>';
  17. }else{
  18. while($row = mysql_fetch_array($sql)) {
  19. $_SESSION['lia'] = $row['username'];
  20. }
  21. header ('Location: me.php');
  22. }
  23. }
  24. ob_flush();
  25. ?>
  26. <html>
  27. <head>
  28. <link href='/login.css' rel='stylesheet' type='text/css'>
  29. <title>Welcome ZeloCMS</title>
  30. </head>
  31. <body>
  32. <div class="loginBox">
  33. <div class="mid">
  34. <center><a href='register.html'><div class=register_box>Register Today!</div></a></center>
  35. <center><form action='index.php' method='POST'>
  36. <b>Username: <input type='text' name='username'><br />
  37. <b>Password: <input type='password' name='password'><br />
  38. <input type='submit' name='submit' value='Sign In' " />
  39. </form></center></div></div>
  40. </body>
  41. </html>
Add Comment
Please, Sign In to add comment