Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6
This is the forum to discuss the Wrox book Beginning PHP, Apache, MySQLWeb Development by Michael K. Glass, Yann Le Scouarnec, Elizabeth Naramore, Gary Mailer, Jeremy Stolz, Jason Gerner; ISBN: 9780764557446
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 31st, 2005, 03:12 AM
Registered User
 
Join Date: May 2005
Location: , Oregon, USA.
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default new need help displaying echo $SESSION['authuser']

im attemping to follow all of the examples in this book. my newest problem is in Chap.2 the section on passing through forms. the login page is working, the link, "<a href=’http://localhost/moviesite.php?favmovie=$myfavmovie’>”, is sending me to moviesite.php, but this page isn't showing the username on the first line

Welcome to our site, !

is all it will display and ofcourse it should be

Welcome to our site, Joe!

just wondering if anyone knows what might cause this (sorry i havent included the original code that i typed up its on my home computor and im at work)

thanks
Reply With Quote
  #2 (permalink)  
Old May 31st, 2005, 02:06 PM
Authorized User
 
Join Date: May 2005
Location: , , .
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Default

When you get home, can you post the code you have..

Also, check carefully your variable names as they are case sensitve...

Edit: can you also post back which page this is from?
Reply With Quote
  #3 (permalink)  
Old May 31st, 2005, 08:23 PM
Registered User
 
Join Date: May 2005
Location: , Oregon, USA.
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

this is moviesite.php and will be found on page 60-61 (i am using an older version of this book.)

<?php
session_start();
//check to see if user has loged on with valid password
    if ($_SESSION['authuser']==1) {
    die('Sorry, but you dont have permission to view this page!');
    }
?>
<html>
<head>
<title>My Movie Site - <?php echo $_REQUEST['favmovie'] ?></title>
</head>
<body>
<?php
    echo "Welcome to our site, ";
    echo $_SESSION['username'];
    echo "!<br>";
    echo "My favorite movie is ";
    echo $_REQUEST['favmovie'];
    echo "<br>";
    $movierate=5;
    echo "My rating for the movie is: ";
    echo $movierate;
?>
</body>
</html>

thanks again

Reply With Quote
  #4 (permalink)  
Old June 1st, 2005, 04:41 AM
Authorized User
 
Join Date: May 2005
Location: , , .
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok...

Alter this code:

<?php
session_start();
//check to see if user has loged on with valid password


to look like this, and post back with the extra output

<?php
session_start();
while(list($vt, $val) = each($_SESSION))
{
echo "$vt == > $val<br>";
}
echo "<br>";
//check to see if user has loged on with valid password

What this does is output the contents and keys of the $_SESSION superglobal so we can see what values are being passed to the script.
Reply With Quote
  #5 (permalink)  
Old June 1st, 2005, 04:45 AM
Registered User
 
Join Date: May 2005
Location: , Oregon, USA.
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i will do that and get back to you

Reply With Quote
  #6 (permalink)  
Old June 1st, 2005, 10:02 AM
Registered User
 
Join Date: May 2005
Location: , Oregon, USA.
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

all it seemed to do was add a blank line or two before the main text

Reply With Quote
  #7 (permalink)  
Old June 1st, 2005, 03:03 PM
Authorized User
 
Join Date: May 2005
Location: , , .
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Default

That would indicate that session info is not being passed at all.

Do you have any kind of cookie controls set on your browser? or any software that may be blocking them?

Reply With Quote
  #8 (permalink)  
Old June 1st, 2005, 05:49 PM
Registered User
 
Join Date: May 2005
Location: , Oregon, USA.
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

that a good question in the privacy tab under internet options i have it set to medium. im using the windows firewall (windows xp), what other software would block cookies?

Reply With Quote
  #9 (permalink)  
Old June 3rd, 2005, 12:34 PM
Authorized User
 
Join Date: May 2005
Location: , , .
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Zone alarmns pro does and I know that Norton Internet Suite has cookie control ...

One thing to try, try adding localhost and 127.0.0.1 to the sites list - set them to allow...

And then try running the script from http://127.0.0.1/moviesite.php?favmovie=$myfavmovie

Reply With Quote
  #10 (permalink)  
Old June 8th, 2005, 10:40 PM
Registered User
 
Join Date: May 2005
Location: , Oregon, USA.
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

dbdave i really wanted to thank you for you help i got it to work

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
search data echo urbanaccess Access 7 January 23rd, 2007 10:54 AM
I need a echo wizard Anne1 PHP How-To 1 December 16th, 2006 04:20 AM
echo "\n" problem jun99 PHP How-To 4 November 29th, 2005 01:01 PM
echo "\n" problem jun99 Beginning PHP 0 November 27th, 2005 05:12 PM
Ch 2 Page 53: Undefined index: authuser Airidh BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 25 February 22nd, 2005 07:34 PM



All times are GMT -4. The time now is 02:10 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.