Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // login_agent.php
- <?php
- include_once '../../include/config.php';
- include_once ROOT_PATH .'/include/startup.php';
- $iErrorLogin = 0;
- if ( isset($_POST['username']) ) {
- $strUsername = trim($_POST['username']);
- $strPassword = trim($_POST['password']);
- include_once ROOT_PATH ."/class/clsAgent.php";
- $clsAgent = new clsAgent();
- $infoAgentUser = $clsAgent->getDataByUsername($strUsername);
- if ( isset($infoAgentUser['id']) && $infoAgentUser['id'] > 0 ) {
- if ( $infoAgentUser['password'] == md5($strPassword) ) {
- if ($infoAgentUser['status'] > 0) {
- include_once ROOT_PATH ."/class/clsAgentMenu.php";
- $clsAgentMenu = new clsAgentMenu();
- $infoAgentUser['MENU'] = $clsAgentMenu->getLst();
- $_SESSION['agent_info'] = $infoAgentUser;
- header('Location: '. ROOT_URL.'/agent/info');
- } else {
- $iErrorLogin = 3;
- }
- } else {
- $iErrorLogin = 2;
- }
- } else {
- $iErrorLogin = 1;
- }
- }
- $objSmarty->assign('iErrorLogin', $iErrorLogin);
- $objSmarty->display('admin_agent/login.tpl');
- ?>
- class clsAgent {
- function getDataByUsername($strUsername){
- if($strUsername != ''){
- $arrResult = array();
- $sql = "select * from " . $this->_tableName . " where lower(username) = lower('" . $strUsername. "')";
- $clsDB = new clsDB();
- $arrResult = $clsDB->fetchRowSQL($sql);
- return $arrResult;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement