function wp125_task_check_ad_expiry() { global $wpdb; $adtable_name = $wpdb->prefix . "wp125_ads"; $ads = $wpdb->get_results("SELECT * FROM {$adtable_name} WHERE status = '1'"); if ($ads) { foreach ($ads as $key => $ad) { wp125_CheckAdDate($ad->end_date, $ad->id, $ad->pre_exp_email); } } }
function wp125_single_ad($theslot) { global $wpdb; if (!defined('ADLINK_EXTRA')) { define("ADLINK_EXTRA", ""); } $adtable_name = $wpdb->prefix . "wp125_ads"; $thead = $wpdb->get_row("SELECT * FROM {$adtable_name} WHERE slot = '{$theslot}' AND status = '1' ORDER BY id DESC", OBJECT); if ($thead) { wp125_CheckAdDate($thead->end_date, $thead->id, $thead->pre_exp_email); if ($thead->clicks != -1) { $linkurl = get_option('blogurl') . 'index.php?adclick=' . $thead->id; } else { $linkurl = $thead->target; } echo '<a href="' . $linkurl . '" title="' . $adguidearray[$curslot]['name'] . '" rel="nofollow"' . ADLINK_EXTRA . '><img src="' . $thead->image_url . '" alt="' . $thead->name . '" /></a>'; } else { echo '<a href="' . get_option("wp125_buyad_url") . '" rel="nofollow"><img src="' . get_option("wp125_defaultad") . '" alt="Your Ad Here" /></a>'; } }