session and cookie problem (empty session file)
Hi folks,
I try to learn web database programming with php and I chose this book for it. Unfortunately I got stuck with the second chapter already. I use win XP pro with phpdev package installed. Everything except the session and cookie data passing seems to be working fine.
when I try the Passing the visitors name example I get
Sorry, but you don't have permission to view this page, you loser!
Well I have checked that I have a valid temp file and gave permissions to write. I even see an empty session data file being created everytime I try the pages but there is no data in the session file. Since there is no data in the file no data is passed to the second page and hence the
Sorry, but you don't have permission to view this page, you loser!
my codes are below:
movie1.php
<?php
session_start();
$_SESSION['username']="Joe12345";
$_SESSION['authuser']=1;
?>
<HTML>
<HEAD>
<TITLE>Find my Favorite Movie!</TITLE>
</HEAD>
<BODY>
<?php
$myfavmovie=urlencode("Life of Brian");
echo "<a href='http://192.168.0.10/index.php?favmovie=$myfavmovie'>";
echo "Click here to see information about my favorite movie!";
echo "</a>";
phpinfo();
?>
</BODY>
</HTML>
movie.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 permission to view this page, you loser!";
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 favorite movie is ";
echo $_REQUEST['favmovie'];
echo "<br>";
$movierate=5;
echo "My movie rating for this movie is: ";
echo $movierate;
?>
</BODY>
</HTML>
I appreciate your help.
Thanks
|