Guest User

Untitled

a guest
May 19th, 2018
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. <?php
  2.  
  3. function login($username,$password){
  4.  
  5. $password = md5(sha1($password));
  6. $query = "SELECT * FROM users WHERE username = '{$username}' AND password = '{$password}'";
  7. $res = mysql_query($query) or die ("SQL error:".mysql_error());
  8. $rows = mysql_num_rows($res);
  9. $ris = mysql_fetch_array($res);
  10. $level = $ris['level'];
  11.  
  12. if($rows != 1)
  13. {
  14. print "Wrong username or password\n";
  15. }
  16.  
  17. else
  18. {
  19. if($level != 'admin')
  20. {
  21. print "Login lates with success";
  22. setcookie('biscotto',$password,time()+2000,'/');
  23. }
  24. else
  25. {
  26. print "Login lates with success,hi admin";
  27. setcookie('biscotto',$password,time()+2000,'/');
  28. }
  29. }
  30. }
  31.  
  32. ?>
Add Comment
Please, Sign In to add comment