<?php include_once "../frame.php"; if (!is_ajax()) { die; } $db = get_db(); $ad = $db->query("select * from forbes_ad.fb_ad where code = '{$_POST['code']}'"); if (empty($ad)) { die; } insert_ad_record($ad[0], 'click');
$str2 .= "<img width='{$width}' border=0 src='{$ad->flash}' />"; $str2 .= "</a>"; $str2 .= "<input type='hidden' value='{$ad->id}' />"; $array = array("type" => "two", "content" => $str, "two" => $str2); default: break; } return $array; } $hour = getdate(); $hour = intval($hour['hours']); foreach ($ads as $ad) { $start_hour = intval($ad->start_hour); $end_hour = intval($ad->end_hour); if ($start_hour < $end_hour) { if ($hour < $start_hour || $hour > $end_hour) { continue; } } else { if ($start_hour > $end_hour) { if ($hour < $start_hour && $hour > $end_hour) { continue; } } } $valid_ads[] = $ad; } $len = count($valid_ads); $index = mt_rand(0, $len - 1); insert_ad_record($valid_ads[$index]); echo json_encode(generate_ad($valid_ads[$index]));