i have a login form, which is in login.php. after authorization i moove client to some.php file! so, from following two methods, which is better?
id
e.t.c by GET
SESSION
- s for thiswhat is more preferred?
and two words about why i ask this question.
i hear somewhere that SESSION
s aren't good programing method, and it's not suggested to use them in such situations...
thanks
Sessions are indeed the preferred solution. You can't trust data sent in the querystring ($_GET, $_POST, $_COOKIE etc) because all of those can be changed by the user, but you can trust the that noone has tampered with the $_SESSION data since $_SESSION is stored on the server.
There's nothing inherently bad about sessions. In fact, in this situation I would store the userid in the session rather than passing it around in the URL. It'll be much cleaner, and more professional, IMHO. Storing trivial information in the session is fine.
$_SESSION
might have its flaws, but using $_GET
for this kind of thing is even worse.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With