"")) { $query .= " WHERE id = '$bid'"; }else if (isset($uid) && ($uid <> "") or (isset($zid) && ($zid <> ""))) { $query .= " WHERE "; if (isset($uid) && ($uid <> "")) { $query .= "uid = '$uid'"; } if (isset($uid) && ($uid <> "") && (isset($zid) && ($zid <> ""))) { $query .= " AND "; } if (isset($zid) && ($zid <> "")) { $query .= " zone = '$zid'"; } } $result = mysql_query($query) or die("Unable to get banner list"); while ($line = mysql_fetch_array($result)) { $bcount = $bcount + 1; $banners[$bcount] = $line; } while ($found <> true) { if ($fbcount == $bcount) { die("No more banners to display"); }else{ $dban = rand(1,$bcount); if (($banners[$dban]["dis_times"] > $banners[$dban]["dised_times"]) or ($banners[$dban]["dis_times"] == 0)) { $found = true; $banners[$dban]["dised_times"] += 1; $query = "UPDATE powerban SET dised_times=".$banners[$dban]["dised_times"]." WHERE id=".$banners[$dban]["id"]; $result = mysql_query($query) or die("Query failed"); if ($banners[$dban]["type"] == 1) { if ($banners[$dban]["dtype"] == 1) { echo "\n"; echo "\n"; echo "Banner Web-Link.it\n"; echo "\n"; echo "\n"; echo "\n"; echo " \n"; echo "".$banners[$dban]["alt"]."\n"; echo "\n"; }else if ($banners[$dban]["dtype"] == 2) { $fp = fopen ("pbmadmin20/tmp/bantemp.htm", "w"); fputs($fp,"".$banners[$dban]["alt"].""); fputs($fp,"".$banners[$dban]["alt"].""); fclose($fp); echo "\n"; } }else if($banners[$dban]["type"] == 2) { $swfdims = split('[x]',$banners[$dban]["url"]); print ""; print ""; print ""; print ""; print ""; } }else{ $found = false; $fbcount += 1; } } } include "pbmadmin20/close.inc.php"; ?>