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 July 26th, 2004, 04:07 PM
Registered User
 
Join Date: Jul 2004
Location: Greysteel, Derry, Ireland.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 2, pages 68/69 moviesite.php

Hello,

I am having major problems with the moviesite.php script and it is the version that first introduces functions.

First of all I login via login.php with no problem and I am then directed to movie1.php and there are 3 links - the top one is for movie info and the middle is for top 5 movies and the last top 10 movies.

Each of these links call moviesite.php

If I click on the top link for basic movie info this is displayed ok

However, if I click on either the top 5 or top 10 link I get displayed the message... 'Sorry you do not have permisson to view this page etc etc'

It's as if the if statment to check the value of $_SESSION['authuser'] is proving negative but how can this be as I am already 'logged in' so authuser = 1?

Here is my code below. Some more info..this problem happens across several machines plus different browsers - ie, netscape, opera mozilla firefox so I am wondering if there is a bug in the code? I think there may be a bug in the code as I downloaded the code for this section from this wrox site and the exact same happens with the authors code.

thanks in advance.

My script...

<?
session_start();
//check to see if user logged in ok
if ($_SESSION['authuser']!=1) {
echo "Sorry but you do not have permission to view this page you twat!";
exit();
}
?>
<HTML>
<HEAD>
<TITLE>My Movie Site - <? echo $_REQUEST['favmovie'] ?></TITLE>
</HEAD>
<BODY>
<? include "header.php"; ?>
<?
function listmovies_1()
{
         echo "1. Life of Brian<br>";
         echo "2. Stripes<br>";
         echo "3. Office Space<br>";
         echo "4. The Holy Grail<br>";
         echo "5. Matrix<br>";
}

function listmovies_2()
{
         echo "6. Terminator 2<br>";
         echo "7. Star Wars<br>";
         echo "8. close Encounters of the Third Kind<br>";
         echo "9. Sixteen Candles<br>";
         echo "10. Caddyshack<br>";
}

if (ISSET($_REQUEST['favmovie'])) {
echo "Welcome to our site, ";
echo $_SESSION['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;
}
else {
     echo "My top ";
     echo $_REQUEST['movienum'];
     echo " movies are:";
     echo "<br>";

     listmovies_1();
     if ($_REQUEST['movienum'] == 10) listmovies_2();
}
?>
</BODY>
</HTML>

Reply With Quote
  #2 (permalink)  
Old August 1st, 2004, 05:27 AM
Authorized User
 
Join Date: Jul 2004
Location: Las Vegas, NV, USA.
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:
<?
function listmovies_1()
that won't work.

"<?php" will unless you have turned on short tags. Are you using short tags in your other scripts?

Also the error may be in the referring page. It would help to see the code from all your pages.

As for the code being buggy, it worked for me and several others without issue. Getting from login.php to movie1.php will happen if you type in the correct username and password, even with cookies turned off.
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
Ch3 Moviesite table already exists? aiche_ag BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 August 7th, 2007 01:29 PM
Multilingual PHP pages js_newbie PHP FAQs 0 April 13th, 2007 04:55 AM
begin php & mysql - chapter 12, user_form.php jon_stubber Beginning PHP 1 March 9th, 2006 10:57 AM
moviesite login problem chapter 2 StuartD BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 3 August 15th, 2005 06:04 AM
moviesite.php - error line 43 Chudz BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 3 August 2nd, 2004 03:52 AM



All times are GMT -4. The time now is 06:09 AM.


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