Line 10 is?

$sid (login($user, $pass)); <--- missing =

-----Original Message-----
From: Necro [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 21, 2001 1:40 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Login Script


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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


The information contained in this email is confidential and
may be legally privileged. It is intended solely for the 
addressee. Access to this email by anyone else is 
unauthorized. If you are not the intended recipient, any 
form of disclosure, production, distribution or any action 
taken or refrained from in reliance on it, is prohibited and 
may be unlawful. Please notify the sender immediately.

The content of the email is not legally binding unless 
confirmed by letter bearing two authorized signatures.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to