query("UPDATE ".$wpdb->prefix."ad_buttons SET ad_active = 0 WHERE id = $ad_button"); } elseif($ad_button_action == 'activate') { $ol_flash = "Ad Button $ad_button has been activated."; $wpdb->query("UPDATE ".$wpdb->prefix."ad_buttons SET ad_active = 1 WHERE id = $ad_button"); } elseif($ad_button_action == 'delete') { $ol_flash = "Ad Button $ad_button has been deleted."; $wpdb->query("UPDATE ".$wpdb->prefix."ad_buttons SET ad_active = 2 WHERE id = $ad_button"); } elseif($ad_button_action == 'edit') { $ab_formfunc= 'edit'; $this_ad = $wpdb->get_row("SELECT * FROM ".$wpdb->prefix."ad_buttons WHERE id = $ad_button"); $ab_img = $this_ad->ad_picture; $ab_link = $this_ad->ad_link; $ab_txt = $this_ad->ad_text; $ab_strdat = $this_ad->ad_strdat; if($ab_strdat == '0000-00-00'){$ab_strdat = '';} $ab_enddat = $this_ad->ad_enddat; if($ab_enddat == '0000-00-00'){$ab_enddat = '';} $ab_views = $this_ad->ad_views; $ab_clicks = $this_ad->ad_clicks; $ab_countries = $this_ad->adg_count; $ab_csh = $this_ad->adg_show; $ab_pos = $this_ad->ad_pos; } $widget_adbuttons_cfg = array( 'ab_cfg1' => '' ); $widget_adbuttons_cfg = get_option('widget_adbuttons_cfg'); // check if the form has been submitted and validate input if(isset($_POST['ab_img']) || isset($_POST['ab_link']) || isset($_POST['ab_txt'])) { if (isset($_POST['ab_img'])) { $ab_img = $htp.str_replace($htp, "", $_POST['ab_img']); } if (isset($_POST['ab_link'])) { if(substr($_POST['ab_link'], 0, 7) == $htp){ $ab_link = $_POST['ab_link']; }elseif(substr($_POST['ab_link'], 0, 8) == $htps){ $ab_link = $_POST['ab_link']; }else{ $ab_link = $htp.$_POST['ab_link']; } } if (isset($_POST['ab_txt'])) { $ab_txt = $_POST['ab_txt']; } if (isset($_POST['ab_strdat'])) { $ab_strdat = $_POST['ab_strdat']; } if (isset($_POST['ab_enddat'])) { $ab_enddat = $_POST['ab_enddat']; } if (isset($_POST['ab_views'])) { $ab_views = $_POST['ab_views']; } if (isset($_POST['ab_clicks'])) { $ab_clicks = $_POST['ab_clicks']; } if (isset($_POST['ab_countries'])) { $ab_countries = $_POST['ab_countries']; } if (isset($_POST['ab_csh'])) { $ab_csh = $_POST['ab_csh']; } if (isset($_POST['ab_pos'])) { $ab_pos = $_POST['ab_pos']; } if($ab_img == $htp || $ab_img == ''){ $ab_img_err = 'Please fill in the link to your image file'; } if($ab_link == $htp || $ab_link == ''){ $ab_link_err = 'Please fill in the target link for your ad'; } if($ab_img_err == '' && $ab_link_err == ''){ if($ab_strdat == ''){$ab_strdat = '0000-00-00';} if($ab_enddat == ''){$ab_enddat = '0000-00-00';} // everything looks good, lets write to the database $table = $wpdb->prefix."ad_buttons"; if($ab_formfunc=='add'){ $wpdb->query("INSERT INTO $table(ad_picture, ad_link, ad_text, ad_active, ad_strdat, ad_enddat, ad_views, ad_clicks, adg_count, adg_show, ad_pos) VALUES('$ab_img', '$ab_link', '$ab_txt', 0, '$ab_strdat', '$ab_enddat', '$ab_views', '$ab_clicks', '$ab_countries', '$ab_csh', '$ab_pos')"); $ol_flash = 'Your Ad Button has been created!'; $ab_img = $htp; $ab_link = $htp; $ab_txt = ''; $ab_strdat = ''; $ab_enddat = ''; $ab_img_err = ''; $ab_link_err= ''; }elseif($ab_formfunc=='edit'){ $wpdb->query("UPDATE ".$wpdb->prefix."ad_buttons SET ad_picture = '$ab_img', ad_link = '$ab_link', ad_text = '$ab_txt', ad_strdat = '$ab_strdat', ad_enddat = '$ab_enddat', ad_views = '$ab_views', ad_clicks = '$ab_clicks', adg_count = '$ab_countries', adg_show = '$ab_csh', ad_pos = '$ab_pos' WHERE id = $ad_button"); $ol_flash = "Ad Button $ad_button has been updated."; } if($ab_strdat == '0000-00-00'){$ab_strdat = '';} if($ab_enddat == '0000-00-00'){$ab_enddat = '';} } } ?>

' . $ol_flash . '

'; ?>

Ad Buttons ad management

Edit Ad Button"; }else{ echo "

Create new Ad Button

";} ?>

'; ?> /* calendar icon */ img.tcalIcon { cursor: pointer; margin-left: 1px; vertical-align: middle; } /* calendar container element */ div#tcal { position: absolute; visibility: hidden; z-index: 100; width: 158px; padding: 2px 0 0 0; } /* all tables in calendar */ div#tcal table { width: 100%; border: 1px solid silver; border-collapse: collapse; background-color: white; } /* navigation table */ div#tcal table.ctrl { border-bottom: 0; } /* navigation buttons */ div#tcal table.ctrl td { width: 15px; height: 20px; } /* month year header */ div#tcal table.ctrl th { background-color: white; color: black; border: 0; } /* week days header */ div#tcal th { border: 1px solid silver; border-collapse: collapse; text-align: center; padding: 3px 0; font-family: tahoma, verdana, arial; font-size: 10px; background-color: gray; color: white; } /* date cells */ div#tcal td { border: 0; border-collapse: collapse; text-align: center; padding: 2px 0; font-family: tahoma, verdana, arial; font-size: 11px; width: 22px; cursor: pointer; } /* date highlight in case of conflicting settings order here determines the priority from least to most important */ div#tcal td.othermonth { color: silver; } div#tcal td.weekend { background-color: #ACD6F5; } div#tcal td.today { border: 1px solid red; } div#tcal td.selected { background-color: #FFB3BE; } /* iframe element used to suppress windowed controls in IE5/6 */ iframe#tcalIF { position: absolute; visibility: hidden; z-index: 98; border: 0; } /* transparent shadow */ div#tcalShade { position: absolute; visibility: hidden; z-index: 99; } div#tcalShade table { border: 0; border-collapse: collapse; width: 100%; } div#tcalShade table td { border: 0; border-collapse: collapse; padding: 0; } "; ?>
Ad Button Image \"$ab_txt\"";}?>
Ad Button Link
Ad Button Text
Scheduling
Start date:
End date:

yyyy-mm-dd format or leave empty for unlimited runtime
Ad position change the order of the ads, a higher number means the ad will move down in the list
Counters views
clicks
This only resets the views and clicks seen on this screen. Detailed view and click information is stored elsewhere. Viewing detailed statistics is being worked on and will be incorporated into a future release.
Geo targeting countries
show > hide >
Separate values with a comma
select 'show' to only show this ad to visitors from the listed countries or 'hide' to show the ad only to visitors from countries not listed.

" />

Scheduled Ad Buttons

get_results("SELECT * FROM ".$wpdb->prefix."ad_buttons WHERE ad_active = 1 AND ad_strdat > CURDATE() "); foreach($results as $result) { if($result->ad_views){ $ad_ctr = round((($result->ad_clicks / $result->ad_views) * 100 ), 2); } else { $ad_ctr = 0; } echo " "; } ?>
Ad ID Ad Button Ad Text Start Date End Date Action
$result->id ad_link\" target=\"_blank\" title=\"$result->ad_text\">ad_picture\" alt=\"$result->ad_text\" align=\"left\" vspace=\"10\" hspace=\"10\" border=\"0\"> $result->ad_text $result->ad_strdat $result->ad_enddat

Active Ad Buttons

get_results("SELECT * FROM ".$wpdb->prefix."ad_buttons WHERE ad_active = 1 AND ad_strdat <= CURDATE() AND ad_enddat >= CURDATE() OR ad_active = 1 AND ad_strdat <= CURDATE() AND ad_enddat = '0000-00-00'"); foreach($results as $result) { if($result->ad_views){ $ad_ctr = round((($result->ad_clicks / $result->ad_views) * 100 ), 2); } else { $ad_ctr = 0; } echo " "; } ?>
Ad ID Ad Button Ad Text Ad Views Ad Clicks CTR Action
$result->id ad_link\" target=\"_blank\" title=\"$result->ad_text\">ad_picture\" alt=\"$result->ad_text\" align=\"left\" vspace=\"10\" hspace=\"10\" border=\"0\"> $result->ad_text $result->ad_views $result->ad_clicks $ad_ctr%

Expired Ad Buttons

get_results("SELECT * FROM ".$wpdb->prefix."ad_buttons WHERE ad_active = 1 AND ad_enddat < CURDATE() AND ad_enddat <> '0000-00-00' "); foreach($results as $result) { if($result->ad_views){ $ad_ctr = round((($result->ad_clicks / $result->ad_views) * 100 ), 2); } else { $ad_ctr = 0; } echo " "; } ?>
Ad ID Ad Button Ad Text Start Date End Date Action
$result->id ad_link\" target=\"_blank\" title=\"$result->ad_text\">ad_picture\" alt=\"$result->ad_text\" align=\"left\" vspace=\"10\" hspace=\"10\" border=\"0\"> $result->ad_text $result->ad_strdat $result->ad_enddat

Inactive Ad Buttons

get_results("SELECT * FROM ".$wpdb->prefix."ad_buttons WHERE ad_active = 0"); foreach($results as $result) { if($result->ad_views){ $ad_ctr = round((($result->ad_clicks / $result->ad_views) * 100 ), 2); } else { $ad_ctr = 0; } echo " "; } ?>
Ad ID Ad Button Ad Text Ad Views Ad Clicks CTR Action
$result->id ad_link\" target=\"_blank\" title=\"$result->ad_text\">ad_picture\" alt=\"$result->ad_text\" align=\"left\" vspace=\"10\" hspace=\"10\" border=\"0\"> $result->ad_text $result->ad_views $result->ad_clicks $ad_ctr%