View Single Post
  #1 (permalink)  
Old July 3rd, 2004, 09:37 AM
Airidh Airidh is offline
Authorized User
Join Date: Jul 2004
Location: Isle of South Uist, Outer Hebrides, United Kingdom.
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default Ch 2 Page 53: Undefined index: authuser

Help! I am running under Windows 98,and PHP and Apache are installed on the E: partition of my first disk. When clicking on the link in movie1.php I get the following message:

Notice: Undefined index: authuser in e:\apache\apache\test\moviesite.php on line 4
Sorry, but you don't have permission to view this page

I have read all the posts that seemed relevant in the forum, including those pointed to by Richard York, but I still can't make it work. I've probably made a stupid mistake, but can't see it. Up to Page 51 everything has worked fine.


Here's the code:

<TITLE>Find my favourite movie!</TITLE>
   $myfavmovie=urlencode("Life of Brian");
    echo "<a href='http://localhost/moviesite.php?favmovie=$myfavmovie'>";
    echo "Click here to see information about my favourite movie!";
    echo "</a>"

// 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";
<TITLE>My Movie Site - <?php echo $_REQUEST['favmovie'] ?> </TITLE>
    echo "Welcome to our site";
    echo $_SESSION['username'];
    echo "! <br>";
    echo "My favourite movie is ";
     echo $_REQUEST['favmovie'];
     echo "<br>";
     echo "My movie rating for this movie is: ";
     echo $movierate;


So I commented out lines 4 - 8 of moviesite.php, and the message became:

Welcome to our site
Notice: Undefined index: username in e:\apache\apache\test\moviesite.php on line 17
My favourite movie is Life of Brian
My movie rating for this movie is: 5


Here is a selection of directives from C:\windows\php.ini:

error_reporting= E_ALL; display all errors, warnings and notices

The folder E:\PHP\tmp does exist (I created it) but contains nothing. It looks as if the variables are never stored by movie1.php, but I can't see what's wrong.

Any help will be appreciated! Thanks


Reply With Quote