Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old June 25th, 2003, 07:44 AM
Registered User
 
Join Date: Jun 2003
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
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
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
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





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





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