Click to See Complete Forum and Search --> : Parse error: parse error, unexpected ','


justlikeit
12-25-2005, 07:32 AM
Parse error: parse error, unexpected ',' in /home/chordl01/public_html/function.inc.php on line 102



function login_check($user,$password){
global $REMOTE_ADDR;
$dbconn = db_open();
$query = "SELECT uid,login,password,permit,status,language FROM hyip_users WHERE login='$user'";
$result = mysql_query($query) or die(" ");
$line = mysql_fetch_array($result);
if ($line[password]==$password,$line[password]){ <<< LINE 102
$login = array("uid"=>$line[uid],"permit"=>$line[permit],"status"=>$line[status],"language"=>$line[language]);
db_exec("UPDATE hyip_users SET ip='$REMOTE_ADDR',date=NOW() WHERE uid=$line[uid]");
}else{
$login = 0;
}
db_close($dbconn);
return $login;

-----------------------
Any help will greatly be appreciated. Thanks!

Scleppel
12-25-2005, 08:18 AM
You're not allowed a comma here:
if ($line['password']==$password,$line['password']){
Did you mean this (without the second $line[password)?
if ($line['password']==$password){
If not, what are you trying to do?

Also, when using array keys, you should use quotes:
$array['key'];
// not
$array[key];

bokeh
12-25-2005, 09:47 AM
Also, when using array keys, you should use quotes:
$array['key'];
// not
$array[key];No necessarily! Quotes are not needed for constants and integers. Example:define('password', 'secret');
echo $array[password];
// which would really be echoing $array['secret'];

Scleppel
12-25-2005, 09:59 AM
But as far as i can see, it's not a constant, and then it would raise a notice (i think?) with error_reporting(E_ALL);

Edit: it probably wasn't the best way i could have put it (with enough information), not explaining about constants and numbers.