Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| 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 April 26th, 2005, 05:36 PM
Authorized User
 
Join Date: Apr 2005
Location: , , .
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default Passing through sessions

Hi,

I am working on chapter 2 of beginning php,mysql and apache - moviesite.php and movie1.php. I am now working on Passing variables through sessions. I have cut and past the code (which I downloaded from the wrox site) for both php files (therefore if the code is coming from the source, it surely must be ok).

Every time I click the hyperlink: "click here to see information...." on the movie1.php, it should return:

Welcome to our site Joe 12345
My favourite movie is Life of Brian
My movie rating for this movie is : 5

However (even when I use the code from the book) No session information is passed at all, and all I get is:


My favorite movie is Life of Brian
My movie rating for this movie is: 5

Here is the code I'm using from the book:

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://localhost/moviesite.php?favmovie=$myfavmovie'>";
     echo "Click here to see information about my favorite movie!";
     echo "</a>";
?>
</BODY>
</HTML>

moviesite.php code:

<?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 have checked the registered globals are off (they are) and made sure the php.ini file "session_save_path" is pointing to the C:/temp (which it is).

Does anybody no whats wrong or what I am doing wrong? I basically can't progress through the book until I resolve the problem as the next section uses sessions and cookies, and It won't work if the sessions don't work.

Help!!!!!

Kind regards
David


Reply With Quote
  #2 (permalink)  
Old May 15th, 2005, 11:35 AM
Authorized User
 
Join Date: May 2005
Location: , , .
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Are you running any software that might block first party/session cookies?

One such is ZoneAlarm Pro - another is Norton Internet Suite.

Also, IE 6 can be set to block the session cookie. So what are your privacy settings (assuming you're using IE6)?

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
Sessions, and passing data to another page mrjoka ASP.NET 2.0 Basics 2 March 13th, 2007 10:21 AM
Problem passing through sessions dmlocke PHP Databases 4 June 26th, 2006 08:08 PM
Passing Variables through Sessions dmlocke Beginning PHP 2 April 27th, 2005 05:40 AM
passing through sessions not working dmlocke PHP Databases 2 April 26th, 2005 08:21 AM
Passing value without using sessions lic023 Classic ASP Basics 1 July 20th, 2004 09:58 AM



All times are GMT -4. The time now is 10:14 AM.


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