Jump to content

Unset and reset_session confusion help...


co.ador

Recommended Posts

What means 'reset_session' and destroy. ?

 

Will reset_session only unset the session for that moment or a lapse or time ?

 

I am kind of confuse as what are going to be the result of unsetting the variable $_SESSIÖN as below.

 

Will it be use to log out only or will it delete the session information for the user?

 

 

if($_REQUEST['m']=='reset_session')
{
    unset ($_SESSION['logedin']);
    unset($_SESSION);
     header("Location:index.php");
}


if(COUNT($_SESSION))
{
    header("Location:index.php");
}
else if(count($_POST)){
        
    if(! $conn=mysql_connect("localhost", "root", "demo"))
    {
        die("Could't connect to database server..");
    }
    mysql_select_db("online_application",$conn) or die(mysql_error());
    
    $username   = $_POST['txt_username'];
    $password   = $_POST['txt_pass'];
    
    
    $sql = " SELECT * FROM users WHERE user_name='".$username."' AND password='".$password."'";
    $result = mysql_query($sql);
    
    //while($row = mysql_fetch_object($result)){
    //print'<pre>';
    //print_r($row);
    //print'</pre>';
    //
    //print $row->user_name;
    //print'<br/>';
    //}
    
    
  //  print mysql_num_rows($result);
    if(mysql_num_rows($result)){
       // print 'user exists';
       $_SESSION['logedin']=1;
       header("Location:index.php");
    }
    
}

?>

Link to comment
https://forums.phpfreaks.com/topic/201300-unset-and-reset_session-confusion-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.