是的~~而且path我也设置了~还是不好使
/* * 用户登陆模块 * */
function user_login_act()
{
$username=mysql_escape_string(trim($this->input->post('username')));
$password=trim($this->input->post('password'));
$savepwd=trim($this->input->post('savepwd'));//记住密码
$sql="select * from omy_user where username='".$username."' and password='".md5($password)."'";
$result=$this->db->query($sql);
if($result->num_rows()>0)
{
if($savepwd=='savepwd')
{
$user = array('name'=>'username','value'=>$username,'expire'=>60*60*24*30,'domain' => base_url(),'path'=> '/',);
set_cookie($user);
// $pwd=array('name'=>'password','value'=>$password,'expire'=>60*60*24*30);
// set_cookie($pwd);
}
$row=$result->row_array();
$uid=$row['uid'];
$sess_arr = array('uid' => $uid,'username' =>$username);
$this -> session -> set_userdata($sess_arr);
$hint = '登陆成功';
$url = site_url('user_manage/user_center').'/'.$uid;
exit("<script>\nwindow.alert('{$hint}')\nwindow.location = \"$url\";\n</script>");
}else
{
$hint = '登陆失败';
$url =base_url();
exit("<script>\nwindow.alert('{$hint}')\nwindow.location = \"$url\";\n</script>");
}
}
你看看这段代码对不对 |