function login($data) { //global $tpl; $objResponse = new xajaxResponse(); include 'settings/tables.php'; /* Crypt Password with MD5 Method */ $pw_crypted = MD5(mysql_real_escape_string($data['password'])); //encrypt password with MD5 $email = mysql_real_escape_string($data['email']); /******************************************/ /* Create Object :: EXIST */ $logon = new CheckExist(); /******************************************/ /* Check :: EXIST */ $logon->tableE = $tbl_users; $logon->conditionE = " UserEmail = '" . $email . "' && UserPass = '******' && activation_code = '' "; $CheckData = $logon->exist(); /******************************************/ /* Change Status :: Login successful or failed */ if ($CheckData == 1) { $logon->email = $email; $logon->pw = $pw_crypted; $logon->tbl_users = $tbl_users; //setcookie if (isset($data['autologon'])) { $logon->cookie_duration = 1; } else { $logon->cookie_duration = 0; } $logon->cookieset('ly'); $objResponse->Script("document.getElementById('submit_login').onclick()"); $objResponse->redirect(ROOT_DIR); //return true; } else { $logon->email = ''; $logon->pw = ''; //$logon->cookieset('l'); $objResponse->assign("p_logon_failure", "style.display", 'block'); $objResponse->assign("p_logon_failure", "innerHTML", "Login information could not be verified.<br> Please try it again."); //TODO move string to language file //$tpl->display("logon/login.tpl"); //return false; } unset($logon); /******************************************/ return $objResponse; }
<?php /* Create Object :: EXIST */ $hits = new CheckExist(); /******************************************/ /* Logout :: Delete Cookie */ $hits->user = ''; $hits->pw = ''; $hits->cookieset(); $tpl->display("logon/login.tpl"); header("Location:" . ROOT_DIR . "admin/"); unset($hits); /******************************************/
<?php /* Create Object :: EXIST */ $logon = new CheckExist(); /******************************************/ /* Logout :: Delete Cookie */ $logon->email = ''; $logon->pw = ''; $logon->cookieset('l'); //$tpl->display("logon/login.tpl"); //$memcache->delete('user_data_'.$user_data['ID']); unset($logon); session_destroy(); header("Location:" . ROOT_DIR); /******************************************/
<?php /* LOGOUT User */ //TODO implement; check if exists in memcache and then delete if (mod_memcache == 1) { $memcache->delete('user_data_' . $l["token"]); } else { unset($_SESSION['$mem_key1']); } /* Create Object :: EXIST */ $logon = new CheckExist(); /******************************************/ /* Logout :: Delete Cookie */ $logon->email = ''; $logon->pw = ''; $logon->cookieset('ly'); //$tpl->display("logon/login.tpl"); unset($user_data); unset($logon); session_destroy(); header("Location:" . ROOT_DIR); /******************************************/