Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 13th, 2006, 09:16 AM
Registered User
 
Join Date: Nov 2006
Location: London, , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chap. 2 Page 52-53 session

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!!

Reply With Quote
  #2 (permalink)  
Old November 13th, 2006, 01:59 PM
Registered User
 
Join Date: Nov 2006
Location: London, , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I've had a look into C:\Temp folder, which is where the session.path points to. I've noticed that when trying to run the script two session files are created. One with the "username|s:8:"Joe12345";authuser|i:1;" and second one being empty. I'm guessing that script looks into the empty session file, which is why I keep getting the "No permissions..." message. Is there anyway to get the script to a certain session file or any way to fix this problem?

Reply With Quote
  #3 (permalink)  
Old November 30th, 2006, 03:07 PM
Authorized User
 
Join Date: Jul 2006
Location: Happaugh, NY, .
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Did you get an answer to this issue yet? if not i will take a look at it for you (i dont want to look if you resolved it already, please let me know - and i will help you out - just post a Yes No).

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 2 - Page 52, 53 Chudz BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 8 February 19th, 2006 07:09 PM
Ch2 52-54--passing session variables dprice BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 3 September 26th, 2005 07:01 AM
Ch 2 Page 53: Undefined index: authuser Airidh BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 25 February 22nd, 2005 07:34 PM
Chap. 11 - Try It Out, Session Tracking with PHP Tachyon BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 5 June 17th, 2004 02:02 PM



All times are GMT -4. The time now is 12:01 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.