Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Wrox Book Feedback A forum to submit feedback on Wrox books if other forums on P2P have been unable to address your book-specific needs. IF YOU ARE LOOKING FOR CODE DO NOT ASK "Where can I find the code for this book?" That question is answered here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Wrox Book Feedback 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 June 25th, 2003, 07:44 AM
Registered User
 
Join Date: Jun 2003
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Beginning PHP4

Hey guys I really like the book. I have learned the basics and continue to look back at it while studying other things. I have one problem. The code in the book is messed up. I try to use some of the examples and I get hordes of errors. I have downloaded the code from the website and it don't even work. If you want to know what I am working on now it is that Web Directory navigator in chapter 10. I have code just like the one I downloaded and it gives me a NOTICE:Undeclared Variable $action on page -- line ##. I don't like that at all.
Reply With Quote
  #2 (permalink)  
Old June 25th, 2003, 03:15 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 256
Thanks: 0
Thanked 0 Times in 0 Posts
Default

THe book was written before REgister_globals was switched off by default in modern PHP installations. Register_globals used to make POST and GET variables sent by a form (or just inseerted into the URL by server side scripts) available by default in the page that recieved them (the page declared as the 'action', of a form, if it was a form that sent them, for instance).

This is often sited as a security vulnerability, but in actual fact it simply led to some slightly careless coding which _in_ _turn_ could act as a security vulnerability. Register_globals has defaulted to 'off' in all versions since 4.1, as a result.

This emans that values passed in the header or URL are no longer available in the recieving page by default, but have, instead, to be directly referenced by pulling their vaules from either the $HTTP_POST_VARS and $HTTP_GET_VARS arrays, via a call such as:

$action = $HTTP_GET_VARS['action'];

Or (preferably, from the point of view of forwards-copatability) the so-called super-global arrays - namely the $_POST and %_GET arrays - i.e.:

$action = $_GET['action'];

(FWIW, this diirecvtly equates to the ASP way of invokng the Response iobject to pull out values from its querystring array - without any of the overhead of invoking an enntire object to do so.)

So, assuming, $action is GET'ed (got?) from the page that sent it (I hacven't a copy handy, I'm afraid, so I can't say), either of the variants above will work, if you insert them at sme stage before the first reference to the $action variable.

HTH
Daniel Walker
(Ex Wrox)
Reply With Quote
  #3 (permalink)  
Old June 25th, 2003, 03:40 PM
Registered User
 
Join Date: Jun 2003
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks man I really appreciate it...
Reply With Quote
  #4 (permalink)  
Old June 26th, 2003, 04:20 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 256
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Don't mention it. Hope you enjoy the book!

FWIW, sharp-eyed readers will notice that when I refer to the Response object of ASP in my reply, I actually mean the Request object :).

Quote:
quote:Originally posted by sethtrain
 Thanks man I really appreciate it...
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
Beginning PHP4 Nicholsen Beginning PHP 3 October 20th, 2006 07:59 PM
This book or Beginning PHP4? thegooner BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 4 May 21st, 2004 01:57 PM
Beginning PHP4 keithu1 Wrox Book Feedback 1 October 1st, 2003 07:05 AM
Beginning PHP4 register_globals=Off Cambo BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 3 August 30th, 2003 02:34 PM
Beginning php4 wjt11 All Other Wrox Books 0 June 12th, 2003 11:48 AM



All times are GMT -4. The time now is 04:49 PM.


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