function login problem
| From: | Greg K | Date: | Thu, 17 May 2001 12:17:19 +0000 |
| Subject: | function login problem | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-9403@lists.php.net to get a copy of this message | ||
I am creating a function called login, I have a main file called index.php
.. which has my login form , it calls a login.php file, and in that
login.php there is file include statement which calls config.php and that is
where the function lie. This is my function , now if i don't set this as a
function and just put it my login.php it works fine. But when I name the
function in put it in my config.php no matter what I do all ways giving me
the error You have entered an invalid username or password. I dont know if
this has to do with passing of variables.. or what is going on but if
something can please help me I would appreciate it ..
Thank You
function login() {
$query="Select uname from members where pass='$pass'and
uname='$username'";
$result=mysql_query($query) or die("You are not authorized to be here.");
$array= @mysql_fetch_array($result);
$uname = $array[0];
if($uname=="")
{
echo "You have entered an invalid username or password";
}
else
{
echo "You are logged in";
$remote_address = getenv("REMOTE_ADDR");
echo "Your IP address is $remote_address.";
}
}