this is the username/password validation script which receives the user name
and password from a regular form
and they are sent correctly

logme_in.php
//==========================================================================
==
<?php
  session_start();
  $username = trim(addslashes($_POST['user_name']));
  $pass = trim(addslashes($_POST['password']));

  if((empty($_POST['user_name'])) || (empty($_POST['password'])))
  {
  header('Location: index.php');
   include("login_form");
   exit();
  }
  else{
   include("db.php");
   $sql = "SELECT * FROM  members_webdata WHERE user_name='".$username."'
AND password='".$pass."'";
   $result = mysql_query($sql);
   $num_return = mysql_num_rows($result);

   if($num_return ==1)
   {
    $row = mysql_fetch_array($result);
 $_SESSION['uname'] = $row['user_name'];

 echo "<a href=\"members/main.php\">"."CLICK HERE TO GO TO MEMBERS SECTION";
 echo "</a>";
 //session_write_close();
// header('Location: members/main.php'."?_SESSION['uname']=".
$row['user_name']);
   }
   else {
   }
  }

?>
//========================================================================
this is the page I try to open after logging in but it behaves like if I'm
not logged at all

members/main.php
//========================================================================
<?php session_start();
 $user_name = $_SESSION['uname'];
 if(empty($user_name))
 {header('Location: ../../login_first.php');
  exit();
 }
 else{// print_r($HTTP_SESSION_VARS['uname']);
 }
?>
<html>
...
</html>
//========================================================================
//========================================================================

"Dre" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I do know this
> and what happen is that the $_SESSION array become empty once I redirect
> from the login page (after login) to another members' area page .. !!
>
>
> "Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Dre wrote:
> > > I don't know why but session variables does not get posted .. is there
> any
> > > thing in the php.ini that I should configure as
> > > I can't find any thing wrong in the code I'm using !!
> > >
> >
> > Session variables are not posted, they are kept on the server. Only the
> > session id is sent as a cookie, get or post variable. Session variables
> > are available in $_SESSION array

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to