Script Outputting Number

Simple, effective and easy to use script. In fact, to find out who is on site at the moment – impossible. But do not rush to close this article and a wide variety of swear words. There is a solution to this problem – to track who downloaded the pages for some time. This is what the script is engaged.

To identify a user uses his external / internal ip-address and data about the system. To start, create a file Fill in the name of the file online.php following content. Do not forget to read the comments: / / Number of minutes during which users are deemed to be 'online' $ time = 5, / / data area, the next line MUST pre-check = 0 ', FALSE); header (' Pragma: no-cache '); / / Defining internal and external ip-address $ ip 0 = $ _SERVER ' REMOTE_ADDR '; if (isset ($ _SERVER 'HTTP_X_FORWARDED_FOR')) $ ip 1 = $ _SERVER 'HTTP_X_FORWARDED_FOR'; else $ ip 1 =''; / / get the data browser $ browser = $ _SERVER 'HTTP_USER_AGENT'; / / Get hash of the user data $ user = md5 ($ ip 0. $ ip 1. $ browser); / / fasten to the hash of the last for 5 minutes.

Time can be changed in the file online.php. Connecting the script to the page: To integrate the script into your web site uses java-script. To insert the number of users – add to your page in the right place the following code: B result – in this space will be inserted digit for the number of users you can use code like this: As a result – in this space will be inserted figure and the word "user .." with the right ending.

Categories: General, Uncategorized