miki754
11-18-2010, 12:51 AM
Hi all, I really need help on this script.
I am trying to add code if statement, so when people click/hit for 2nd time from the same ip address, the hit/click will not add 1.
Here is my IP location code
<?
$ip=$_SERVER['REMOTE_ADDR'];
echo "<b>IP Address= $ip</b>";
?>How to combine that code in the script below, could anyone help please ?
<?
$referrer_hit_count = 0;
if(isset($stats['referrer'])){
asort($stats['referrer']);
foreach($stats['referrer'] as $referrer => $hits){
$isreal = true;
if($referrer == '') {
$isreal = false;
$referrer = 'Direct / IM / Air Apps etc';
}
echo('<tr><td>');
if($isreal){
echo('<a href="'.$referrer.'" target="_blank">');
}
echo($referrer . '</td><td class="value">' . $hits . ' (' . number_format(100 * $hits / $link->hits, 1) . '%)</td></tr>');
if($isreal){
echo('</a>');
}
$referrer_hit_count += $hits;
}
}
$unknown_hits = $link->hits - $referrer_hit_count;
if($unknown_hits > 0){
echo('<tr><td>Unknown</td><td>' . $unknown_hits . ' (' . number_format(100 * $unknown_hits / $link->hits, 1) . '%)</td></tr>');
}
?>
I am trying to add code if statement, so when people click/hit for 2nd time from the same ip address, the hit/click will not add 1.
Here is my IP location code
<?
$ip=$_SERVER['REMOTE_ADDR'];
echo "<b>IP Address= $ip</b>";
?>How to combine that code in the script below, could anyone help please ?
<?
$referrer_hit_count = 0;
if(isset($stats['referrer'])){
asort($stats['referrer']);
foreach($stats['referrer'] as $referrer => $hits){
$isreal = true;
if($referrer == '') {
$isreal = false;
$referrer = 'Direct / IM / Air Apps etc';
}
echo('<tr><td>');
if($isreal){
echo('<a href="'.$referrer.'" target="_blank">');
}
echo($referrer . '</td><td class="value">' . $hits . ' (' . number_format(100 * $hits / $link->hits, 1) . '%)</td></tr>');
if($isreal){
echo('</a>');
}
$referrer_hit_count += $hits;
}
}
$unknown_hits = $link->hits - $referrer_hit_count;
if($unknown_hits > 0){
echo('<tr><td>Unknown</td><td>' . $unknown_hits . ' (' . number_format(100 * $unknown_hits / $link->hits, 1) . '%)</td></tr>');
}
?>