Location redirect - is tracking possible?
<p>I was wondering if someone can help me, I have the following script that redirect users to an affiliate link when they click on a banner.</p>

<pre><code>&lt;?php
$targets = array(
'site1' =&gt; 'http://www.site1.com/',
'site2' =&gt; 'http://www.site2.com/',
'site3' =&gt; 'http://www.site3.com/',
'site4' =&gt; 'http://www.site4.com/', );
if (isset($targets[$_GET['id']])) {
header('Location: '.$targets[$_GET['id']]);
exit; } 
 ?&gt;
</code></pre>

<p>Is it possible to track when a user hits the banner telling me the referer site as well as the ip address of the person clicking on the banner.</p>

<blockquote>
  <p>hmmmm something like pixel tracking?</p>
</blockquote>

<p>I have tried to add an <code>iframe</code> that does the tracking but it creates an error</p>

<p>Hope it makes sense</p>

<p>Thanks!</p>

<p>This is more or less how I would have done it in asp</p>



<pre><code>   &lt;%

    var Command1 = Server.CreateObject ("ADODB.Command");
    Command1.ActiveConnection = MM_cs_stats_STRING;
    Command1.CommandText = "INSERT INTO stats.g_stats (g_stats_ip, g_stats_referer)  VALUES (?, ? ) ";
    Command1.Parameters.Append(Command1.CreateParameter("varg_stats_ip", 200, 1, 20, (String(Request.ServerVariables("REMOTE_ADDR")) != "undefined" &amp;&amp; String(Request.ServerVariables("REMOTE_ADDR")) != "") ? String(Request.ServerVariables("REMOTE_ADDR")) : String(Command1__varg_stats_ip)));
    Command1.Parameters.Append(Command1.CreateParameter("varg_stats_referer", 200, 1, 255, (String(Request.ServerVariables("HTTP_REFERER")) != "undefined" &amp;&amp; String(Request.ServerVariables("HTTP_REFERER")) != "") ? String(Request.ServerVariables("HTTP_REFERER")) : String(Command1__varg_stats_referer)));
    Command1.CommandType = 1;
    Command1.CommandTimeout = 0;
    Command1.Prepared = true;
    Command1.Execute();

    %&gt;
</code></pre>

<p>I am not sure how to do it in php - unfortunately for me the hosting is only supporting php</p>

<p>so I am more or less clueless on how to do it in php</p>

<p>I was thinking if I can somehow call a picture I can do it with pixel tracking in anoter asp page, on another server.</p>

<p>Hope this makes better sense</p>
