WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
Internet Security Software
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : How to implement a session tracking system.
Categories : PHP, Sessions, Variables Update Picture
rasmus rasmus
Date : Apr 26th 1998
Grade : 3 of 5 (graded 2 times)
Viewed : 17532
File : No file for this code example.
Images : No Images for this code example.
Search : More code by rasmus rasmus
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

Yes, we get this question quite often. The problem here is that there are
many different ways to implement a session tracking system. Some people
use cookies. Others use a GET method argument added to each URL. Still
others use standard HTTP authentication, and you could also use hidden POST
method fields that you pass from page to page.

PHP provides all the tools to do any of these. Up to now we have left the
implementation up to the users.

For version 3.1 we are looking at ways to use shared memory somehow to
make it possible to have persistent variables in PHP, but overtop of that
you still need a session identifier so you know who is allowed to go and
fetch these persistent objects. Exact implementation is still up in the
air.

I think the two common method in use today is the simple cookie
session mechanism. Use the uniqid() PHP function to create a unique
session key and the use PHP's SetCookie() function to send this to the
remote browser. For example:

if(!isset($session)) {
$session = uniqid("sess");
SetCookie("session",$session); /* you may want more options here */
}

Now, the $session variable will be available on every page. You can back this
with a database and store information about each session there.

The alternative is to embed this $session variable in each link. Something
like: <a href="whatever.html?session=<?echo $session?>">Link</a>

Then again, $session will automatically be avilable on each page.



Simple PHP Form Auto Generation based on MySQL query
Categories : PHP, Form Processing, Databases, MySQL, Sessions
Dump the contents of a PHP variable in html format with a recursive list of subfolders and files from a given root directory.
Categories : PHP, Directories, Variables, Arrays
XDT Topsite (Gold v1.0)
Categories : Databases, CSS, PHP, HTML and PHP, Sessions
Working with files - return an array of files within a directory
Categories : PHP, Strings, Variables, Filesystem
CAPTCHA[Image verification]
Categories : PHP, Security, GD image library, Graphics, Sessions
SPL and ITERATOR : examples
Categories : PHP, Object Oriented, PHP Classes, Sessions
How to make sure a that $foo is from a cookie and not from the URI.
Categories : PHP, Variables, Global Variables, Cookies
Working with files - putting file contents to a string / var
Categories : PHP, Filesystem, Variables, Strings
Prevent multi submit
Categories : PHP, Sessions
Accessing GET and PUT variables with HTTP_GET_VARS on Win2K.
Categories : PHP, Windows 2000, Variables
Inline Scope Control - The inline class provides methods for creating and destroying local variable scopes. Simply put, local scopes are spaces where some or all of the global variables are temporarily hidden.
Categories : PHP, PHP Classes, Variables
A simple function to prevent undefined $_POST/$_GET/$_SESSION variable errors
Categories : PHP, Variables, Errors and Logging
Make old style (PHP3) scripts using GET, POST, COOKIE and File uploads (POST) compatible with PHP 4.2.0
Categories : PHP, HTML and PHP, Global Variables, Cookies, Variables
Functions to read a template file and fill in PHP variables. It will also fill in array variables, displaying parts of the template multiple times.
Categories : PHP, Variables, Filesystem
Session Validation Methods (Security Checks)
Categories : PHP, Sessions, Security