+ Reply to Thread
Results 1 to 5 of 5

Thread: Click out tracking ( PHP EXAMPLE )

  1. #1
    gptsven is offline x10 Lieutenant gptsven is an unknown quantity at this point
    Join Date
    Dec 2008
    Posts
    253

    Click out tracking ( PHP EXAMPLE )

    Heres an example to track what links get clicked on your website! ( simple script, needs php & mysql )


    You need this table :

    Code:
    DROP TABLE IF EXISTS `traffic_exploit`;
    CREATE TABLE `traffic_exploit` (
      `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
      `date` datetime DEFAULT NULL,
      `url` varchar(555) DEFAULT NULL,
      `referer` varchar(555) DEFAULT NULL,
      `ip` varchar(15) DEFAULT NULL,
      PRIMARY KEY (`id`)
    ) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
    its a table with an ID, a date ( when user clicked the link, can later be used to build graphical charts on date) url ( the clicked url, ) referer ( the referring url ) and ofcourse the IP.


    The tracking script : track.php
    PHP Code:
    <?php
    if (isset($_GET['url']))
    {
     
    mysql_connect("localhost","root","");
     
    mysql_selectdb("traffic****");
     
    $url mysql_escape_string($_GET['url']);
     
    $ip $_SERVER['REMOTE_ADDR'];
     
    $referer $_SERVER['HTTP_REFERER'];
     
    $query "INSERT INTO traffic_exploit (ip,date,url,referer)  VALUES ('$ip',now(),'$url','$referer')";
     
    mysql_query($query);
     
    header("location:$url");
    }
    ?>
    an url gets called like this :
    PHP Code:
    <a href="track.php?url=good-traffic-exchange-websites.php" target="_blank" style="color:#375468;">Good Traffic exchange sites</a
    this is the example for an inbound link, for outbound links use this :
    PHP Code:
    <a href="track.php?url=http%3A%2F%2Fwww.trafficexploit.co.cc" target="_blank" style="font-size:12px;color:blue;margin-left:0px;">traffic exploit</a
    Heres my example site using this script : http://www.trafficexploit.co.cc
    Last edited by gptsven; 03-14-2010 at 08:36 AM.

  2. #2
    bobololo is offline x10Hosting Member bobololo is an unknown quantity at this point
    Join Date
    Mar 2010
    Posts
    1

    Re: Click out tracking ( PHP EXAMPLE )

    No security to avoid MySQL injection ?

  3. #3
    gptsven is offline x10 Lieutenant gptsven is an unknown quantity at this point
    Join Date
    Dec 2008
    Posts
    253

    Re: Click out tracking ( PHP EXAMPLE )

    look better before commenting, its safe from sql injection

  4. #4
    lemon-tree's Avatar
    lemon-tree is offline x10 Minion lemon-tree has a spectacular aura about
    Join Date
    Nov 2007
    Posts
    1,420

    Re: Click out tracking ( PHP EXAMPLE )

    As a matter of fact, your script is wide open to injection through the unescaped referrer variable. Ideally, you should move this over to either PDO or MySQLi, as both offer better alternatives than the mysql_escape_string() function and also because the mysql driver is now twice outdated. Also MySQL offers a better alternative to storing the IP as a string with the INET_ATON() and INET_NTOA() functions.
    Last edited by lemon-tree; 08-25-2010 at 11:37 AM.

  5. #5
    darzamora is offline x10Hosting Member darzamora is an unknown quantity at this point
    Join Date
    Feb 2010
    Location
    Sheybu
    Posts
    57

    Re: Click out tracking ( PHP EXAMPLE )

    is this the same as a click-tracker?
    Free SEO Friendly Directory Submission | How To Make Money Online / Follow me on Twitter
    Register for a PayPal account and AlertPay to send and receive money.
    Register OnBux

+ Reply to Thread

Similar Threads

  1. Tracking script
    By Wizet in forum Scripts & 3rd Party Apps
    Replies: 15
    Last Post: 10-01-2008, 10:21 AM
  2. Google Analytics tracking code
    By Wizet in forum Scripts & 3rd Party Apps
    Replies: 1
    Last Post: 08-25-2008, 05:00 PM
  3. Bug-Tracking System
    By sclewin in forum Scripts & 3rd Party Apps
    Replies: 3
    Last Post: 08-17-2008, 12:33 AM
  4. Tracking one's posts
    By lionheart8 in forum Feedback and Suggestions
    Replies: 4
    Last Post: 10-21-2006, 10:47 AM
  5. Bug / Issue Tracking
    By Richard in forum Scripts & 3rd Party Apps
    Replies: 2
    Last Post: 03-11-2005, 11:14 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers