info@php-adserver.de # # Mit dem Besitz dieses Programms werden diese # Hinweise anerkannt! # Wer diese Hinweise nicht anerkennt, muß # das Programm sofort löschen. # ################################################# # Adserver # require("connect.inc"); header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header ("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT"); header ("Cache-Control: no-cache, must-revalidate"); header ("Pragma: no-cache"); $time = time(); $date = getdate($time); $date_today = "$date[year].$date[mon].$date[mday]"; $thishour = "$date[hours]"; $adcount = 0; $sql = "select id, prio from $table_banner where (ads>0 or adklicks>0 or datum>='$date_today') and startzeit<='$thishour' and biszeit>='$thishour' and startdatum<='$date_today'"; $sql_id = mysql_query($sql); while($daten = @mysql_fetch_row($sql_id)) { if($prioritaet == 1) { for($priocount=0;$priocount < $daten[1];$priocount++) { $adcount++; $account[$adcount] = $daten[0]; } } else { $adcount++; $account[$adcount] = $daten[0]; } } if($adcount <= 0) { $account_normal = 1000; } if($group) { $sql = "select accounts from $table_groups where name='$group'"; $sql_id = mysql_query($sql); $group_accounts = mysql_fetch_row($sql_id); $group_list = split("\|",$group_accounts[0]); for($i=0;$i 0) { srand((double)microtime()*1000000); if($adcount != 1) { $zufall = rand(1,$adcount); } else { $zufall = 1; } $account_normal = $account[$zufall]; } } else { for($i=1;$i<=count($account);$i++) { if($account[$i] == $reqid) { $account_normal = $reqid; } } if($account_normal != $reqid) { $account_normal = 1000; } } $sql = "update $table_banner set ads=ads-1 where id=$account_normal"; mysql_query($sql); $sql = "select * from $table_accounts where id=$account_normal"; $sql_id = mysql_query($sql); $account = mysql_fetch_row($sql_id); $akt_time = mktime(0,0,0,$date[mon],$date[mday],$date[year]); if($account[14] < $akt_time) { $sql = "insert into $table_stats values ($account_normal,'$date_today',0,0)"; mysql_query($sql); $sql = "update $table_accounts set stats_date=$akt_time where id=$account_normal"; mysql_query($sql); } $sql = "update $table_stats set ads=ads+1 where id=$account_normal and datum='$date_today'"; mysql_query($sql); # Grafik Banner if($account[11] == "img") { if($refresh) { echo ""; } echo ""; echo "\"$account[13]\""; } # HTML-Banner elseif($account[11] == "html") { $account[12] = ereg_replace("%%TIME%%","$time",$account[12]); # Doubleclick # if(ereg("%%IFRAME%%",$account[12])) { $iframe_url = split("%%IFRAME%%",$account[12]); $datei = fopen("$iframe_url[1]","r"); $iframe_banner = ""; while (!feof($datei)) { $iframe_banner .= fgets($datei,1000); } fclose($datei); $iframe_banner = ereg_replace("","",$iframe_banner); $iframe_banner = ereg_replace("","",$iframe_banner); $account[12] = $iframe_banner; } $account[12] = ereg_replace(""; } echo "$account[12]"; } mysql_close(); ?>