Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(!connectToDb())die(mysqlErrorEx());
- require_once(THEME_PATH.'/index.php');
- if(!empty($_GET[QUERY_VAR_MODULE]))
- {
- if(strcmp($_GET[QUERY_VAR_MODULE], 'login') === 0)
- {
- unlockSessionAndDestroyAllCokies();
- if(isset($_POST['user']) && isset($_POST['pass']))
- {
- $user = $_POST['user'];
- $pass = md5($_POST['pass']);
- 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)
- {
- if(isset($_POST['remember']) && $_POST['remember'] == 1)
- {
- setcookie(COOKIE_USER, md5($user), COOKIE_LIVETIME, CP_HTTP_ROOT);
- setcookie(COOKIE_PASS, $pass, COOKIE_LIVETIME, CP_HTTP_ROOT);
- }
- lockSession();
- $_SESSION['name'] = $user;
- $_SESSION['pass'] = $pass;
- //unlockSession();
- header('Location: '.QUERY_STRING_BLANK.'home');
- }
- else
- {
- sleep(5);
- showLoginForm(true);
- }
- die();
- }
- showLoginForm(false);
- die();
- }
- if(strcmp($_GET['m'], 'logout') === 0)
- {
- unlockSessionAndDestroyAllCokies();
- header('Location: '.QUERY_STRING_BLANK.'login');
- die();
- }
- }
Add Comment
Please, Sign In to add comment