include 'Init.php'; @($g_kw = trim(urldecode($_GET['kw']))); @($g_p = trim($_GET['p'])); if (!isset($g_kw) || $g_kw == "") { header('Location: /'); } if (!is_numeric($g_p)) { $g_p = 1; } if ($g_p < 1) { $g_p = 1; } $g_p = floor($g_p); $t1 = microtime(true); OpenDB(); $kws = getKeyword($g_kw); $hashs = array(); if (strpos($kws, "|") !== false) { $kws_split = split("\\|", $kws); for ($a = 0; $a < count($kws_split); $a++) { if ($kws_split[$a] != "") { $result = RunDB("select hashs from search where keyword='" . $kws_split[$a] . "'"); if (mysql_num_rows($result) > 0) { $row = mysql_fetch_row($result); $row = $row[0]; if (strpos($row, "|") !== false) { $row_split = split("\\|", $row); for ($b = 0; $b < count($row_split); $b++) { array_push($hashs, $row_split[$b]); } } else {
* 获取下所有的关键词处理标记为竞价 */ $id = 0; /* 清空下所有的关键词 */ $beanstalk = new \Phalcon\Queue\Beanstalk(array("host" => "172.17.16.101", "port" => 11300)); while (1) { $conn = new Table("local"); $groupArr = $conn->findAll("select * from tianyunzi.baidu_group where id > '{$id}' order by id asc limit 100"); if (empty($groupArr)) { echo "所有的单元已经过完\n"; exit; } foreach ($groupArr as $value) { $id = $value["id"]; /* 获取当前单元下的所有关键词 */ $keywordArr = getKeyword($value["id"]); if (empty($keywordArr) || !isset($keywordArr["body"]["data"])) { echo "计划[" . $value["jihuaname"] . "],单元[" . $value["groupname"] . "],没有查到关键词\n"; continue; } foreach ($keywordArr["body"]["data"] as $value1) { /* 插入数据库 */ $insertArr = array("id" => $value1["keywordId"], "campaignId" => $value1["campaignId"], "adgroupId" => $value1["adgroupId"], "keyword" => $value1["keyword"], "pcDestinationUrl" => $value1["pcDestinationUrl"]); echo $insertArr["keyword"] . "\n"; writeBeans($insertArr["keyword"]); //file_put_contents("/tmp/keyword.log", $insertArr["keyword"] . "\n", FILE_APPEND); } } $conn->close(); } function writeBeans($id)
<th scope="col">IP</th> <th scope="col">회원여부</th> <th scope="col">접속경로</th> <th scope="col">브라우져</th> <th scope="col">키워드</th> <th scope="col">접속시간</th> <th scope="col"></th> </tr> </thead> <tbody> <?php $j = 0; while ($R = db_fetch_array($RCD)) { $j++; $_engine = getSearchEngine($R['referer']); $_outkey = getKeyword($R['referer']); $_browse = getBrowzer($R['agent']); $_domain = getDomain($R['referer']); $_mobile = isMobileConnect($R['agent']); ?> <tr class="rooptd<?php echo ++$i % 2; ?> "> <td class="check"><input type="checkbox" name="members[]" value="<?php echo $R['uid']; ?> " /></td> <td class="number"><?php echo $NUM - (($p - 1) * $recnum + $_recnum++);
exit; } if ($_SESSION['mylog' . $s]) { getDbUpdate($table['s_counter'], 'page=page+1', 'site=' . $s . " and date='" . $date['today'] . "'"); if ($_keyword && !strstr('[name][nic][id][term]', $where)) { $_INKEY = getDbData($table['s_inkey'], 'site=' . $s . " and date='" . $date['today'] . "' and keyword='" . $_keyword . "'", '*'); if ($_INKEY['uid']) { getDbUpdate($table['s_inkey'], 'hit=hit+1', 'uid=' . $_INKEY['uid']); } else { getDbInsert($table['s_inkey'], 'site,date,keyword,hit', "'" . $s . "','" . $date['today'] . "','" . $_keyword . "','1'"); } } } else { $_referer = $referer ? urldecode($referer) : $_SERVER['HTTP_REFERER']; $_sengine = getSearchEngine($_referer); $_outkeyw = getKeyword($_referer); $_browser = getBrowzer($g['agent']); $_QKEY = 'site,mbruid,ip,referer,agent,d_regis'; $_QVAL = "'" . $s . "','" . $my['uid'] . "','" . $g['ip'] . "','" . $_referer . "','" . $g['agent'] . "','" . $date['totime'] . "'"; getDbInsert($table['s_referer'], $_QKEY, $_QVAL); $_REFCNT = getDbRows($table['s_referer'], ''); if ($_REFCNT > 1000000) { $_REFOVER = getDbArray($table['s_referer'], '', '*', 'uid', 'asc', $_REFCNT - 1000000, 1); while ($_REFK = db_fetch_array($_REFOVER)) { getDbDelete($table['s_referer'], $_REFK['uid']); } } if ($_outkeyw) { $_OUTKEY = getDbData($table['s_outkey'], 'site=' . $s . " and date='" . $date['today'] . "' and keyword='" . $_outkeyw . "'", '*'); if ($_OUTKEY['uid']) { getDbUpdate($table['s_outkey'], $_sengine . '=' . $_sengine . '+1,total=total+1', 'uid=' . $_OUTKEY['uid']);
if ($HTTP_SESSION_VARS[MykimsLogIp] == $REMOTE_ADDR) { exit; } include '../conf/db_info.php'; include '../conf/db/' . $DB[kind] . '.php'; include '../admin/module/WebLog/engine.php'; $DB_CONNECT = isConnectDb($DB[host], $DB[user], $DB[pass]); $DB_USEMYDB = isSelecteDb($DB[name], $DB_CONNECT); $OsSet1 = array("Windows", "Linux", "Mac", "Irix", "Sunos", "Phone"); $BrSet1 = array("MSIE", "NETSCAPE", "OPERA", "GEC", "FIREFOX"); $today_date = date("Ymd"); $RFIP = $REMOTE_ADDR; $RFID = ''; $RFREFERER = $referer; $RFSEARCH = getDomain($referer); $RFKEYWORD = getKeyword($referer, $RFSEARCH); $RFOS = getOsName(); $RFLANG = getLanguage($HTTP_ACCEPT_LANGUAGE); $RFAGENT = getBrowserName(); $RFDATE = $today_date . date("His"); $CT_WEEK = date("w"); $CountSql = "INSERT INTO kimsmall7_referer "; $CountSql .= "(RF_IP,RF_ID,RF_REFERER,RF_SEARCH,RF_KEYWORD,RF_OS,RF_LANG,RF_AGENT,RF_DATE) VALUES "; $CountSql .= "('{$RFIP}','{$RFID}','{$RFREFERER}','{$RFSEARCH}','{$RFKEYWORD}','{$RFOS}','{$RFLANG}','{$RFAGENT}','{$RFDATE}')"; db_query($CountSql, $DB_CONNECT); $CT_EXIS = db_fetch_array(db_query("SELECT count(*) FROM kimsmall7_count WHERE CT_DATE='" . $today_date . "'", $DB_CONNECT)); if ($CT_EXIS[0]) { db_query("UPDATE kimsmall7_count SET CT_HIT=CT_HIT+1 WHERE CT_DATE='" . $today_date . "'", $DB_CONNECT); } else { db_query("INSERT INTO kimsmall7_count (CT_HIT,CT_DATE,CT_WEEKDAY) VALUES ('1','" . $today_date . "','" . $CT_WEEK . "')", $DB_CONNECT); }
header('Location: /'); } else { $row = mysql_fetch_row($result); $info_hash = $row[1]; $row[2] = format_date_utc($row[2]); $info_time = $row[2]; $info_name = $row[3]; $row[4] = format_date_utc($row[4]); $info_created = $row[4]; $row[5] = format_size($row[5]); $info_size = $row[5]; $info_files_num = $row[6]; $info_files_name = $row[7]; $row[8] = format_size($row[8]); $info_files_size = $row[8]; $info_keyword = getKeyword($info_name); if (strpos($info_keyword, "|") === false) { $info_keyword = ' <a target="_blank" href="s.php?kw=' . urlencode($info_keyword) . '">' . $info_keyword . '</a> ' . "\n"; } else { $info_keyword_split = split("\\|", $info_keyword); $info_keyword = ''; for ($a = 0; $a < count($info_keyword_split); $a++) { $info_keyword .= ' <a target="_blank" href="s.php?kw=' . urlencode($info_keyword_split[$a]) . '">' . $info_keyword_split[$a] . '</a>'; if ($a != count($info_keyword_split) - 1) { $info_keyword .= " \n"; } } } } CloseDB(); }
$req = "http://search.hatena.ne.jp/keyword"; //XMLデータ取得用リクエストURL生成 $req .= "?word=" . urlencode($word) . "&mode=rss2&ie=utf8&page=1"; $xml_string = file_get_contents($req, false, $proxy_context); $xml_obj = simplexml_load_string($xml_string); $keyword = get_object_vars($xml_obj); //$arrayData = array( "results" => $arrayData); //$fetchData = json_encode($arrayData); //$fetchData = array( "results" => $fetchData); return $keyword; } $words = htmlspecialchars($_GET["w"]); $words_array = explode(",", $words); $fetchData = array(); for ($i = 0; $i < count($words_array); $i++) { $keyword = getKeyword(true, $words_array[$i]); $fetchData += array($i => $keyword); } //整形してjson出力 $fetchData = array("results" => $fetchData); $fetchData = json_encode($fetchData); echo $fetchData; /** window.onload = function() { var request = new XmlRpcRequest("http://d.hatena.ne.jp/xmlrpc", "hatena.getSimilarWord"); request.addParam({wordlist:"Tokyo"}); var response = request.send(); alert(response.parseXML()); } **/ /**