<?php
echo "<font size=3 face='$fonttype' color='$fontcolour'><center>";
echo "<font size=6>View Headline Ads</font><br>";
echo "<font size=1>(Members cannot see thier own Headline Ads)</font><br><br>";

$queryclicked="select * from headlineads_clicks where blid='".$aid."'";
$resultclicked = mysql_query($queryclicked);

$queryexclude="select * from headlineads where";

while ($lineclicked = mysql_fetch_array($resultclicked)) {

$bannerid = $lineclicked["bannerid"];
$queryexclude.= " id<>".$bannerid." and";

}
$queryexclude.= " userid!='$userid' AND approved=1 and max>views ORDER BY RAND()";


$count=0;	
echo "";	
$sql = mysql_query($queryexclude);
if(@mysql_num_rows($sql)) {

echo "<font size=3 face='$fonttype' color='$fontcolour'><center>";
//echo "<p><font size=6>View Headline Ads</font><br><br>";
echo "<font size=3 color=red>Click The Links Below To Earn&nbsp;";

if ($memtype=="PRO") {
$earn = $proheadlineearn;
}
elseif ($memtype=="JV Member"){
$earn = $jvheadlineearn;
}
elseif ($memtype=="SUPER JV"){
$earn = $superjvheadlineearn;
}	

echo "$earn Points For Each Click</font><br><br>\n";


echo "<table cellpadding=5 width=\"600\" align=\"center\" bordercolor=#000000 border=1><tr>";

while($info = mysql_fetch_array($sql)) {

if($count==4) 
{

echo "</tr><tr>";
$count=0;
}
$count++;
mysql_query("update headlineads set views=views+1 where id='".$info['id']."'");

if($info['bold'])echo "<td bgcolor=\"".$info['bgcolor']."\" align=center><a href=\"./headlineclick1.php?id=".$info['id']."\" target=\"_blank\"><font color=\"".$info['color']."\"><b>".$info['title']."</b></font></a></td>";
else  echo "<td bgcolor=\"".$info['bgcolor']."\" align=center><a href=\"./headlineclick1.php?id=".$info['id']."\" target=\"_blank\"><font color=\"".$info['color']."\">".$info['title']."</font></a></td>";

}
echo "</tr></table><br><br>";
}
?>