PDA

View Full Version : Get -vs- Post


Justin
02-16-1999, 01:54 AM
I don't fully understand the difference, other than GET is shown in the URL and POST isn't, but with PHP I just found a major difference.

On my site, I have a bug report submition form, using php3, and the major flaw was that every ' and " came out \' and \", respectively. I never knew that php also automatically converted POST variables as well, and I tried it and that fixes the slash thing. I only tried it because I didn't like passwords showing in the address bar on my beta testers page.

But here's what I don't get. At www.phorum.org/ (http://www.phorum.org/) there is a discussion board written in php3. I like it, but I tested the ' theory and it too adds a front slash. I'm assuming they use the GET method - is there any real reason to choose one over the other - eg, a reason they chose GET over POST more pressing than the slash thing?

Now that I found a way around the slash thing, I like php a LOT more. It seems quite powerful. My beta section has 3 pages - the entrance, where you type the password, the Bad Password page, and the goodies page, all in one file. That's awesome http://www.aota.net/ubb/biggrin.gif

I know that you should always use POST for larger amounts of data, like posting lots of text or uploading files, but what are the differences in the handling? In other words, why would you use GET at all if POST can use larger strings and doesn't have the slash limitation in php?

Actually, I do see only one advantage - you can easily link to a page with the string in the URL. Is that the only advantage to GET?


------------------
Justin Nelson, SFE Inc.
www.vdj.net (http://www.vdj.net)
-- I just don't GET it --

[This message has been edited by Justin (edited 02-16-99).]

Terra
02-16-1999, 02:18 AM
$str = "hippy\'hippy\'shake";

$str = stripslashes($str);

echo $str;
hippy'hippy'shake

--
Terra
--bippety, boppety, boo--
FutureQuest

Justin
02-16-1999, 02:51 AM
Cool. The POST method works, but that's nice to know. I already tried Perl's variation:

$Message =~ s/\//isg;

Of course, that didn't work. I'm going to read as much as I can about php. I like it, and I think it whips the heck out of asp - although I've never used that. But still.

Oh, I was wondering... is there a Win32 version?? I'm sure there is, and right now that's the only thing I can't test locally. Is there a Win32 version of sendmail too?

I guess I should just get my 486 together and throw Redhat on it, huh? That would be better, and I can just use the null modem to hook up. Only one monitor, though, but once it's set up I could telnet into it, I think.

Thanks, though. I'm going to hunt php3 for Win32...

Justin
02-16-1999, 04:41 AM
Hehe - this is too cool. I'm now running php3 with Apache. Took a while to get things going, but everything works except for mail(). There's no option to give it a username/password to log on to vdj.net's mail server. It does try to send mail, but that's it (server error).

But I don't need to send myself mail, really. I can now test Perl and PHP3 locally. I like http://www.aota.net/ubb/smile.gif

I'm telling you, without FQ, I would have never heard of php or tried to learn Perl. This place is awesome!

Now here's my next project, when I get some free time: a full blown php3 based bulletin board. Maybe. I'll give it a shot anyway http://www.aota.net/ubb/biggrin.gif

Thanks for all the help, Terra. I may do my whole site in php eventually, but I just redid it using SSI's again.

One last question: which is less resource intensive, php or shtml? Or is there any real difference?


------------------
Justin Nelson, SFE Inc.
http://www.vdj.net

Terra
02-16-1999, 04:56 AM
I'm telling you, without FQ, I would have never heard of php or tried to learn Perl.

You have touched upon FutureQuest's core intentions and design... http://www.aota.net/ubb/smile.gif

PHP3: slightly more overhead, but negligible considering the power and capability...

SSI: less overhead, but very limited in capability...

I would go for future design, as PHP3 gives you forward growth flexibility... SSI only offers so much...

The overhead will become a moot point after I get the Zend engine installed (not known when yet)... We will be using it, as I have a sneaky suspicion that I'm going to be offering Phorum for our 'Pre-Installed' message boards instead of the UBB...

FQuest is going through a TON of 'under-the-hood' changes, and PHP3/MySQL is becoming a very focal point to all that... That's why you haven't seen me on the forums much lately as I'm knee deep in upgrades/coding/admin projects...

--
Terra
--Was it for this, my life I sought?--
FutureQuest

Jacob Stetser
02-20-1999, 09:31 PM
Ooh. stripslashes() works wonders. No more of those UGLY \es in my way!

http://www.aota.net/ubb/smile.gif

Jake

hearts
02-20-1999, 10:24 PM
hey justin.. i hate this code. I have been wandering around reading.. maybe it is just going over my head, but I went to the php3 site, and every time a page would download, it was reloading itself... kinda annoying. is their PHP3 doing that? or is it all that java scripting they have on their site?

I just couldn't find a decent tutorial. I found a good "start" to one, but it was only one page, and then there was NO MORE. http://www.aota.net/ubb/frown.gif

SO.. how do ya get started learning something that just seems so annoying? and ya'll seem to like it?

-----

hearts
*gonna get something alcoholic to drink* hehehe

Justin
02-20-1999, 11:08 PM
About the page reloading - doesn't do that here. How do you have your cache set up in your browser? Everything loads instantly on mine. The stuff on the left doesn't even disappear when I click a link (IE is good for that - keeping what's the same from the last page without blinking).

PHP took me a while to get used to. It's similar to Perl, but different. I want to find a free C compiler to play around with too, so I can just get it over with. I think I have the basics down, so it should be a snap.

But PHP is basically like a very powerful JavaScript that is run on the server before the client gets it. 100% browser independant. I like that. Plus they can't view source http://www.aota.net/ubb/smile.gif

That makes learning harder, though. I learned HTML and JavaScript and CSS by viewing source.

I sent you an email, though, so hopefully that should help out. It's not too difficult once you grasp the basics of php, which are the same basic concepts as in C and Perl (and a million others, including JavaScript). The only language that's quite different is BASIC, which is my main programming language (slowly working my way away from it, though http://www.aota.net/ubb/smile.gif)

I also agree that their "Tutorial" sucks. I just did a LOT of trial and error. They assume you already know C inside and out, and I didn't. I still don't. But I'm learning fast.


------------------
Justin Nelson, SFE Inc.
http://www.vdj.net

hearts
02-20-1999, 11:51 PM
hey Justin...

I think perl is a nicer language.. I haven't written anything, but it seems to like me more than PHP .. hehehe.

I have no programming skills whatsoever. *really* I think I just end up guessing at a lot of what I do, and if it works, it is considered a miracle! http://www.aota.net/ubb/wink.gif

Maybe there will one day be a tutorial on this PHP that will be beneficial. Maybe it is just so new that everyone is so busy playing and experimenting with it?

Gonna print out your two long emails. Justin, thanks a bunch for the help. *hugs*

------

hearts

stan
03-01-1999, 12:56 AM
About reloading:

Some sites just want you to have the latest information (or show you yet another ad :-) ) and add some PHP code that generate headers that trigger all caches en proxies to discard the resulting HTML code as soon as you go to another page


header("Expires: Mon, 22 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT");
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Pragma: no-cache"); // HTTP/1.0


I use it to generate HTML from a MySQL database that changes a lot.
But it should not be used in other cases.

Stan


------------------
Stan P. van de Burgt stan@dmo.com (PGP 0x853296C5)
DMO, P.O. box 1248, 3500 BE, Utrecht, the Netherlands