art art - 6 months ago 17
PHP Question

Session redirect to home when id is null with codeigniter 3.0

Here is my code in controller:

$newdata = array(
'uid' => $usern,
'ou' => $filter


And here is my code in views:


$user = $this->session->all_userdata();

if ($this->session->userdata('uid')=='') {
redirect('main/main', 'refresh');


However when I type link:

(link to show when uid is null, the page should redirect to main)

Only blank page is appearing. It seems it didn't redirect to the main/main page. Can anyone help me ? Thanks.

art art

This is the most silly things I've done. I just forget to import session from library. So should in my public function I put this function.


This is what happen when you try to built two system simultaneously. Anyway thanks for the response and tried to solve it for me.