Advertisement
Guest User

Untitled

a guest
Aug 2nd, 2017
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.67 KB | None | 0 0
  1. <?php
  2. if(!isset($_POST['submit'])) {
  3. echo "
  4. <form method='post'>
  5. <input type='text' maxlength='12' name='username'/><br>
  6. <input type='password' maxlength='30' name='password'/><br>
  7. <input type='submit' value='Login' name='submit'>
  8. </form>
  9. ";
  10. } else {
  11. include ('connect.php');
  12. $username = $_POST['username'];
  13. $password = md5("sys64738".$_POST['password']);
  14. $sql = "SELECT * FROM users WHERE username='$username' and password='$password'";
  15. $result = mysql_query($sql);
  16. $count = mysql_num_rows($result);
  17.  
  18. if($count = 1) {
  19.  
  20. echo "You have sucessfully logged in.";
  21. setcookie('login',$username,time()+86000);
  22.  
  23. } else {
  24.  
  25. die("invalid username or password");
  26.  
  27. }
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement