Welcome Guest, Not a member yet? Register   Sign In
Login problem in safari..redirect() make problem
#1

[eluser]Zeeshan Rasool[/eluser]
Hi every one, i have a little issue that i have login problem in safari. I cant login it take me to login page again and again while other browsers took me to dash board. I have correct login info but safari make problem, Here is code part
I enter in first if condition but redirect function did'nt take me to main() function i put a die() in main but it never go in main().
Code:
if($res!=0)
{
  echo "ok"; /// it comes here
  $user_id=$res;
  $Counts=1;
  redirect('cms/main', 'refresh'); // did'nt work
}
elseif($res=='inactive')
{
  $newdata = array('Flag'  => 'Sorry! Your site is inactive at this time.');
  $this->session->set_userdata($newdata);
  redirect('cms/', 'refresh');
}
else
{
  $newdata = array('Flag'  => 'Invalid User name or Password!');
  $this->session->set_userdata($newdata);
  redirect('cms/', 'refresh');
}

Please give a solution

Thanks
#2

[eluser]pistolPete[/eluser]
I guess you should not echo before using redirect() like the user guide says:

Quote:Note: In order for this function to work it must be used before anything is outputted to the browser since it utilizes server headers.
#3

[eluser]Zeeshan Rasool[/eluser]
You are right but it was just testing purpose. I found the reason actually safari has session problem, In below code you will see that i am inserting data at login time but session id which i used before each function to check wether its session time exceed, this id is different from other browser i mean it put a session id in DB and i store that id in session but it is not actual value which i echoed on insertion time. But other browser put same session id which is on insertion time
I dont know wats problem. Why safari has this problem
Code:
$IP=$_SERVER['SERVER_ADDR'];
$user_agent=$_SERVER['HTTP_USER_AGENT'];
$data = array(
  'ci_session_id' => $sID,
  'session_id'      => $sess_id,
  'ip_address'      => $IP,
  'user_agent'      => $user_agent,
  'last_activity' => strtotime('now'),
  'username'       => $username,
  'logged_in'       => TRUE,
  'user_type'      => 0,
);
//print_r($data);
$this->session->set_userdata('session_id',$sess_id);
$InsertQuery=$this->db->insert('ci_sessions',$data);




Theme © iAndrew 2016 - Forum software by © MyBB