Counters Code

  Home arrow Counters Code arrow Client info logger
COUNTERS CODE

Client info logger
By: Codewalkers
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2002-01-18

    Table of Contents:

     
     

    SEARCH CODEWALKERS

    TOOLS YOU CAN USE

    advertisement
    Efficiently Logs referer, IP/Hostname, time, and browser type

    By : Simon Steed

    1st create ONE table (not four) as follows:-

    CREATE TABLE statinfo (
    browser text NOT NULL,
    date text NOT NULL,
    host text NOT NULL,
    referer text NOT NULL
    );

    Then in the php3 file use the following code to populate it.

    <?
    $connection = mysql_connect("localhost","login_name","password") or die ("Unable to connect to MySQL server.");
    $db = mysql_select_db(YOUR_DATABASE_NAME) or die ("Unable to select requested database");

    $browser = $HTTP_USER_AGENT;
    $date = date("F jS Y, h:iA");

    if ($REMOTE_HOST == "") {$host = $REMOTE_ADDR;}
    else {$host = $REMOTE_HOST;}

    if( empty( $HTTP_REFERER ) or '' == $HTTP_REFERER ) {$HTTP_REFERER = 'No Referer';}

    mysql_query ("INSERT INTO statinfo (browser, date, host, referer) VALUES ('$browser','$date','$host','$HTTP_REFERER' )");

    mysql_close($connection);
    ?>

    Works great. Any problems, contact me via http://www.xploiter.com/form.shtml

    Regards

    Simon Steed
    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

    More Counters Code Articles
    More By Codewalkers

    blog comments powered by Disqus

    COUNTERS CODE ARTICLES

    - TG Who's Online
    - Text Based Counter that formats output
    - Counter & visitor statistics
    - Server Uptime Statistics
    - Chris Dingman's Hit Tracker Script
    - Graph Maker Function
    - Simple userOnline class
    - Adv. Log file generator
    - Logwriter
    - time_left()
    - Basic Statistics
    - Easy Counter
    - countCodeLines
    - MySQL Counter
    - bandwidthmeter


    © 2003-2012 by Developer Shed. All rights reserved. DS Cluster 8 - Follow our Sitemap