Permalink
Browse files

Creating the pixel link caller.

  • Loading branch information...
1 parent fa836fc commit 736d5fd72f9808ef74ecfdb295e793da9a240009 @geeksunny committed Apr 26, 2012
Showing with 56 additions and 0 deletions.
  1. +4 −0 pixel/.htaccess
  2. +52 −0 pixel/index.php
View
@@ -0,0 +1,4 @@
+RewriteEngine on
+RewriteCond %{REQUEST_FILENAME} !-f
+RewriteCond %{REQUEST_FILENAME} !-d
+RewriteRule ^(.*) index.php?id=$1 [L,QSA]
View
@@ -0,0 +1,52 @@
+<?php
+// Kill the script if no id is passed.
+if (!isset($_GET['id']) || $_GET['id'] == "")
+{
+ die();
+}
+
+require_once("../classes/class.mysql.php");
+$dbh = new dbh();
+include("../config/config.php");
+
+$link = $dbh->getRow("SELECT * FROM `".$dbh->prefix."pixels` WHERE `string`='".$_GET['id']."' AND `enabled`='1';");
+
+//if ($dbh->checkError(true) == false)
+if ($link != 0)
+{
+ // Insert the new record into the logs
+ $params = array();
+ $params['link_id'] = $link['id'];
+ $params['ip'] = $_SERVER['REMOTE_ADDR'];
+ $params['referer'] = $_SERVER['HTTP_REFERER'];
+ $params['datetime'] = date("Y-m-d H:i:s");
+
+ // Checks the GeoIP database if GeoIP is enabled.
+ if ($config['use_geoip'] == true)
+ {
+ require_once("../classes/class.geoip.php");
+ $geoip = new geoip($dbh);
+ $params['country'] = $geoip->checkIP($_SERVER['REMOTE_ADDR']);
+ }
+ else
+ $params['country'] = "" ;
+
+ $insertId = $dbh->insertRow("h4x_stats_pixel_log",$params);
+
+ // Check for errors
+ if ($dbh->checkError(true) == true)
+ {
+ //echo "error - could not log visit.";
+ }
+ else
+ {
+ //echo "success";
+ }
+}
+/*
+else
+{
+ echo "error - pixel does not exist.";
+}
+*/
+?>

0 comments on commit 736d5fd

Please sign in to comment.