so 1 ip can only click on ads 1 time
if the member already click ads your ad will crossed by brown lines,
otherwise if there are other members who login with the same IP with the previous members who have clicked your ad by previous members will look crossed with red lines
I've tried to edit it myself but found the problem
here sreenshot before an ad is clicked

after the ad is clicked i refresh my browser

but the ad become double. the brown line it mean i clicked and red line it mean IP IP has been used
But the 2nd ads I do not click but has also crossed
Here is my code
Code: Select all
<?php
$cats = array( "1" => "Arts & Entertainment",
"2" => "Business & Money",
"3" => "Computers & Internet",
"4" => "Health & Recreation",
"5" => "Reference & Education",
"6" => "Shopping & Spending",
"8" => "Travel & Accommodation",
"9" => "Charity & Nonprofit" );
foreach($cats as $k=>$v)
{
print '<table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr style="BACKGROUND-COLOR:#ffffff;">
<td width="70%" class="class2" background="images/back.jpg" style="BACKGROUND-COLOR: #2753f4; FONT-FAMILY: Verdana; FONT-SIZE: 13px; border:solid 1px #999999; padding: 3px;"><span style="margin-left: 3px;"><strong><font color="white">
'.$v.'</font></strong></span></td>
<td width="10%" background="images/back.jpg" style="FONT-FAMILY: Verdana;FONT-SIZE: 13px; BACKGROUND-COLOR: #2753f4; border:solid 1px #999999; border-left:none;"><span style="margin-left: 3px;"><strong><font color="white">Member</font></strong></span></td>
<td width="10%" background="images/back.jpg" style="FONT-FAMILY: Verdana;FONT-SIZE: 13px; BACKGROUND-COLOR: #2753f4; border:solid 1px #999999; border-left:none;"><span style="margin-left: 3px;"><strong><font color="white">Outside</font></strong></span></td>
<td width="10%" background="images/back.jpg" style="FONT-FAMILY: Verdana;FONT-SIZE: 13px; BACKGROUND-COLOR: #2753f4; border:solid 1px #999999; border-left:none;"><span style="margin-left: 3px;"><strong><font color="white">Total</font></strong></span></td>
</tr>';
$premium = ($loggedin == 1 and $r["account"]=="premium") ? "" : " AND premium=0";
$ads = mysql_query("SELECT COUNT(*) AS cnt FROM ads WHERE clicksleft>'0' AND active='1' AND cat='$k'".$premium);
$ads = mysql_fetch_array($ads);
$ads = $ads['cnt'];
if($ads == 0)
{
print '<tr>
<td colspan="4" class="class2" style="FONT-FAMILY: Verdana; FONT-SIZE: 11px; border:solid 1px #999999; border-top:none; padding: 4px;"><span style="margin-left: 3px;">
No Current Ads</span></td>
</tr>';}
else {
$premium = ($loggedin == 1 and $r["account"]=="premium") ? "" : " AND premium=0";
$quer = mysql_query("SELECT * FROM ads WHERE clicksleft>'0' AND active='1' AND cat='$k'".$premium);
while($ad = mysql_fetch_array($quer))
{
if($loggedin==1)
{
$checkvisit = mysql_query("SELECT COUNT(*) AS cnt FROM ad_clicks WHERE user='{$r['id']}' AND ad='{$ad['ad_id']}'") or die(mysql_error());
$checkvisit = mysql_fetch_array($checkvisit);
$checkvisit = $checkvisit["cnt"];
$laip = getRealip();
$ad_ip = mysql_query("SELECT ad_ip FROM ad_clicks WHERE ad_ip='$ad_ip'");
}
if($checkvisit > 0 and $loggedin ==1)
{
print '
<tr>
<td width="70%" class="class2" style="FONT-FAMILY: Verdana; FONT-SIZE: 11px; border:solid 1px #999999; border-top:none; padding: 4px;"><span style="margin-left: 3px; text-decoration:none; color: #787878;"><font color=#660000><strike>'.$ad['ad_description'].'</strike></font>
</span></td>
<td width="10%" style="FONT-FAMILY: Verdana;FONT-SIZE: 13px; border:solid 1px #999999; border-left:none; border-top:none;"><span style="margin-left: 3px;">
'.$ad['clicks'].'</span></td>
<td width="10%" style="FONT-FAMILY: Verdana;FONT-SIZE: 13px; border:solid 1px #999999; border-left:none; border-top:none;"><span style="margin-left: 3px;">
'.$ad['outside'].'</span></td>
<td width="10%" style="FONT-FAMILY: Verdana;FONT-SIZE: 13px; border:solid 1px #999999; border-left:none; border-top:none;"><span style="margin-left: 3px;">
'.($ad['outside']+$ad['clicks']).'</span></td>
</tr>';}
if($laip=$ad_ip and $loggedin ==1)
{
print '
<tr>
<td width="70%" class="class2" style="FONT-FAMILY: Verdana; FONT-SIZE: 11px; border:solid 1px #999999; border-top:none; padding: 4px;"><span style="margin-left: 3px; text-decoration:none; color: #787878;"><font color=red><strike>'.$ad['ad_description'].'</strike></font>
</span></td>
<td width="10%" style="FONT-FAMILY: Verdana;FONT-SIZE: 13px; border:solid 1px #999999; border-left:none; border-top:none;"><span style="margin-left: 3px;">
'.$ad['clicks'].'</span></td>
<td width="10%" style="FONT-FAMILY: Verdana;FONT-SIZE: 13px; border:solid 1px #999999; border-left:none; border-top:none;"><span style="margin-left: 3px;">
'.$ad['outside'].'</span></td>
<td width="10%" style="FONT-FAMILY: Verdana;FONT-SIZE: 13px; border:solid 1px #999999; border-left:none; border-top:none;"><span style="margin-left: 3px;">
'.($ad['outside']+$ad['clicks']).'</span></td>
</tr>';}
else {
print '
<tr>
<td width="70%" class="class2" style="FONT-FAMILY: Verdana; FONT-SIZE: 11px; border:solid 1px #999999; border-top:none; padding: 4px;"><span style="margin-left: 6px; text-decoration:none; color: #787878;"><div style="float:left;"><img src="images/design/rp2.png" width="20" height="23" border="0" /></div></span><div style="padding-top:6px; text-decoration:none; color: #787878;">
<a href=view.php?ad='.$ad['ad_id'].' target=_blank style="text-decoration:none; color: #3d4c00;">'.$ad['ad_description'].'</a>
</div></td>
<td width="10%" style="FONT-FAMILY: Verdana;FONT-SIZE: 13px; border:solid 1px #999999; border-left:none; border-top:none;"><span style="margin-left: 3px;">
'.$ad['clicks'].'</span></td>
<td width="10%" style="FONT-FAMILY: Verdana;FONT-SIZE: 13px; border:solid 1px #999999; border-left:none; border-top:none;"><span style="margin-left: 3px;">
'.$ad['outside'].'</span></td>
<td width="10%" style="FONT-FAMILY: Verdana;FONT-SIZE: 13px; border:solid 1px #999999; border-left:none; border-top:none;"><span style="margin-left: 3px;">
'.($ad['outside']+$ad['clicks']).'</span></td>
</tr>';}
}
}
print "</table><br />";
}
?>anyone can help me Please