best practices in naming session variables

I was used to naming my session variables the "normal" way, kinda like when I want to keep track of user details, I name them:

  • $_SESSION['username']
  • $_SESSION['email']
  • $_SESSION['id']

I am worried that they may be in conflict with other session data when I am browsing sites in the same browser, or will there not be any conflict at all(once I tried to simultaneously run two of my projects with the same session variables, residing in the same server, and obviously, things got real messy).

Answers


All of the session data is stored on the server. All the browser has is a cookie that references the session on the server. There can't be naming conflicts for this reason, and also because Cookies naming scope is domain based.


Need Your Help

text form field, date column in db?

ruby-on-rails

The code below is taken from Ryan Bates' revised episode on making calendars in Rails apps. http://railscasts.com/episodes/213-calendars-revised?view=asciicast If you're not familiar with his episode

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.