Jump to content

[SOLVED] sessions not setting :S


jamesxg1

Recommended Posts

if (isset($_POST['FileSubmit'])) {

$username = mysql_real_escape_string(stripslashes($_POST['username']));

$password = mysql_real_escape_string(stripslashes($_POST['password']));



if (isset($username) && isset($password)) {


        $result = mysql_query($sql);


$sql = sprintf("SELECT * FROM `unlock` WHERE username = '$username' AND password = '$password'") or die(mysql_error()); 
$result = mysql_query($sql) or die(mysql_error());

if (mysql_num_rows($result) > 0) {

$morerow = mysql_fetch_array($result);
            
$date = date('Y-m-d');

if ($morerow['when'] == $date) { 

              $_SESSION['username'] = $username;
              $_SESSION['filename'] = $morerow['filename'];
              $_SESSION['owner'] = $morerow['owner'];
              $_SESSION['dir'] = $morerow['format'];

              header('Location: Main.php');

          } else
            echo "<div align=\"center\"><font color=red> 
  		        <img src=\"Security/PhotoProcess.php?picname=exclam\"/><i>Your file is unable to be obtained at this present time, Due to the owner specific date being diffrent to today.</i></font></div>";
       }else{

          echo "<div align=\"center\"><font color=red> 
  		        <img src=\"Security/PhotoProcess.php?picname=exclam\"/><i>Invalid login<br>If you are a new user please register</i></font></div>";
       }

    }else{ 

      echo "<div align=\"center\"><font color=red> 
           <img src=\"Security/PhotoProcess.php?picname=exclam\"/><i> You must enter a username and password!</i></font></div>";
    }
    
  }
  

Link to comment
https://forums.phpfreaks.com/topic/154498-solved-sessions-not-setting-s/
Share on other sites

So this part sets correctly?  And when you echo out $_SESSION['username'] it displays the correct user name from the POST but the other session variables don't echo out anything(aren't set)?

 

$_SESSION['username'] = $username;

 

Where do you actually echo out the session vars to see if they're set?  What else outputs?  We need some more information.

So this part sets correctly?  And when you echo out $_SESSION['username'] it displays the correct user name from the POST but the other session variables don't echo out anything(aren't set)?

 

$_SESSION['username'] = $username;

 

Where do you actually echo out the session vars to see if they're set?  What else outputs?  We need some more information.

 

nothing else outputs none of them are working except the username one, and i print_r the morerow and its all coming back correct :S, no i really confused :S

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.