function index() { session_start(); // $login = file_get_contents('http://localhost/laravel-login/app/models/check_login.php'); // $login = json_decode($login, true); $login = check_login(); $gco = check_gco(); $hvol = check_hvol(); if ($login['check_session'] != "" || $gco['check_gco'] != "" || isset($hvol["check_login"])) { // $username = $login['check_user']; $username = "******"; // $password = base64_encode($login['check_pass']); $password = base64_encode("huyhoangk57"); $result = $this->login_model->login($username, $password); if (!empty($result)) { $_SESSION["name"] = $result->name; $_SESSION["user_name"] = $result->username; $_SESSION["category"] = $result->level; $_SESSION["id"] = $result->userid; $_SESSION["logged_in"] = TRUE; $logged_in = TRUE; } } else { $this->load->view('login/login_signup'); } if ($logged_in) { redirect('/appointment/index', 'refresh'); } }
public function index() { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- phpVersionTestDL(); // catch php version error immediately // $login = file_get_contents('http://localhost/laravel-login/app/models/check_login.php'); // $login = json_decode($login, true); $login = check_login(); $gco = check_gco(); $chikitsa = check_chikitsa(); if (isset($login['check_session']) || isset($gco['check_gco']) || isset($chikitsa['check_chikitsa'])) { // $u = $this->input->post('username'); $u = "root"; // $pw = $this->input->post('password'); $pw = "root"; $this->load->model('admin/muser_accts', 'clsUserAccts'); $this->load->model('admin/muser_log', 'clsUserLog'); $this->load->model('admin/mpermissions', 'perms'); $this->load->helper('dl_util/util_db'); setNameSpace(false); // also loads database $this->clsUserLog->el_lUserID = $lUserID = $this->clsUserAccts->verifyUser($u, $pw, $bSuperUser, $bAdmin, $lVolID, $bVolMgr, $bVolAcct); $bSuccess = $lUserID > 0; $this->clsUserLog->lAddLogEntry($bSuccess, $u); if ($lUserID > 0) { if (!$this->clsUserAccts->bVerifyDBVersion($strExpected, $strActual)) { if ($bSuperUser) { $_SESSION[CS_NAMESPACE . 'user'] = new stdClass(); $_SESSION[CS_NAMESPACE . 'user']->lUserID = $lUserID; $_SESSION[CS_NAMESPACE . 'user']->bSuperUser = true; $this->session->set_flashdata('error', 'Your database is not the correct level for this version of the Hospice Volunteer Solutions!<br><br> expected db level: <b>' . $strExpected . '</b><br> actual db level: <b>' . $strActual . '</b><br><br> Please upgrade your database before continuing.'); redirect('upgrade_db'); } else { $this->session->set_flashdata('error', 'Your database is not the correct level for this version of Hospice Volunteer Solutions!<br><br> expected db level: <b>' . $strExpected . '</b><br> actual db level: <b>' . $strActual . '</b><br><br> Please contact your system administrator.'); redirect('login'); } } $this->clsUserAccts->loadSingleUserRecord($lUserID); $clsUser = $this->clsUserAccts->userRec[0]; $lChapterID = $clsUser->us_lChapterID; $this->setChapterSession($lChapterID, $lACOID); // initialize custom navigation $_SESSION[CS_NAMESPACE . 'nav'] = new stdClass(); $_SESSION[CS_NAMESPACE . 'nav']->lCnt = 0; $_SESSION[CS_NAMESPACE . 'nav']->navFiles = array(); $this->setBrowserInfo(); $_SESSION[CS_NAMESPACE . 'user'] = new stdClass(); $_SESSION[CS_NAMESPACE . 'user']->lUserID = $lUserID; $_SESSION[CS_NAMESPACE . 'user']->lVolID = $lVolID; $_SESSION[CS_NAMESPACE . 'user']->strUserName = $clsUser->us_strUserName; $_SESSION[CS_NAMESPACE . 'user']->bSuperUser = $bSuperUser = $clsUser->us_bSuperUser; $_SESSION[CS_NAMESPACE . 'user']->bAdmin = $bAdmin = $clsUser->us_bAdmin; $_SESSION[CS_NAMESPACE . 'user']->bVolLogin = $bVolLogin = $clsUser->bVolAccount; $_SESSION[CS_NAMESPACE . 'user']->bStandardUser = $bStandardUser = $clsUser->bStandardUser; $_SESSION[CS_NAMESPACE . 'user']->bVolMgr = $bVolMgr = $bStandardUser && $clsUser->bUserVolManager; $_SESSION[CS_NAMESPACE . 'user']->bDebugger = $clsUser->us_bDebugger; $_SESSION[CS_NAMESPACE . 'user']->strFirstName = $clsUser->us_strFirstName; $_SESSION[CS_NAMESPACE . 'user']->strLastName = $clsUser->us_strLastName; $_SESSION[CS_NAMESPACE . 'user']->strSafeName = $clsUser->strSafeName; $_SESSION[CS_NAMESPACE . 'user']->enumDateFormat = 'm/d/Y'; // $clsUser->us_enumDateFormat; $_SESSION[CS_NAMESPACE . 'user']->enumMeasurePref = $clsUser->us_enumMeasurePref; $_SESSION[CS_NAMESPACE . 'user']->lRecsPerPage = 50; $_SESSION["check_loginhvol"] = 1; redirect('welcome'); } else { $this->session->set_flashdata('error', 'Your login information was not correct.'); redirect('login'); } } elseif ($this->input->post('username')) { $u = $this->input->post('username'); $pw = $this->input->post('password'); $this->load->model('admin/muser_accts', 'clsUserAccts'); $this->load->model('admin/muser_log', 'clsUserLog'); $this->load->model('admin/mpermissions', 'perms'); $this->load->helper('dl_util/util_db'); setNameSpace(false); // also loads database $this->clsUserLog->el_lUserID = $lUserID = $this->clsUserAccts->verifyUser($u, $pw, $bSuperUser, $bAdmin, $lVolID, $bVolMgr, $bVolAcct); $bSuccess = $lUserID > 0; $this->clsUserLog->lAddLogEntry($bSuccess, $u); if ($lUserID > 0) { if (!$this->clsUserAccts->bVerifyDBVersion($strExpected, $strActual)) { if ($bSuperUser) { $_SESSION[CS_NAMESPACE . 'user'] = new stdClass(); $_SESSION[CS_NAMESPACE . 'user']->lUserID = $lUserID; $_SESSION[CS_NAMESPACE . 'user']->bSuperUser = true; $this->session->set_flashdata('error', 'Your database is not the correct level for this version of the Hospice Volunteer Solutions!<br><br> expected db level: <b>' . $strExpected . '</b><br> actual db level: <b>' . $strActual . '</b><br><br> Please upgrade your database before continuing.'); redirect('upgrade_db'); } else { $this->session->set_flashdata('error', 'Your database is not the correct level for this version of Hospice Volunteer Solutions!<br><br> expected db level: <b>' . $strExpected . '</b><br> actual db level: <b>' . $strActual . '</b><br><br> Please contact your system administrator.'); redirect('login'); } } $this->clsUserAccts->loadSingleUserRecord($lUserID); $clsUser = $this->clsUserAccts->userRec[0]; $lChapterID = $clsUser->us_lChapterID; $this->setChapterSession($lChapterID, $lACOID); // initialize custom navigation $_SESSION[CS_NAMESPACE . 'nav'] = new stdClass(); $_SESSION[CS_NAMESPACE . 'nav']->lCnt = 0; $_SESSION[CS_NAMESPACE . 'nav']->navFiles = array(); $this->setBrowserInfo(); $_SESSION[CS_NAMESPACE . 'user'] = new stdClass(); $_SESSION[CS_NAMESPACE . 'user']->lUserID = $lUserID; $_SESSION[CS_NAMESPACE . 'user']->lVolID = $lVolID; $_SESSION[CS_NAMESPACE . 'user']->strUserName = $clsUser->us_strUserName; $_SESSION[CS_NAMESPACE . 'user']->bSuperUser = $bSuperUser = $clsUser->us_bSuperUser; $_SESSION[CS_NAMESPACE . 'user']->bAdmin = $bAdmin = $clsUser->us_bAdmin; $_SESSION[CS_NAMESPACE . 'user']->bVolLogin = $bVolLogin = $clsUser->bVolAccount; $_SESSION[CS_NAMESPACE . 'user']->bStandardUser = $bStandardUser = $clsUser->bStandardUser; $_SESSION[CS_NAMESPACE . 'user']->bVolMgr = $bVolMgr = $bStandardUser && $clsUser->bUserVolManager; $_SESSION[CS_NAMESPACE . 'user']->bDebugger = $clsUser->us_bDebugger; $_SESSION[CS_NAMESPACE . 'user']->strFirstName = $clsUser->us_strFirstName; $_SESSION[CS_NAMESPACE . 'user']->strLastName = $clsUser->us_strLastName; $_SESSION[CS_NAMESPACE . 'user']->strSafeName = $clsUser->strSafeName; $_SESSION[CS_NAMESPACE . 'user']->enumDateFormat = 'm/d/Y'; // $clsUser->us_enumDateFormat; $_SESSION[CS_NAMESPACE . 'user']->enumMeasurePref = $clsUser->us_enumMeasurePref; $_SESSION[CS_NAMESPACE . 'user']->lRecsPerPage = 50; $_SESSION["check_loginhvol"] = 1; redirect('welcome'); } else { $this->session->set_flashdata('error', 'Your login information was not correct.'); redirect('login'); } } $data['main'] = 'login'; $this->load->view('login', $data); }