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 August 7th, 2005, 07:25 PM
Registered User
 
Join Date: Apr 2005
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to StuartD
Default moviesite login problem chapter 2

hi there,
I've got the same problem as the other guy: I can't login to the moviesite.php via login.php as per p61.

I followed the other thread, and inserted the code:
while(list($key, $val) = each ($_POST))
{
      echo "$key -- > $val<br>";
}

in order to output the contents of POST
and i get:

user -- > Joe
pass -- > 12345
Submit -- > Submit

 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /var/www/movie1.php:4) in /var/www/movie1.php on line 6
 Sorry, but you don't have permission!

this is with the code inserted right fter the opening <?php tag, before the session_start()

can anyone help me out here? what does that output mean? My files are below.
 Thanks in advance for any replies.
Stu

<?php
while(list($key, $val) = each ($_POST))
{
      echo "$key -- > $val<br>";
}
session_start();
$_SESSION['username']=$POST['user'];
$_SESSION['userpass']=$POST['pass'];
$_SESSION['authuser']=0;

//check username and password info

   if (($_SESSION['username']== 'Joe') AND
         ($_SESSION['userpass']== '12345'))
   {
   $_SESSION['authuser']=1;
   }
   else
   {
   echo "Sorry, but you don't have permission!";
   exit();
   }
?>
<html>
<head>
<title>Find my Favourite 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 favourite movie!";
  echo "</a>";
?>
</body>
</html>

----------------------------

<?php
session_start();
//check to see if user has logged in with a valid password
   if ($_SESSION['authuser']!=1) {
   echo "Sorry, no permissionz!";
exit();
}
?>


<html>
<head>
<title>My Movie Site - <?php echo $_REQUEST['favmovie'] ?></title>
</head>

<body>
<?php
   echo "Welcome to my site, ";
   echo $_SESSION['username'];
   echo "! <br>";
   echo "My favourite movie is ";
   echo $_REQUEST['favmovie'];
   echo "<br>";
   $movierate=5;
   echo "My rating for this movie is: ";
   echo $movierate;
?>
</body>
</html>

---------------------------------

<?php
session_unset();

?>
<html>
<head>
<title>Please Log In</title>
</head>

<body>
<form method="post" action="http://localhost/movie1.php">
   <p>Enter you username:
     <input type="text" name="user">
   </p>
   <p>Enter your password:
      <input type="password" name="pass">
   </p>
   <p>
     <input type="submit" name="Submit" value="Submit">
   </p>
</form>
</body>
</html>



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

Ok, it seems that the form data is correctly being passed to the page. Remove the extra code and try it again.

Post back with any output received.

Reply With Quote
  #3 (permalink)  
Old August 12th, 2005, 06:47 PM
Registered User
 
Join Date: Apr 2005
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to StuartD
Default

hi there,
Ok did that, Im back to:
'Sorry, but you don't have permission!'



Reply With Quote
  #4 (permalink)  
Old August 15th, 2005, 06:04 AM
Registered User
 
Join Date: Apr 2005
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to StuartD
Default

Ughhhh....

I have pored over this code again and again...I am either certain its the same as the code in the book, or am hallucinating.
Can anyone see anything wrong with this? Or any deviations from the code on p59-60?


many thanks


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
Chapter 10 login problem Dennis Mollet BOOK: Beginning VB.NET Databases 1 August 18th, 2005 04:07 AM
Chapter 4 PDF Export SQL login problem gry52 BOOK: Professional Crystal Reports for VS.NET 4 January 18th, 2005 12:02 PM
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
Chapter 2, pages 68/69 moviesite.php ruairiglenn04 BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 1 August 1st, 2004 05:27 AM



All times are GMT -4. The time now is 05:21 AM.


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