Monday, December 3, 2012

How to create login and logout buttons with sessions?

The piece of code simply create login and logout buttons with sessions in PHP.
<?php
$log=$this->session->userdata("email");
    
if(!$log)
{
       echo anchor('Login path', 'Login', 'title="login"');
}
else
{
         echo anchor('Logout path', 'Logout', 'title="logout"');
}
?>

No comments:

Post a Comment