sophielois
Technical User
Hi,
Im trying to put togther an include file that im putting at the top of each "restricted to registered users page" to act as a security check
heres the code im playing with
its returning the following
I've registered the sessions
I think the parse error is to do with '$_SESSION['cka'] and '$_SESSION['ckb'] but im unsure as to how to fix it.
Is this a good enough security check (providing it works) ?
Thanks
Soph
Im trying to put togther an include file that im putting at the top of each "restricted to registered users page" to act as a security check
heres the code im playing with
Code:
<?
session_start();
header("Cache-control: private");
// 1st security check
$sql = mysql_query("SELECT * FROM candidates WHERE username ='$_SESSION['cka']' AND password ='$_SESSION['ckb']'");
$sec_chk = mysql_num_rows($sql);
if($sec_chk > 1){
header ("Location: ../index.php");
exit();
} else {}
?>
its returning the following
Code:
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/n/v/nvqwandp/public_html/nvq/index.php on line 6
I've registered the sessions
Code:
$_SESSION['chk1'] = $password;
$_SESSION['chk2'] = $username;
I think the parse error is to do with '$_SESSION['cka'] and '$_SESSION['ckb'] but im unsure as to how to fix it.
Is this a good enough security check (providing it works) ?
Thanks
Soph