$alert_output = $message->success_dialog('Add info saved. ' . $link->paint('grlx_ad_list')); } } if ($_POST && !$ad_id) { $data = array('title' => $title, 'code' => $code, 'date_created' => $db->NOW(), 'source_id' => '3'); $ad_id = $db->insert('ad_reference', $data); if ($ad_id > 0) { $alert_output = $message->success_dialog('Add created. ' . $link->paint('grlx_ad_list')); } } /***** * Display logic */ $link->preset('adsense_help'); if ($ad_id) { $ad_info = get_ad_info($ad_id, $db); $instruction_output = 'Edit your AdSense code, ' . $link->paint() . ', below.'; } else { $ad_info['title'] = 'New'; $instruction_output = 'Edit your AdSense code, ' . $link->paint() . ', below.'; } if ($ad_info) { $ad_output = <<<EOL <label for="title">Title (for your reference)</label> <input type="text" style="width:10rem" name="title" id="title" value="{$ad_info['title']}"/> <label for="code">AdSense Code</label> <textarea name="code" id="code" rows="10">{$ad_info['code']}</textarea> EOL; }
} } // Updates, ho! $db->where('id', $ad_id); $success = $db->update('ad_reference', $data); $link = new GrlxLink('grlx ad list'); if ($success == 1) { $alert = new GrlxAlert(); $alert_output = $alert->success_dialog('Ad info saved. Make changes below or ' . $link->paint() . '.'); } } /***** * Display logic */ if ($ad_id) { $promo_info = get_ad_info($ad_id, $db); } if ($ad_id && $msg == 'created') { $success_message = <<<EOL Ad created. <ul> \t<li>Make changes below</li> \t<li><a href="ad.list.php">Add this ad to a slot in your site’s template</a></li> \t<li><a href="ad.promo-create.php">Make another new ad</a></li> </ul> EOL; $alert_output .= $message->success_dialog($success_message); } // Got an image for this ad? Then get its size. We’ll use this // to override anything the database claims the image is.