Hi there. I'm very new to PHP and it's amazing world and I've been working through the Beginning PHP, Apache, MySQL Web Development book and it wasn't before long that I encountered a problem. I've been trying to run the follow two scripts:
movie1.php
<?php
session_start();
$_SESSION['username']="Joe12345";
$_SESSION['authuser']=1;
?>
<HTML>
<HEAD>
<TITLE>Find my Favourite Movie!</TITLE>
</HEAD>
<BODY>
<?php
$myfavmovie=urlencode("Come On!");
echo "<a href='http://localhost/moviesite.php?favmovie=$myfavmovie'>";
echo "Click here to see information about my favourite movie!";
echo "</a>";
?>
</BODY>
</HTML>
moviesite.php
<?php
session_start();
//check to see if user has logged in with a valid password
if ($_SESSION['authuser']!=1) {
echo "Sorry, but you don't have the permissions";
exit();
}
?>
<HTML>
<HEAD>
<TITLE>My Movie Site - <?php echo $_REQUEST['favmovie'] ?></TITLE>
</HEAD>
<BODY>
<?php
echo "Welcome to our site, ";
echo $_SESSION['username'];
echo "! <br>";
echo "My favourite move is ";
echo $_REQUEST['favmovie'];
echo "<br>";
$movierate=5;
echo "My movie rating is: ";
echo $movierate;
?>
</BODY>
</HTML>
You will probably notice that 'authuser' has a consistent value but i still get the No Permission warning. I also get this following error message in the log:
[error] [client 127.0.0.1] PHP Notice: Undefined index: authuser in C:\\Web\\moviesite.php on line 4, referer:
http://localhost/movie1.php. Is there a setting in the php.ini that i'm not a aware of?
Somebody please help!!