argh! hotmail sucks

I don't see in the script where you are using $_POST / $_GET / $_REQUEST to 
access tha data from the form. Its likely that the example you are following is 
old and uses 'register_globals'. Since register_globals is a huge security hole 
and is not active in any new installations of PHP you need to change your 
script to use the above methods to get the form data. The error you are getting 
is due to the fact that you are not passing in the values to the sql and not 
getting a valid result

Note that the below example fixes your issue but DOES NOT do any validation, 
which you really should do before passing your data to the sql...




$userid=mysql_real_escape_string($_POST['userid']);  
$password=mysql_real_escape_string($_POST['password']); 

if($rec=mysql_fetch_array(mysql_query("SELECT * FROM tablename WHERE> 
userName='$userName' AND password = '$password'"))){ 

 if(($rec['userName']==$userName)&&($rec['password']==$password))


bastien



----------------------------------------> Date: Sun, 16 Sep 2007 02:39:57 
-0700> From: [EMAIL PROTECTED]> To: php-general@lists.php.net> Subject: [PHP] 
php Login script issue>>> Hi,>> Its just a login and password validation that I 
am trying to achieve. If the> username is correct then the person is able to 
view certain page, if> incorrect then he is directed elsewhere.>>  
$userid=mysql_real_escape_string($userid);> 
$password=mysql_real_escape_string($password);>> 
if($rec=mysql_fetch_array(mysql_query("SELECT * FROM tablename WHERE> 
userName='$userName' AND password = '$password'"))){> 
if(($rec['userName']==$userName)&&($rec['password']==$password)){> include 
"../include/newsession.php";> echo " Successfully,Logged in> logout.php Log OUT 
 welcome.php Click here if your browser is not> redirecting automatically or 
you don't want to wait. ";> print "";>> }> }> else {>> session_unset();> echo 
"Wrong Login. Use your correct Userid and Password and Try>  
onClick='history.go(-1)'>";>> }> ?>>> I am getting this error when I am using 
this code:>> Warning: mysql_fetch_array(): supplied argument is not a valid 
MySQL result> resource in thispage.php on line 37> Wrong Login. Use your 
correct Userid and Password and Try>> Why does it show up everytime and whats 
wrong with mysql_fetch_array().>> Please advice also if there is some other way 
available please help me try> that.>> Thanks,>> Chris> --> View this message in 
context: http://www.nabble.com/php-Login-script-issue-tf4450691.html#a12698139> 
Sent from the PHP - General mailing list archive at Nabble.com.>> --> PHP 
General Mailing List (http://www.php.net/)> To unsubscribe, visit: 
http://www.php.net/unsub.php>

_________________________________________________________________
Connect to the next generation of MSN Messenger 
http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=wlmailtagline
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to