Viewing file: login.php (3.29 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
/*
* login นี้ ใช้สำหรับทะเบียนศิษย์เก่า
* cut session acY
* cut session tmId
* cut session tmCode
*/
class Login extends CI_Controller{
public $body;
function index() {
$data = ' ';
$this->body = $this->load->view('info/v_info',' ',true);
$this->show();
}
function user_login(){
$un = $this->input->post('txtUsername');
$pwd = $this->input->post('txtPassword');
$nowDate = getNowDate();//$this->input->post('nowDate');
$stid = $this->input->post('stid');
$gpid = $this->input->post('gpid');
$this->load->model('ums/m_umuser','obj');
$rs = $this->obj->check_user($un, $pwd);
if($rs) {
//$this->load->model($this->config->item("rg_folder").'mo_rg_termconfig','tmc');
//$nowDateCv = splitDateForm2($this->input->post('firstDate'));
$data = array( 'UsID' => $rs['UsID'],
'UsName' => $rs['UsName'],
'UsLogin' => $rs['UsLogin'],
'UsPassword' => $pwd,
'UsPsCode' => $rs['UsPsCode'],
'UsWgID' => $rs['UsWgID'],
'logged_in' => TRUE,
'login_date' => $nowDate,
'session_id' => session_regenerate_id()
);
$this->session->set_userdata($data);
//$record = $this->tmc->getBetweenDateByNowDateJoinTm($nowDateCv);
// if($record->num_rows() > 0){
// $rc = $record->row();
//
// //$this->config->set_item('ACADYEAR', $rc->tmcAcY);
// //$this->config->set_item('SEMESTER', $rc->tmCode);
// $data2 = array( 'acY' => $rc->tmcAcY,
// 'tmId' => $rc->tmcTmId,
// 'tmCode' => $rc->tmCode
// );
// }
// else
// {
// /*$this->session->set_flashdata('error_date_input', '<div id="message" align="center"><font color="red">วันที่ผิดพลาด <br>ไม่พบวันที่ในปฏิทินการศึกษา</font></div>');
// //redirect('info/info');
// redirect('login');*/
//
// $data2 = array('acY' => '',
// 'tmId' => '',
// 'tmCode' => '');
// }
$data2 = array('acY' => '',
'tmId' => '',
'tmCode' => '');
$this->session->set_userdata($data2);
$today = date('Y-m-d');
// $record2 = $this->tmc->getBetweenDateByNowDateJoinTm($today);
// if($record2->num_rows() > 0){
// $rc = $record2->row();
// $data3 = array( 'acY_R' => $rc->tmcAcY,
// 'tmId_R' => $rc->tmcTmId,
// 'tmCode_R' => $rc->tmCode
// );
// } else {
$data3 = array( 'acY_R' => '',
'tmId_R' => '',
'tmCode_R' => '');
//}
$this->session->set_userdata($data3);
if ($stid && $gpid) {
redirect('info/info/mainMenu/'.$stid.'/'.$gpid);
} else {
redirect('info/info/showSystem');
}
}
else
{
$this->session->set_flashdata('message', '<div id="message" align="center"><font color="red">ชื่อเข้าใช้งานหรือรหัสผ่าน<br>ผิดพลาด</font></div>');
redirect('login');
}
}
function show()
{
$mn['menu'] = $this->load->view('info/v_prelogin','',true);
$lv['body'] = $this->body;
$lv['head'] = $this->load->view('info/v_header',$mn,true);
$lv['footer'] = $this->load->view('info/v_footer','',true);
$this->load->view('info/v_in',$lv);
}
}
?>
|