Page 1 of 3

PHP Tips and Tricks

Posted: Sat Jul 04, 2009 2:20 pm
by mrmajic
Just wondering, whats the difference between passing variables via session and passing variables via post .. atleast with session, the variables are always global .. so wouldnt it be better to do it that way?

Re: PHP Tips and Tricks

Posted: Sat Jul 04, 2009 2:29 pm
by hallsofvallhalla
post is much more secure while session variables can be potentially dangerous to cheat

session variables in plain text can be sniffed. There are also programs out there that can take memory snapshots.

If you are making a game where you plan to have a host of different people playing then you are going to have some moron thinking he is a hacker and trying to cheat. There are ways to stop it, but I personally use post and get methods because they die after page is loaded. You can encrypt a get method also to scramble it when sending it through the URL.

Re: PHP Tips and Tricks

Posted: Sat Jul 04, 2009 11:56 pm
by Noctrine
Hmm I thought it was the other way around. I thought session was hidden, I can easily see post variables. Atleast on sending.

I thought session was stored on the server, with the end user getting a key that allows the server to auth them.

Re: PHP Tips and Tricks

Posted: Sun Jul 05, 2009 3:13 am
by hallsofvallhalla
just depends if you set it up with a key, how can you see post variables? not get...

Re: PHP Tips and Tricks

Posted: Sun Jul 05, 2009 3:41 am
by Noctrine
You can convert them to gets actually.

Re: PHP Tips and Tricks

Posted: Sun Jul 05, 2009 10:30 am
by mrmajic
so session or post is more secure???

Re: PHP Tips and Tricks

Posted: Sun Jul 05, 2009 12:37 pm
by Noctrine
I'd say session, depending on use. For example, login cookies are always session.

Re: PHP Tips and Tricks

Posted: Sun Jul 05, 2009 12:38 pm
by mrmajic
Noctrine wrote:I'd say session, depending on use. For example, login cookies are always session.
id say session too .. as the sessions are kept on the server ..

Re: PHP Tips and Tricks

Posted: Sun Jul 05, 2009 2:50 pm
by hallsofvallhalla
how would you convert a post to a get, please tell

Re: PHP Tips and Tricks

Posted: Sun Jul 05, 2009 6:37 pm
by hallsofvallhalla
thats what I thought, no way to get post variables that i know of, not form the "player side"