Get the last click url and set it into session

This is so simple just put the highlighted code in your main file .

*************************************************************
 $current_url = (!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] : "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];

 define('CURRENT_URL' , $current_url );

*************************************************************


and then check this into the session using this  :----
if(!$this->session->userdata('uid')){

$url = (!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] : "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
$this->session->set_userdata('redirect' , $url);
redirect('login');
exit;
}

Post a Comment

Previous Post Next Post