Hi, I'm looking to store some information when some one is traveling around on my site and I'm not sure how I would do this. Basically if some one comes to my site from a link like this: http://www.mysite.com/link.php?id=001 Code (markup): My site would keep track of the number "001" and I'd be able to grab this number and display it in specific pages of the website. I'd appreciate any help. Thanks!
if ($_SERVER['HTTP_REFERER']) { $link = $_SERVER['HTTP_REFERER']; $link = explode('id=', $link); $id = $link[1]; } PHP:
This the code below: <? session_start(); session_register('count'); $_SESSION[count]++; $msg = "<P>You've been here $_SESSION[count] times. Thanks!</p>"; ?> <HTML> <HEAD> <TITLE>Count Me!</TITLE> </HEAD> <BODY> <? echo "$msg"; ?> </BODY> </HTML> Save the file with the name countme.php. Hope your problem solved.
The short php tag is not enabled on all hosting environments (and sometimes can not be simply changed) - theirfore compatibility issues, furthermore rumours claim from PHP 6 short tags will be deprecated (see here).