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 July 31st, 2004, 12:30 AM
Registered User
 
Join Date: Jul 2004
Location: Houston, TX, USA.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem with my code chapter 2

I am getting the following error
Parse error: parse error, unexpected $end in C:\webdev\xampp\htdocs\movie1.php on line 33

I have read the forums and cannot find that anyone else is having the same issue, So I am sure that it is something that I am doing wrong. Could someone have a look and point me in the right direction? Is it a configuration problem I have with the php.ini??

Below I have pasted the code for each program
Thanks for having a look

Robert

here is my code for login.php

<?php
session_unset();
?>
<html>
<head>
<title>Please Log In</title>
</head>
<body>
<form method="post" action="http://localhost/movie1.php">
    <p>Enter your 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>

here is the code for movie1.php

<?php
    session_start();
    $_SESSION['username']=$_POST['user'];
    $_SESSION['userpass']=$_POST['pass'];
    $_SESSION['authuser']=0;
    //Check username and password information
        if (($_SESSION['username'] == 'Joe') AND
                ($_SESSION['userpass'] == '12345'))
         {
         $_SESSION['authuser']=1;
         }
         else
         {
         echo "Sorry, but you don't have permission to view this page, you loser!";
    ` exit();
        }

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

here is my code for 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 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;
    echo "<br />";
?>
</body>
</html>



  #2 (permalink)  
Old August 1st, 2004, 05:00 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:Originally posted by ojthecat


......

 echo "Sorry, but you don't have permission to view this page, you loser!";
    ` exit();

....
Remove the 'tick' on the last line.
  #3 (permalink)  
Old August 2nd, 2004, 04:48 PM
Registered User
 
Join Date: Jul 2004
Location: Houston, TX, USA.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks, It is very humbling to miss something like that.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with code on Chapter 14 aargyri BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 3 June 6th, 2006 03:37 PM
Problem with code from chapter 16 earlsinclair2001 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 1 December 5th, 2005 01:58 AM
Chapter 12 Code Behind Problem locknload7 BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 1 March 30th, 2005 10:34 AM





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