Welcome Guest, Not a member yet? Register   Sign In
How to verify a session in the view? It is possible?
#1

[eluser]Tomer Simis[/eluser]
I'm creating a site with a login panel, and when the user log on, it would display a message, but i dont know how to do this in CodeIgniter.

In normal PHP, its like this:

Code:
if(isset($_SESSION['login'])){
    echo '<p>You are logged.</p>';
    
        if($_SESSION['type'] == 'admin'){
        echo  '<p>Im a admin</p>';
        }
}else{
    echo '<p>You are not logged.</p>';
}

but in codeigniter its hard, can i check the session in the view? or i need to pass the status from the controller?

Please, help me guys
Thanks
#2

[eluser]cahva[/eluser]
In normal CI, its like this: Smile
Code:
if ($this->session->userdata('login'))
{
    echo '<p>You are logged.</p>';
...
#3

[eluser]Tomer Simis[/eluser]
It works =DD
Thanks very much!!!




Theme © iAndrew 2016 - Forum software by © MyBB