Hey all,
    I was wondering if anyone could explain to me why I can't seem to maintain a 
session using PHP 4.1.2 on my NT4 server.  I am don't have any problems on my W2K/IIS5 
or Linux machine.  What I am doing is allowing my users to log on to the site at any 
time, and then being returned to the page that they logged in from.  This isn't the 
problem.  The problem is on the NT4/PHP4.1.2 machine when I click on a link to go to 
another page their login information is lost, almost as if they logged out.  Here is 
the validation code that I am currently using:

function validateUser() {
  $users = file("includes/users.txt");

  if(!isset($_SESSION['logged_in'])) $_SESSION['logged_in'] = FALSE;
  if(!isset($_SESSION['log_attempt'])) $_SESSION['log_attempt'] = FALSE;
  if(!isset($_SESSION['valid_user'])) $_SESSION['valid_user'] = "";
  if(!isset($_SESSION['email'])) $_SESSION['email'] = "";
  if(!isset($_REQUEST['phpsessid'])) {
    if(empty($_POST['email']) || empty($_POST['passwd'])) {
      $email = "";
      $pass = "";
    } else {
      $email = $_POST['email'];
      $pass = $_POST['passwd'];
      $_SESSION['log_attempt'] = TRUE;

    // replace with SQL query when db is instated
    foreach($users as $login) {
      list($user,$passwd,$fname,$lname) = explode("|",$login);
      if($user==$email && $passwd==md5($pass)) {
        $_SESSION['logged_in'] = TRUE;
        $_SESSION['valid_user'] = $fname." ".trim($lname);
        $_SESSION['email'] = $email;

Once again, it works fine on the W2K/IIS5 and Linux box, so that is why I am having 
problems isolating the problem.  Maybe it's just my logic and a fresh pair of eyes 
would help looking at this.

Thanks for all your help,

 / Joshua Minnie    \
+                    +-------------------------------+
| Wild Web Technology                                |
| Independent Web Consultant/Developer               |
| [EMAIL PROTECTED]                               |
|                                                    |
| Tel : 616.890.1566                                 |

Reply via email to