Re: Session again !!!

From: Date: Sun, 05 Sep 2004 15:23:33 +0000
Subject: Re: Session again !!!
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-195914@lists.php.net to get a copy of this message
I really did and it behaves the same I tried isset() also but there is no good it still does not work !!! "Afan Pasalic" <afan@afan.net> wrote in message news:413B21FF.8080601@afan.net... > Try use > > if(empty($_SESSION['uname']) > > instead > > if($_SESSION['uname'] = = "") > > > Afan > > > > Dre wrote: > > >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 > > > > > >

« previous php.general (#195914) next »