Banner Updated!
"; if (isset($_GET['action'])) { if( 0 == strcmp('new', $_GET['action'])) { $list = false; if (isset($_POST['save'])) { $table = $adMangler->adsTable; $data = array('width' => $_POST['width'],'height' => $_POST['height'],'active' => $_POST['active'],'approved' => $_POST['approved'],'type' => $_POST['type'],'code' => $_POST['code'],'href' => $_POST['href'],'advertiser' => $_POST['advertiser'],'base' => $_POST['base'],'src' => $_POST['src'],'pageassoc' => $_POST['pageassoc'],'pagex' => $_POST['pagex'],'position' => $_POST['position'],'posix' => $_POST['posix']); $format = array('%d','%d','%d','%d','%s','%s','%s','%s','%d','%s','%d','%d','%d','%d'); $wpdb->insert($table, $data, $format); $insert_id = $wpdb->insert_id; echo $message; $sql = "SELECT * FROM $adMangler->adsTable WHERE id=$insert_id"; $banner = $wpdb->get_row($sql); echo $adMangler->FormatAd($banner); // This is a bug fix to prevent duplicate ads being created $action = str_replace("new", "edit", $action); $action .= "&id=$insert_id"; } } else if (0 == strcmp('delete', $_GET['action']) && isset($_GET['id'])) { $sql = "DELETE FROM $adMangler->adsTable WHERE id=".intval($_GET['id']); $wpdb->query($sql); $list = true; } else if (0 == strcmp('edit', $_GET['action']) && isset($_GET['id'])) { $list = false; if (isset($_POST['save'])) { $table = $adMangler->adsTable; $data = array('width' => $_POST['width'],'height' => $_POST['height'],'active' => $_POST['active'],'approved' => $_POST['approved'],'type' => $_POST['type'],'code' => $_POST['code'],'href' => $_POST['href'],'advertiser' => $_POST['advertiser'],'base' => $_POST['base'],'src' => $_POST['src'],'pageassoc' => $_POST['pageassoc'],'pagex' => $_POST['pagex'],'position' => $_POST['position'],'posix' => $_POST['posix']); $format = array('%d','%d','%d','%d','%s','%s','%s','%s','%d','%s','%d','%d','%d','%d'); $where = array('id' => $_GET['id']); $where_format = array('%d'); $wpdb->update($table, $data, $where, $format, $where_format); echo $message; } } if (isset($_GET['id'])) { $sql = "SELECT * FROM $adMangler->adsTable WHERE id=".intval($_GET['id']); $banner = $wpdb->get_row($sql); echo $adMangler->FormatAd($banner); } } if (!$list): ?>| Action | Preview | Active | Approved | Base | Page ID | Page Exclusive | Position | Position Exclusive | Type | Size |
|---|---|---|---|---|---|---|---|---|---|---|
| Edit | Delete |
preview
FormatAd($result); ?>
|
active) ? "Yes" : "No"; ?> | approved) ? "Yes" : "No"; ?> | base) ? "Yes" : "No"; ?> | pageassoc; ?> | pagex) ? "Yes" : "No";; ?> | position; ?> | posix)? "Yes" : "No"; ?> | type; ?> | width; ?>xheight; ?> |