|
大家好, 我又來問了,
我的程式是
1. 先到A網頁, 這時會判斷SESSION的值如果不是1 , 就會到登入頁(B網頁),
2. 在B網頁中, 登入後, 會把幾個值, 寫入SESSION中, 再把SESION的值印出來, 都有值,
$this->load->library("session");
$mid = $this->input->post("mid",TRUE);
$pwd = $this->input->post("pwd",TRUE);
$sql = "select * from manager where is_delete=0 and mid='$mid' and pwd = '$pwd'";
$query = $this->db->query($sql);
if($query->num_rows()>0){
$rs = $query->row();
$newdata = array(
'manager_login' => '1',
'manager_mid' => $rs->mid,
'manager_group' => $rs->manager_group,
'manager_name' => $rs->manager,
);
$this->session->set_userdata($newdata);
echo $this->session->userdata("manager_login") . "<br>";
echo $this->session->userdata("manager_mid") . "<br>";
echo $this->session->userdata("manager_group") . "<br>";
echo $this->session->userdata("manager_name") . "<br>";
}
3. 把值印出來後, 再送到A網頁, 再去判斷manager_login的值是不是1 , 但這時的值是讀不到的, 把他印出來值為 0
$this->load->library("session");
if($this->session->userdata("manager_login")){
$manage_login = $this->session->userdata("manager_login");
}else{
$manage_login = "0";
}
echo $manage_login;
之前還可以讀的到值, 昨天的機器是有關掉, 今天再打開電腦, 就讀不到值了,
而SESSION, 我是設定, 存到資料庫中,
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_encrypt_cookie'] = FALSE;
$config['sess_use_database'] = TRUE;
$config['sess_table_name'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 300;
有大大可以幫我嗎? |
|