Exemplo n.º 1
0
     $config = array();
     $config['ddate'] = $config['dweek'] = $config['dtime'] = '';
     if (is_array($ddate)) {
         $config['ddate'] = implode(',', $ddate);
     }
     if (is_array($dweek)) {
         $config['dweek'] = implode(',', $dweek);
     }
     if (is_array($dtime) && count($dtime) < 24) {
         $config['dtime'] = implode(',', $dtime);
     }
     $config = addslashes(serialize($config));
     if ($id) {
         $db->update("UPDATE pw_searchadvert SET " . s::sqlSingle(array('keyword' => $advert['keyword'], 'starttime' => $advert['starttime'], 'endtime' => $advert['endtime'], 'code' => $advert['code'], 'ifshow' => $advert['ifshow'], 'orderby' => $advert['orderby'], 'config' => $config)) . " WHERE id=" . pwEscape($id));
     } else {
         $db->update("INSERT INTO pw_searchadvert SET " . s::sqlSingle(array('keyword' => $advert['keyword'], 'starttime' => $advert['starttime'], 'endtime' => $advert['endtime'], 'code' => $advert['code'], 'ifshow' => $advert['ifshow'], 'orderby' => $advert['orderby'], 'config' => $config)));
         $id = $db->insert_id();
     }
     updatecache_search();
     adminmsg('operate_success', "{$basename}&action={$action}");
 } elseif ($job == 'del') {
     s::gp(array('selid', 'id'));
     if ($id) {
         $selid = array($id);
     }
     if (!($selid = checkselid($selid))) {
         //过滤
         adminmsg('operate_error', "{$basename}&action={$action}");
     }
     $db->update("DELETE FROM pw_searchadvert WHERE id IN ({$selid})");
     //已经过滤