Guest User

Untitled

a guest
Jun 25th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. function login()
  2. {
  3.  
  4. if(isset($_POST['login']))
  5. {
  6. $user = $_POST['username'];
  7. $pass = sha1(strtoupper($_POST['username'].':'.$_POST['password']));
  8.  
  9. $q = $this->db->select('*','account',"username = '$user' AND sha_pass_hash = '$pass'");
  10. if(mysql_num_rows($q) > 0)
  11. {
  12. $row = mysql_fetch_assoc($q);
  13. foreach($row as $c => $v)
  14. {
  15. $_SESSION[$c] = $v;
  16. }
  17.  
  18.  
  19. //Encrypt the posted code field and then compare with the stored key
  20.  
  21. $captchaaccept = $_SESSION['keya'];
  22.  
  23. if(md5($_POST['captcha']) != $captchaaccept)
  24. {
  25. $this->mmsg('error','Invalid Captcha');
  26.  
  27. }
  28.  
  29. $gm = $this->db->select('*','account_access',"id = '$_SESSION[id]'");
  30. $row = mysql_fetch_assoc($gm);
  31.  
  32. if($row['gmlevel'] >= 4)
  33. {
  34. $_SESSION['gm'] = 1;
  35. }
  36.  
  37. }
  38. else
  39. {
  40. return $this->mmsg('error','Invalid Login');
  41. }
  42.  
  43. header("Location: ./?account");
  44.  
  45. exit;
  46.  
  47. }
  48.  
  49. }
Add Comment
Please, Sign In to add comment