Hi ..

I'm still working on my members login script.

I'm using a simple username/password login form that calls the following
login script
//=====================================================
<?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_data 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_register('uname');

 $_SESSION['uname'] = $username;
 header('Location: /members/main.php');
   }
   else {
          }
  }
?>
//=====================================================

the login scrip works fine .. and it directs me to the correct landing page

The problem occures when I tried to secure the members area pages using the
following code in the begining of each page
//=====================================================
<?php session_start();
 if($_SESSION['uname'] = = "")
 {header('Location: ../../index.php');
  exit();
 }
 else{}
?>
<html>
... other html code
</html>
//=====================================================
After I login using the correct user name and password I get always
re-directed to that index page as if I'm not logged in

I'm really so new with the sessions usage so I can't figure out what do I
miss here
any help would be appreciated.

Thanks in advance

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

Reply via email to