Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6
This is the forum to discuss the Wrox book Beginning PHP, Apache, MySQLWeb Development by Michael K. Glass, Yann Le Scouarnec, Elizabeth Naramore, Gary Mailer, Jeremy Stolz, Jason Gerner; ISBN: 9780764557446
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old February 27th, 2005, 05:31 PM
Registered User
 
Join Date: Feb 2005
Location: , , Turkey.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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



Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP session cookie ajit Beginning PHP 0 October 23rd, 2007 11:56 PM
Encrypting session cookie krisXp Classic ASP Databases 1 November 9th, 2006 10:21 AM
Cookie and Session rinventive PHP How-To 0 December 6th, 2005 07:09 PM
Session and Cookie authentification dsunmedia PHP How-To 2 August 30th, 2004 06:52 PM
Session cookie problem rogierio Classic ASP Professional 0 October 15th, 2003 09:50 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.