| 
	
 | 
 Posted by jodleren on 12/28/07 13:51 
On Dec 28, 12:13 pm, lukk3tt0 <lu...@ghjghjhg.ll> wrote: 
> Hi guys, 
> I found this script:http://hvassing.com/2007/simple-php-login-script-using-session-and-my... 
> 
> but if I try to recall, in a page  I created, the variable "username" 
> that a user fill in the login page, it does not work. 
> How could I retrieve the "username", in other pages, using sessions? 
 
hmmm cannot quite follow, but a common thing (which even I made when 
using sessions first time :-|) is to forget to user start_session() 
every time. It does not start the sesstion, just gives you access to 
it. 
 
> $result=mysql_query("SELECT * FROM members 
> WHERE username="$_POST[username]""); 
 
Gee... I have been wondering whether the post can be in there, but 
*just in case* I have always used it like this 
 
 $result=mysql_query("SELECT * FROM members WHERE username=\"". 
$_POST["username"]."\""); 
or 
 $result=mysql_query("SELECT * FROM members WHERE username=\"". 
$_SESSTION["username"]."\""); 
 
say 
if(isset($_SESSTION["username"])) 
  $result=mysql_query("SELECT * FROM members WHERE username=\"". 
$_SESSTION["username"]."\""); 
else 
  $result=mysql_query("SELECT * FROM members WHERE username=\"". 
$_POST["username"]."\""); 
 
WBR 
Sonnich
 
  
Navigation:
[Reply to this message] 
 |