Hi All,
I have this code,
<?php
setcookie('username', 'Joe', time()+60);
session_start();
$_SESSION['authuser']=1;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type">
<title>Movie 1</title>
</head>
<body>
<?php
$favMovie=urlencode("Life Of Brian");
echo "<a href='http://localhost/moviesite.php?favMovie=$favMovie'>";
echo "Click here to see information about my favourite movie!";
echo "</a>";
?>
</body>
</html>
which points to this page,
<?php
session_start;
//Check the user has logged in with a valid password
if ($_SESSION['authuser']!=1) {
echo "Sorry, you're not authorized to access this page";
exit();
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type">
<title>My Movie Site - <?php echo $_REQUEST['favMovie'] ?></title>
</head>
<body>
<?php
echo "Welcome to our site, ";
echo $_COOKIE['username'];
echo "! <br>";
echo "My favourite movie is ";
echo $_REQUEST['favMovie'];
echo "<br>";
$movieRate=5;
echo "My movie rating for this movie is: ";
echo $movieRate;
?>
</body>
</html>
But, I get the error message as if the session is not set,
Sorry, you're not authorized to access this page
but it is set, statically, in the 1st code. I have /my_temp_dir set as
session.save_path,
session.save_path = "/my_temp_dir"
and have set user/group to htdocs and given permission for htdocs to
write to /my_temp_dir,
[ozboy@mumspc my_temp_dir]$ ls -al /my_temp_dir
total 24
drwxr-xr-x 2 htdocs htdocs 4096 May 19 12:08 .
drwxr-xr-x 24 root root 4096 May 19 12:04 ..
-rw------- 1 htdocs htdocs 13 May 19 12:08
sess_69e7ffdaf855da229f4b067668b0f89d
and it has a session file there as you can see. Is my code wrong,
perhaps? I'm following Beginning PHP, Apache, MySQL Web Development. Cheers.
Mark Sargent.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php