Jump to content

Script help


colinhanke

Recommended Posts

I could use some help with this script error. When I try to open this page in my browser I get this error:

Parse error: parse error, unexpected $end in C:\Program Files\xampp\htdocs\moviesite.php on line 48

Here is the script: (//note: line 48 is the very last line which is simply </HTML>)

<?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 include "header.php"; ?>
<?php
$favmovies = array("Life of Brian","Stripes","Office Space","The Holy Grail",
"Matrix", "Terminator 2", "Star Wars", "Close Encounters of the Third Kind",
"Sixteen Candles", "Caddyshack");
if (ISSET($_REQUEST['favmovie'])) {
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;
}
else {
echo "My top ". $_POST["num"]. " movies are:<br>";
if (ISSET($_REQUEST['sorted'])) {
sort($favmovies);
}
//list the movies
$numlist = 1;
while ($numlist <= $_POST["num"]) {
echo $numlist;
echo ". ";
echo pos($favmovies);
next($favmovies);
echo "<br>\n";
$numlist = $numlist + 1;
}
?>
</BODY>
</HTML>



Any help would be much appreciated. Thanks.
Link to comment
Share on other sites

you are missing the closing curly brace on your while statement:

[code]<?php
$favmovies = array("Life of Brian","Stripes","Office Space","The Holy Grail",
"Matrix", "Terminator 2", "Star Wars", "Close Encounters of the Third Kind",
"Sixteen Candles", "Caddyshack");
if (isset($_REQUEST['favmovie'])) {
    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;
} else {
    echo "My top ". $_POST["num"]. " movies are:<br>";
    if (isset($_REQUEST['sorted'])) {
        sort($favmovies);
    }
    //list the movies
    $numlist = 1;
    while ($numlist <= $_POST["num"]) {
        echo $numlist;
        echo ". ";
        echo pos($favmovies);
        next($favmovies);
        echo "<br>\n";
        $numlist = $numlist + 1;
    } //this is the missing curly brace
}
?>
</BODY>
</HTML>[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.