You are here: Is it safe to store user_id in Session? « PHP Programming Language « IT news, forums, messages
Is it safe to store user_id in Session?

Posted by pim on 10/06/30 12:00

Dear All,

What I was wondering is how safe it is to store user_id or username or
anything like that in session. I usualy store a bunch of info in a
session so I do not need to search the database all the time. However,
is it easy to change a value after being logged in?

For example:
- A user logs in
- Now set is: $_SESSION["user_id"] = 34;
- If he opens his "Profile page", the websites collects all personal
information from table users where user_id = 34

But according to this article:
http://www.governmentsecurity.org/archive/t13901.html

It is easy to change $_SESSION["user_id"] to for example 78.
So, that means that once you are logged in and change your own
user_id, you can see personal information from other users.


Is this really possible? If so, I can imagine I would use a temporary
table with temporary hashes where user_ids will be stored next to a
temporary hash. However, this is much more work and database traffic
which will slow down the system dramatically.

So... Is $_SESSION["user_id"] = 34 safe enough?

Kind regards,


Pim Zeekoers

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация