Jump to content

Archived

This topic is now archived and is closed to further replies.

colinhanke

Script help

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.

Share this post


Link to post
Share on other sites
<TITLE>My Movie Site - <?php echo $_REQUEST['favmovie'][!--coloro:red--][span style=\"color:red\"][!--/coloro--];[!--colorc--][/span][!--/colorc--] ?></TITLE>

Share this post


Link to post
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]

Share this post


Link to post
Share on other sites

×

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.