Jump to content

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

shouldn't you be using mysql_fetch_row instead of mysql_fetch_array?

 

no array is ok as it works in my othe login script which is why im baffeled the othe login script works but this dont but i will get it a go with mysql_fetch_row :)

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.