Re: Apache/mod_rewrite for User Tracking

From: Date: Fri, 16 Feb 2001 00:06:41 +0000
Subject: Re: Apache/mod_rewrite for User Tracking
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-40027@lists.php.net to get a copy of this message
> I'm not sure how off-topic this may be, but I'll carry on anyway... 'Sokay, I'll force it back on-topic :-) > sent back to the page. Before now, I have cookies and IP address for user > tracking. If someone could accept a cookie (I used a self-referring script to Use PHP4's builtin session support. Save your hair. It will use cookies for users that accept cookies, and munge your URLs and FORMs automagically for users that don't accept cookies. > With IP addresses, you can't record return visits, so it just tracks one visit. > With some ISP's they seam to use variying IP addresses, so then each page Yes. Large ISPs shuffle client IP's addresses regularly. Also, users behind firewalls/proxies will be sharing a single IP. You don't want to use IP for user identification. It doesn't work. It's also spoofable by hackers, or so the experts tell me. > What I would like to do now is track the user with the URL. When someone calls > the site, (ether through the front door, or sent back to get an ID), they are > given an ID like so: 'KjsiHdbEyu8G645Dus96Sy54GD'. They are then sent to say, > http://localhost/KjsiHdbEyu8G645Dus96Sy54GD/home. > > Using mod_rewrite, I can then get the tracking var (KjsiHdbEyu8G645Dus96Sy54GD), > and rewrite the URL to http://localhost/home, and call the > script. I know this > is possible. Something like /^\/([a-zA-Z0-9]{80})\/(.*)/$1?$2/ could work for > the rewrite rule, but rather than use $HTTP_SERVER_VARS["QUERY_STRING"] to get > the var, as I use a GET vars for some functions, could I get a var which is sent > to Apache, and then PHP accesses the var from there, and the rest is as normal? Use http://localhost/home/KjsiHdbEyu8G645Dus96Sy54GD/ instead. (IE, swap the userid/file to file/userid) Throw <?php phpinfo();?> in "home", and you'll see at least one variable you can tear apart with Regex (or explode, even easier) to get the userid. -- Visit the Zend Store at http://www.zend.com/store/ Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm

« previous php.general (#40027) next »