Jump to content

Session Question?


Trium918

Recommended Posts

As you can see, the session_start() is commented out.

How come the session is being set still?

 

<?php
//session_start();

if($_POST['sublogin']){
$user_name = $_POST['user_name'];
$password = trim($_POST['password']);

$query = "SELECT * FROM members_info WHERE  user_name='$user_name' 
AND password=MD5('$password') LIMIT 1";
  
if ($result = mysql_query($query)) {
  if (mysql_num_rows($result) > 0) {
    while ($row = mysql_fetch_assoc($result)) {  
  
$_SESSION['membersid'] = $row['members_id'];
$_SESSION['last']= $row['last_visit'];

if (isset($_SESSION['membersid'])) {
     echo "Session is set";
     exit;
}
else{ echo "No";}

  
  
#Display date as 5/8/2007 format
    $_SESSION['last']= date('n/d/Y', strtotime($_SESSION['last']));  
      
  $sql="UPDATE members_info SET last_visit=NOW() 
          WHERE members_id='{$_SESSION['membersid']}'";   //now only update it
      $result2=mysql_query($sql); 
    }
  } 
  else {
      echo "No results found";
  }
} 
else {
    echo "Query failed<br />$query<br />" . mysql_error();
}

}
?>

Link to comment
https://forums.phpfreaks.com/topic/56594-session-question/
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.