note 31971 deleted from function.setcookie by rioter

From: Date: Sun, 11 May 2003 07:42:35 +0000
Subject: note 31971 deleted from function.setcookie by rioter
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-47832@lists.php.net to get a copy of this message
Any on visiting know what is wrong with this login code useing cookies? <? if(@!$login_u){ $user= $HTTP_COOKIE_VARS["username"]; } if(@!$login_p){ $login_p= $HTTP_COOKIE_VARS["password"]; } $db=mysql_connect("localhost","sql_username","sql_password") or die ("cant connect"); mysql_select_db("bombthefrench_uk_db",$db) or die ("cant change"); $sql_log="SELECT * FROM users WHERE loginname='$login_u' AND password='$login_p'"; $resultlog=mysql_query($sql_log); $number= mysql_num_rows($resultlog); if($number == "1"){ setcookie("username",$login_u,time()+43200); echo"<!-- blah -->"; setcookie("password",$login_p,time()+43201); } else{ echo"$HTTP_REFERER<br>$sql_log<form method=post action=$PHP_SELF><h1>User login</h1>Login name:<input type='text' name=login_u value='$login_u'><br>Password:<input type='password' name=login_p value=''> <a href=imaprat.php><small>Forget password</small></a><br><input type='submit' value='login'><br>$logu<br>$logp</form>"; include("base.php"); exit; } ?>

« previous php.notes (#47832) next »