$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]));
case 'video': break; default: break; } $str .= "<input type='hidden' value='{$ad->id}' />"; return $str; } $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 generate_ad($valid_ads[$index]);