Jump to content


Photo

Script help


  • Please log in to reply
2 replies to this topic

#1 colinhanke

colinhanke
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 25 June 2006 - 06:09 PM

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.

#2 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 25 June 2006 - 06:15 PM

<TITLE>My Movie Site - <?php echo $_REQUEST['favmovie'][!--coloro:red--][span style=\"color:red\"][!--/coloro--];[!--colorc--][/span][!--/colorc--] ?></TITLE>
Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)

#3 hitman6003

hitman6003
  • Members
  • PipPipPip
  • Advanced Member
  • 1,807 posts

Posted 25 June 2006 - 07:26 PM

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

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





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users