php-general | 2001122
Date: 12/21/01
- Next message: Michael Sims: "Re: [PHP] Beginner question?"
- Previous message: Alawi: "[PHP] some body flood mypage how can I prevent them ?"
- Next in thread: Jerry Verhoef (UGBI): "RE: [PHP] Login Script"
- Maybe reply: Jerry Verhoef (UGBI): "RE: [PHP] Login Script"
- Reply: Bogdan Stancescu: "Re: [PHP] Login Script"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Lo all,
I am trying to get the following script to work..
<?
if ($HTTP_POST_VARS["action"] == 1)
{
checklogin($HTTP_POST_VARS["user_name"], $HTTP_POST_VARS["password"]);
exit;
}
function checklogin($user, $pass)
{
$sid (login($user, $pass));
if ($sid != -1)
{
header("Location: http://localhost/hq.php?sid=$sid");
}
else
{
header("Location: http://localhost/error.php");
}
}
function login($user, $pass)
{
$db = "zoner2";
$SQL = "SELECT * FROM users WHERE user_name='".$user."' AND
password='".$pass."'";
$connection = db_connect();
$query = mysql_db_query($db, $SQL, $connection);
if (mysql_num_rows($query) != 1)
{
return -1;
}
$row = mysql_fetch_array($query);
$user_id = $row["user_id"];
$sid = md5("blah blah".$user_id.$time());
$remip = REMOTE_ADDR();
$ttime = date("YmdHis");
$SQL2 = " INSERT INTO details ";
$SQL2 = $SQL2 . " (user_id, sid, ttime, remip) VALUES ";
$SQL2 = $SQL2 . " ('$user_id','$sid','$ttime','$remip') ";
#######
$result2 = mysql_db_query($db,"$SQL2",$connection);
if (!$result2) { echo("ERROR: " . mysql_error() . "\n$SQL\n");
mysql_close($cid); exit; }
#######
SetCookie("TheLoginCookie", "$user_id:$sid:$ip", time()+3600);
return $sid;
}
?>
But every time I open the login page and try to login I get the following
error.
Fatal error: Call to undefined function: () in d:\htdocs\web\login1.inc on
line 10
Can anyone explain why this is??
Thankyou.
Andrew
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Michael Sims: "Re: [PHP] Beginner question?"
- Previous message: Alawi: "[PHP] some body flood mypage how can I prevent them ?"
- Next in thread: Jerry Verhoef (UGBI): "RE: [PHP] Login Script"
- Maybe reply: Jerry Verhoef (UGBI): "RE: [PHP] Login Script"
- Reply: Bogdan Stancescu: "Re: [PHP] Login Script"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

