Hi There.
I'm using an Include PHP File at the Top and another at the bottom of my PHP pages to autenthicate users against a DataBase. (If you have other way of doing this, welcome)
I create a session and the User ID and Pass are global Variables.
The code in the resulting page is:
<?
ini_set("session.cache_limiter","");
session_start();
include("security_top.inc.php") ;
?>
<HEAD>
<title></title>
</head>
<body>
My normal HTML or PHP Page
<? include("security_down.inc.php") ?>
</BODY>
The security_top.inc.php include is:
<?
// Search the user in the DB
$sql = "SELECT userid, pass FROM usuario WHERE userid='$id_glo'" ;
$query = mysql_query($sql);
$query_res = mysql_fetch_array($query);
$pw2 = $query_res['pass'];
// checks if the pass matches
if ($pw_glo==$pw2)
{
?>
And the security_down.inc.php one is:
<?
}
else
{
?>
You can not view this page !!
}
?>
The problem is that I get 2 parse errors, in the top one, the line after the "{" and in the bottom one the second line, the one with "}"
Any clues ?
Can I leave IF statements open inside Includes ?
Plase, Help
Thanks
Jose