Guest User

df

a guest
May 5th, 2016
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. if(!connectToDb())die(mysqlErrorEx());
  2.  
  3. require_once(THEME_PATH.'/index.php');
  4.  
  5. if(!empty($_GET[QUERY_VAR_MODULE]))
  6. {
  7. if(strcmp($_GET[QUERY_VAR_MODULE], 'login') === 0)
  8. {
  9. unlockSessionAndDestroyAllCokies();
  10.  
  11. if(isset($_POST['user']) && isset($_POST['pass']))
  12. {
  13. $user = $_POST['user'];
  14. $pass = md5($_POST['pass']);
  15.  
  16. if(mysqlQueryEx('cp_users', "SELECT `id` FROM `cp_users` WHERE `name`='".addslashes($user)."' AND `pass`='".addslashes($pass)."' AND `flag_enabled`=1 LIMIT 1") && @mysql_affected_rows() == 1)
  17. {
  18. if(isset($_POST['remember']) && $_POST['remember'] == 1)
  19. {
  20. setcookie(COOKIE_USER, md5($user), COOKIE_LIVETIME, CP_HTTP_ROOT);
  21. setcookie(COOKIE_PASS, $pass, COOKIE_LIVETIME, CP_HTTP_ROOT);
  22. }
  23.  
  24. lockSession();
  25. $_SESSION['name'] = $user;
  26. $_SESSION['pass'] = $pass;
  27. //unlockSession();
  28.  
  29. header('Location: '.QUERY_STRING_BLANK.'home');
  30. }
  31. else
  32. {
  33. sleep(5);
  34. showLoginForm(true);
  35. }
  36. die();
  37. }
  38.  
  39. showLoginForm(false);
  40. die();
  41. }
  42.  
  43. if(strcmp($_GET['m'], 'logout') === 0)
  44. {
  45. unlockSessionAndDestroyAllCokies();
  46. header('Location: '.QUERY_STRING_BLANK.'login');
  47. die();
  48. }
  49. }
Add Comment
Please, Sign In to add comment