//
you're reading...
Hacking / Counter Intelligence, Predictive Analytics, Source Code, Tips

Tracking Website Visitors Pt2: Returning Image From Database

/tracker/return_image.php

include("db.inc");

$user_agent = $_SERVER["HTTP_USER_AGENT"];
$remote_addr = $_SERVER["REMOTE_ADDR"];
$referer = $_SERVER["HTTP_REFERER"];
$language = $_SERVER["HTTP_ACCEPT_LANGUAGE"];
$timestamp = time();
$image_key = $_GET['id'];
$sql = "INSERT INTO tracker_hits (user_agent,remote_addr,http_referer,accept_language,timestamp, image_key ) VALUES ('$user_agent','$remote_addr','$referer','$language','".time()."', '$image_key ')";

mysql_query($sql, $con);

$sql = "SELECT image FROM tracker_images WHERE (image_key = '$image_key ')";

$result = mysql_query($sql) or die(mysql_error());  
$row = mysql_fetch_array($result);

header("Content-type: image/jpeg");
echo $row['image'];
mysql_close($con)

  1. Tracking Website Visitors Pt1: Masking Image Requests
  2. Tracking Website Visitors Pt2: Returning Image From Database
  3. Tracking Website Visitors Pt3: Returning Tracking Information
  4. Tracking Website Visitors Pt4: Uploading Image to MySql
  5. Tracking Website Visitors Pt5: Installation Script
Advertisements

About Pythorian

Exploration and Production oriented security consultant for securing IT infrastructures relating to natural resources.

Discussion

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: