View Full Version : PHP SID's
hamza84
December 23rd, 2003, 03:50 PM
Can anybody give me an example or a resource about this?
norie
December 23rd, 2003, 04:35 PM
http://www.free2code.net/tutorials/programming/php/4/phplogin.php
hamza84
December 23rd, 2003, 07:33 PM
well, thanks for the link, but thats not what I was looking for. I was looking for SID's that you use in links.
norie
December 23rd, 2003, 10:57 PM
well that gives you a good example of using session variables. What exactly do you want to use session variables for?
hamza84
December 23rd, 2003, 11:00 PM
I know how to work with session variables. I wanted to use session id's to keep track of a user surfing the website, for instance, how many times has that user viewed that page and so on.
ahmed
December 24th, 2003, 01:01 AM
you can do all the stuff you mentioned without having to worry about the session id's generated by php really..
hamza84
December 24th, 2003, 01:18 AM
and how would i do that....?
ahmed
December 24th, 2003, 01:32 AM
if you want to count unique hits on a certain page, or even a site, you could register a session variable that indicates whether it's the user's first visit to the page or not, and incrementing the counter based on that, therefore counting unique hits. Look at the code:
<?php
session_start();
if ( !isset( $_SESSION['visited'] ) ) // if the variable 'visited' has not been set
{
$_SESSION['visited'] = 1; // register the session variable 'visited'
/*
increment counter here, be it mysql, xml, flat file, etc..
*/
}
// ...Using that, you know you're adding 1 to the counter only once per user session :)
hamza84
December 24th, 2003, 01:37 AM
oh man, y couldn't i think of that!. Oh well, thanks a lot! I appreciate it
ahmed
December 24th, 2003, 02:05 AM
haha, simple ain't it :P
hamza84
December 24th, 2003, 01:10 PM
it sure was :)
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.