Esempio n. 1
0
function keyword($kw, $items, $moduleid)
{
    global $db, $DT_TIME, $DT;
    if (!$DT['search_kw'] || $items < 2 || strlen($kw) < 3 || strlen($kw) > 30 || strpos($kw, ' ') !== false || strpos($kw, '%') !== false) {
        return;
    }
    $kw = addslashes($kw);
    $r = $db->get_one("SELECT * FROM {$db->pre}keyword WHERE moduleid={$moduleid} AND word='{$kw}'");
    if ($r) {
        $items = $items > $r['items'] ? $items : $r['items'];
        $month_search = date('Y-m', $r['updatetime']) == date('Y-m', $DT_TIME) ? 'month_search+1' : '1';
        $week_search = date('W', $r['updatetime']) == date('W', $DT_TIME) ? 'week_search+1' : '1';
        $today_search = date('Y-m-d', $r['updatetime']) == date('Y-m-d', $DT_TIME) ? 'today_search+1' : '1';
        $db->query("UPDATE {$db->pre}keyword SET items='{$items}',updatetime='{$DT_TIME}',total_search=total_search+1,month_search={$month_search},week_search={$week_search},today_search={$today_search} WHERE itemid={$r['itemid']}");
    } else {
        $letter = gb2py($kw);
        $status = $DT['search_check_kw'] ? 2 : 3;
        $db->query("INSERT INTO {$db->pre}keyword (moduleid,word,keyword,letter,items,updatetime,total_search,month_search,week_search,today_search,status) VALUES ('{$moduleid}','{$kw}','{$kw}','{$letter}','{$items}','{$DT_TIME}','1','1','1','1','{$status}')");
    }
}
Esempio n. 2
0
function Recordkeyword($word_www_68ecshop_com, $items = 0, $searchengine = 'ecshop')
{
    if (strlen($word_www_68ecshop_com) < 3 || strlen($word_www_68ecshop_com) > 30 || strpos($word_www_68ecshop_com, ' ') !== false) {
        return;
    }
    $sql_www_68ecshop_com = "SELECT * FROM " . $GLOBALS['ecs']->table('keyword') . " WHERE searchengine='ecshop' AND word='{$word_www_68ecshop_com}'";
    $r = $GLOBALS['db']->getRow($sql_www_68ecshop_com);
    if ($r) {
        $items = intval($items);
        $month_search = date('Y-m', $r['updatetime']) == date('Y-m', gmtime()) ? 'month_search+1' : '1';
        $week_search = date('W', $r['updatetime']) == date('W', gmtime()) ? 'week_search+1' : '1';
        $today_search = date('Y-m-d', $r['updatetime']) == date('Y-m-d', gmtime()) ? 'today_search+1' : '1';
        $sql_www_68ecshop_com = "UPDATE " . $GLOBALS['ecs']->table('keyword') . " SET " . "items = '{$items}', " . "updatetime = '" . gmtime() . "', " . "total_search = total_search+1, " . "month_search = {$month_search}, " . "week_search = {$week_search}, " . "today_search = {$today_search} " . "WHERE w_id = '" . $r['w_id'] . "'";
        $GLOBALS['db']->query($sql_www_68ecshop_com);
        $w_id = $r['w_id'];
    } else {
        $letter_www_68ecshop_com = gb2py($word_www_68ecshop_com);
        $sql_www_68ecshop_com = "INSERT INTO " . $GLOBALS['ecs']->table('keyword') . " (searchengine, word, keyword, letter, items, updatetime, total_search, " . "month_search, week_search, today_search, status) " . " VALUES ('{$searchengine}', '{$word_www_68ecshop_com}', '{$word_www_68ecshop_com}', '{$letter_www_68ecshop_com}', '{$items}', '" . gmtime() . "', '1', '1', '1', '1', '1')";
        $GLOBALS['db']->query($sql_www_68ecshop_com);
        $w_id = $GLOBALS['db']->insert_id();
    }
    if (!empty($w_id)) {
        $ip_www_68ecshop_com = real_ip();
        $area_www_68ecshop_com = ecs_geoip($ip);
        $sql_www_68ecshop_com = 'INSERT INTO ' . $GLOBALS['ecs']->table('keyword_area') . ' ( ' . 'w_id, access_time, ip_address, area) VALUES (' . "'{$w_id}', '" . gmtime() . "', '{$ip_www_68ecshop_com}', '{$area_www_68ecshop_com}')";
        $GLOBALS['db']->query($sql_www_68ecshop_com);
    }
}
Esempio n. 3
0
 function letter($name)
 {
     return strtolower(substr(gb2py($name), 0, 1));
 }
Esempio n. 4
0
$MODULE[-7]['name'] = '报价';
$MODULE[-7]['linkurl'] = $MODULE[5]['linkurl'];
$MODULE[-9]['moduleid'] = -9;
$MODULE[-9]['name'] = '简历';
$MODULE[-9]['linkurl'] = $MODULE[9]['linkurl'];
$status = isset($status) ? intval($status) : 3;
$do = new keyword();
switch ($action) {
    case 'letter':
        if (!$word) {
            exit('');
        }
        if (strtoupper(DT_CHARSET) != 'UTF-8') {
            $word = convert($word, 'UTF-8', DT_CHARSET);
        }
        exit(gb2py($word));
        break;
    default:
        if ($submit) {
            $do->update($post);
            dmsg('更新成功', '?file=' . $file . '&status=' . $status);
        } else {
            $sorder = array('结果排序方式', '总搜索量降序', '总搜索量升序', '本月搜索降序', '本月搜索升序', '本周搜索降序', '本周搜索升序', '今日搜索降序', '今日搜索升序', '信息数量降序', '信息数量升序', '更新时间降序', '更新时间升序');
            $dorder = array('itemid DESC', 'total_search DESC', 'total_search ASC', 'month_search DESC', 'month_search ASC', 'week_search DESC', 'week_search ASC', 'today_search DESC', 'today_search ASC', 'items DESC', 'items ASC', 'updatetime DESC', 'updatetime ASC');
            isset($order) && isset($dorder[$order]) or $order = 0;
            $order_select = dselect($sorder, 'order', '', $order);
            $condition = "status={$status}";
            if ($keyword) {
                $condition .= " AND keyword LIKE '%{$keyword}%'";
            }
            if ($mid) {
Esempio n. 5
0
 function get_letter($catname, $letter = true)
 {
     return $letter ? strtolower(substr(gb2py($catname), 0, 1)) : str_replace(' ', '', gb2py($catname));
 }
Esempio n. 6
0
        $link[] = array('text' => $_LANG['back_list'], 'href' => 'keyword.php?act=list');
        sys_msg(sprintf($_LANG['drop_success'], $count), 0, $link);
    } else {
        $link[] = array('text' => $_LANG['back_list'], 'href' => 'keyword.php?act=list');
        sys_msg($_LANG['no_select_tag'], 0, $link);
    }
} elseif ($_REQUEST['act'] == 'edit_word') {
    $word = json_str_iconv(trim($_POST['val']));
    $id = intval($_POST['id']);
    if (!word_is_only($word, $id)) {
        make_json_error(sprintf($_LANG['tagword_exist'], $word));
    } else {
        if (EC_CHARSET != 'utf-8') {
            $word = ecs_iconv(EC_CHARSET, 'utf-8', $word);
        }
        $letter = gb2py($word);
        $sql = 'UPDATE ' . $ecs->table('keyword') . " SET word = '{$word}', letter = '{$letter}' WHERE w_id = '{$id}'";
        $db->query($sql);
        make_json_result(stripslashes($word), '', array('letter' => $letter, 'id' => $id));
    }
} elseif ($_REQUEST['act'] == 'edit_letter') {
    $val = json_str_iconv(trim($_POST['val']));
    $id = intval($_POST['id']);
    $sql = "UPDATE " . $ecs->table('keyword') . " SET letter = '{$val}' WHERE w_id = '{$id}'";
    $db->query($sql);
    make_json_result(stripslashes($val));
} elseif ($_REQUEST['act'] == 'edit_items') {
    $id = $_POST['id'];
    $val = json_str_iconv(trim($_POST['val']));
    /* 检查输入的值是否合法 */
    if (!preg_match("/^[0-9]+\$/", $val)) {