function dosave() { $id = (int) $_POST['id']; $search = dhtmlspecialchars($_POST['search']); $search = str_replace(array('%', '_'), array('\\%', '\\_'), $search); $times = (int) $_POST['times']; if (empty($id)) { iCMS_DB::query("insert into `#iCMS@__search`(`search`,`times`,`addtime`) values ('{$search}','{$times}','" . time() . "')"); } else { iCMS_DB::query("update `#iCMS@__search` set `search`='{$search}',`times`='{$times}' where id='{$id}'"); } search_cache(); javascript::dialog('操作完成!', 'url:' . __SELF__ . '?mo=search'); }
} foreach ($_POST['search'] as $id => $value) { $value = str_replace(array('%', '_'), array('\\%', '\\_'), $value); $iCMS->db->query("update `#iCMS@__search` set `search`='{$value}',`times`='" . $_POST['times'][$id] . "' where `id`='{$id}'"); } search_cache(); _Header(); } if ($action == 'save') { $id = (int) $_POST['id']; $search = dhtmlspecialchars($_POST['search']); $search = str_replace(array('%', '_'), array('\\%', '\\_'), $search); $times = (int) $_POST['times']; if (empty($id)) { $iCMS->db->query("insert into `#iCMS@__search`(`search`,`times`,`addtime`) values ('{$search}','{$times}','" . time() . "')"); } else { $iCMS->db->query("update `#iCMS@__search` set `search`='{$search}',`times`='{$times}' where id='{$id}'"); } search_cache(); _Header(__SELF__ . '?do=search'); } break; default: $Admin->MP("menu_search"); $maxperpage = 20; $total = $iCMS->db->getValue("SELECT count(*) FROM `#iCMS@__search` order by id DESC"); page($total, $maxperpage, "个关键字"); $rs = $iCMS->db->getArray("SELECT * FROM `#iCMS@__search` order by id DESC LIMIT {$firstcount},{$maxperpage}"); $_count = count($rs); include iCMS_admincp_tpl('search'); }