/** * * @param type $uid * @param type $username * @param \uLogin $ulogin */ function appLogin($uid, $username, $ulogin){ $_SESSION['admin']['adminid'] = $uid; $_SESSION['admin']['username'] = $username; $_SESSION['admin']['is_logged'] = true; $db = new \DBConnection(); $adminModel = new \App\Model\Admin($db); $admin = $adminModel->getAdmin($uid); $_SESSION['admin']['refnum'] = $admin['ref']; $_SESSION['admin']['name'] = $admin['name']; $_SESSION['admin']['email'] = $admin['email']; $_SESSION['admin']['type'] = $admin['type']; addLog('Back-end', 'Login', ''.$admin['name'].' ('.$admin['ref'].')',''.$admin['name'].' ('.$admin['ref'].')','Successfully logged in'); if (isset($_SESSION['appRememberMeRequested']) && ($_SESSION['appRememberMeRequested'] === true)) { // Enable remember-me if ( !$ulogin->SetAutologin($username, true)) { echo "cannot enable autologin<br>"; } unset($_SESSION['appRememberMeRequested']); } else { // Disable remember-me if ( !$ulogin->SetAutologin($username, false)) { echo 'cannot disable autologin<br>'; } } page_header_simple(); echo '<img src="../images/lploader.gif" border="0"><br /><b>System is loading, please wait...</b>'; page_footer(); exit(); }
<?php require_once 'template.php'; //unset($_SESSION['admin']); if ($_SESSION['user'] || $_SESSION['admin']) { header('Location: index.php'); exit; } page_header_simple(); $SendPassword = 0; $message = ''; if ($_POST['_pwdreset1'] == 1) { $db = new DBConnection(); $query = 'SELECT * FROM users WHERE user_email="' . $db->string_escape($_POST['rform_email']) . '" LIMIT 1'; $res = $db->rq($query); $row = $db->fetch($res); if (!$row['user_secret_answer']) { $message = getLang('reset_noansw'); } else { if (strtolower(trim($_POST['rform_answer'])) == strtolower(trim($row['user_secret_answer']))) { $SendPassword = 1; } else { $message = getLang('reset_wrong'); } } } if ($SendPassword == 1) { $pattern = '/^[\\_]*([a-z0-9]+(\\.|\\_*)?)+@([a-z][a-z0-9\\-]+(\\.|\\-*\\.))+[a-z]{2,6}$/i'; $check = preg_match($pattern, $_POST['rform_email']); if ($check == 0) { $message = getLang('reset_invalid_email');
$query = 'SELECT * FROM users WHERE user_account_num="' . ($_GET['uid'] + 0) . '" AND user_status=1 LIMIT 1'; $res = $db->rq($query); $row = $db->fetch($res); //validate presense of user if ($row['users_id'] <= 0) { echo 'User not found!'; exit; } $_SESSION['user']['is_logged'] = 1; $_SESSION['user']['user_account_num'] = $row['user_account_num']; $_SESSION['user']['user_username'] = $row['user_username']; $_SESSION['user']['user_fullref'] = $row['user_fullref']; $_SESSION['user']['user_firstname'] = $row['user_firstname']; $_SESSION['user']['user_middlename'] = $row['user_middlename']; $_SESSION['user']['user_lastname'] = $row['user_lastname']; $_SESSION['user']['user_account_name'] = $row['user_account_name']; $_SESSION['user']['user_email'] = $row['user_email']; if ($row['user_passisset'] == 0) { $_SESSION['user']['user_passisset'] = 0; $_SESSION['user']['user_password'] = $row['user_password']; } else { $_SESSION['user']['user_passisset'] = 1; } $_SESSION['user']['user_lastlogin'] = $row['user_lastlogin']; $_SESSION['user']['user_lastloginip'] = $row['user_lastloginip']; $_SESSION['user']['dosuuser'] = true; header('Location: index.php'); exit; page_header_simple(1); echo '<img src="images/lploader.gif" border="0"><br /><b>Loading user details, please wait...</b>'; page_footer(1);