hey peeps
i got a setcookie() script on a page in a /users/ directory and i have a style script in a /includes/ directory
when a user logs in on the main page /index.php the user can see he/she is logged in because of a welcome message
however my style script which is loaded in to the same page ( include() )
does not say that the user is logged in
the welcome message script is also loaded from the /includes/ directory
welcome script (/includes/banner.php)
<?
if(isset($_COOKIE['user'])) {
echo "Welcome, <b>".$_COOKIE['user']."</b>!";
} else {
echo "Welcome <b>Guest</b>!";
}
?>
style script (/includes/style.php)
if(isset($_COOKIE['user'])) {
$sql = "SELECT * from custom where username=$_COOKIE['user']";
$result = mysql_query($sql) or die(mysql_error());
while( $row = mysql_fetch_array($result) ) {
?>
code to print
<? } } else { ?>
code to print
<? } ?>
thanks in advance Jon