Re: Problems with PHP3 script - Missing Post reply data

From: Date: Fri, 30 Jun 2000 20:19:08 +0000
Subject: Re: Problems with PHP3 script - Missing Post reply data
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-4111@lists.php.net to get a copy of this message
Mike Gifford wrote: > > Hi Michael, > > Just to let you know, I fixed the problem by changing the form to GET > rather than POST the data. Still would be nice to figure out why POST isn't working -snip- > > Check how your browsers cache is set up? > > It was set to 0 You going to try setting that to some value and seeing it that makes a difference? > > > You know, this brings something up. I've read that (I guess) by default) > > (at least) Apache sends the result request to the browser in such a fashion > > that dynamically generated pages won't be cached. You have to do some magic > > with expires module or some such. Or does PHP handle this? > > No idea... I'd be interested in knowing though. As this page is > sitting on an Apache server. All I know is that you can configure Apache to load the expires module and then forcibly set an expiry on a gen'd web page. But don't know if there's a PHP specific cache command that can be used, or if PHP automatically may do that. -snip- > It should always be a number. It should be the number of lines of the > cardfile.txt+1 I believe. How do I make it so that it doesn't accept > "A" or other invalid strings in the form? Check the variable with some kind of regexs before you use it. And as with any user input, you should also make sure your not excepting any kind of wierd metacharacters. The easiest is to just specifying the characters you will except. In your case you should also limit the number to the range you exspect. Like: if (ereg([[:digit]]{1,3},$viewcard) {...} using PHP regex to match 1 to 3 digits if (preg(^\d{1,3}$, $viewcard) {...} using the Perl style. There's other variations. And the Perl regexs you may find faster and more powerful. You'll need to send a message back to the user asking for compliance, if necessary. There's still other considerations. You can use the trim() to whack off whitespace characters. And there are some functions to escape metacharacters. Just depends on your anticipated input. Basically, for user input, be familiar with the tools you can use to validate/filter it. -snip- Later, Mike D.

« previous php.general (#4111) next »