PHP Tips and Tricks

C++, C#, Java, PHP, ect...
mrmajic
Posts: 117
Joined: Sat Jun 27, 2009 9:37 am

PHP Tips and Tricks

Post 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?
Mr Majic...

Current Project: http://www.deltarealm.net
feedback welcome.
User avatar
hallsofvallhalla
Site Admin
Posts: 12023
Joined: Wed Apr 22, 2009 11:29 pm

Re: PHP Tips and Tricks

Post 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.
User avatar
Noctrine
Posts: 928
Joined: Thu Apr 23, 2009 9:57 pm

Re: PHP Tips and Tricks

Post 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.
Jesse Dorsey
ProjectANI - Lead Developer Person
http://about.me/jessedorsey
User avatar
hallsofvallhalla
Site Admin
Posts: 12023
Joined: Wed Apr 22, 2009 11:29 pm

Re: PHP Tips and Tricks

Post by hallsofvallhalla »

just depends if you set it up with a key, how can you see post variables? not get...
User avatar
Noctrine
Posts: 928
Joined: Thu Apr 23, 2009 9:57 pm

Re: PHP Tips and Tricks

Post by Noctrine »

You can convert them to gets actually.
Jesse Dorsey
ProjectANI - Lead Developer Person
http://about.me/jessedorsey
mrmajic
Posts: 117
Joined: Sat Jun 27, 2009 9:37 am

Re: PHP Tips and Tricks

Post by mrmajic »

so session or post is more secure???
Mr Majic...

Current Project: http://www.deltarealm.net
feedback welcome.
User avatar
Noctrine
Posts: 928
Joined: Thu Apr 23, 2009 9:57 pm

Re: PHP Tips and Tricks

Post by Noctrine »

I'd say session, depending on use. For example, login cookies are always session.
Jesse Dorsey
ProjectANI - Lead Developer Person
http://about.me/jessedorsey
mrmajic
Posts: 117
Joined: Sat Jun 27, 2009 9:37 am

Re: PHP Tips and Tricks

Post 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 ..
Mr Majic...

Current Project: http://www.deltarealm.net
feedback welcome.
User avatar
hallsofvallhalla
Site Admin
Posts: 12023
Joined: Wed Apr 22, 2009 11:29 pm

Re: PHP Tips and Tricks

Post by hallsofvallhalla »

how would you convert a post to a get, please tell
User avatar
hallsofvallhalla
Site Admin
Posts: 12023
Joined: Wed Apr 22, 2009 11:29 pm

Re: PHP Tips and Tricks

Post by hallsofvallhalla »

thats what I thought, no way to get post variables that i know of, not form the "player side"
Post Reply

Return to “Coding”