pleek Posted October 26, 2007 Share Posted October 26, 2007 ok so im learning php and ive been following the code in the book im learning bye. but im havin a problem. The script username and password protects a page. The loggin script works fine after some debugging but when it loads the password protected page i get this error Parse error: parse error, unexpected T_IF in /homepages/10/d210379154/htdocs/dsc045748853/movie1.php on line 11 I fixed a few things that weren't the same as the book but i still get the same error. I don't know whats wrong so hopefully some one here can help me. Here is the script of the page that im getting the error. I marked line 11 with a comment <?php session_start(); //gets the username and password from form $_SESSION['username']=$_POST['user']; $_SESSION['userpass']=$_POST['pass']; $_SESSION['authuser']=0 //Check username and password information //this is line 11\/ 12 without the comment if (($_SESSION['username']== 'Pleek') AND ($_SESSION['userpass']== 'lucky1')) { $_SESSION['authuser']=1 } else { echo "You have not entered the correct username and password"; exit() } ?> <HTML> <HEAD> <TITLE>Movie</TITLE> <HEAD> <BODY> <?php $myfavmovie=urlencode("National Treasure"); echo "<a href="http://craigh.tlcrepair.net/movieset.php?favmovie=$myfavmovie'>" echo "Click here to see information about my favorite movie!"; echo "</a>"; ?> </BODY> </HTML> WHATS WRONG??? Quote Link to comment https://forums.phpfreaks.com/topic/74819-solved-php-code-help/ Share on other sites More sharing options...
PHP_PhREEEk Posted October 26, 2007 Share Posted October 26, 2007 Put a semi-colon after this line: $_SESSION['authuser']=1 like this $_SESSION['authuser']=1; PhREEEk Quote Link to comment https://forums.phpfreaks.com/topic/74819-solved-php-code-help/#findComment-378318 Share on other sites More sharing options...
PHP_PhREEEk Posted October 26, 2007 Share Posted October 26, 2007 Actually, you're missing a few other semi-colons too... $_SESSION['authuser']=0; echo "<a href="http://craigh.tlcrepair.net/movieset.php?favmovie=$myfavmovie'>"; PhREEEk Quote Link to comment https://forums.phpfreaks.com/topic/74819-solved-php-code-help/#findComment-378320 Share on other sites More sharing options...
MadTechie Posted October 26, 2007 Share Posted October 26, 2007 also echo "<a href="http://craigh.tlcrepair.net/movieset.php?favmovie=$myfavmovie'>" should be echo "<a href='http://craigh.tlcrepair.net/movieset.php?favmovie=$myfavmovie'>"; Quote Link to comment https://forums.phpfreaks.com/topic/74819-solved-php-code-help/#findComment-378323 Share on other sites More sharing options...
pleek Posted October 26, 2007 Author Share Posted October 26, 2007 Thanxs alot guys the scripted is now completely working and ready to be modified for my needs. I found two more error besides the ones you pointed out and i figured them out myself. Quote Link to comment https://forums.phpfreaks.com/topic/74819-solved-php-code-help/#findComment-378349 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.