Файл: wapxl.ru/adds3.php
Строк: 286
<?php
require 'shaxty.php';
function check_http_status($url)
{
$user_agent = 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_VERBOSE, false);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSLVERSION, 3);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$page = curl_exec($ch);
$err = curl_error($ch);
if (!empty($err))
return $err;
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
return $httpcode;
}
require_once 'shaxty/simple_html_dom.php';
$align = 'left';
$title = 'Каталог мобильных сайтов, белый каталог | Добавление сайта в каталог';
include_once ('shaxty/head.php');
if(core::$user['level']<9)func::errors('<b>Доступ закрыт</b>');
echo '<div class="content">';
if(!isset($_POST['site'])){
/*
$key = 'c30Qe9KLQCA1djVw5uL79rjueABjbNbb_0/1435510223/1733a1a79785261da10c1802ee056cce_aa329af11493ee2d19a38e4cb426a23e';
$retpath = 'http://yandex.ru/search?text=%D1%81%D0%BA%D0%B0%D1%87%D0%B0%D1%82%D1%8C+minecraft&p=1_68c3d22db217fcb7ad97633d12eb102c';
$rep = 'танцзал';
$retpath = html_entity_decode($retpath);
$retpath = urlencode($retpath);
$key = urlencode($key);
$curl = curl_init();
curl_setopt($curl, CURLOPT_COOKIESESSION, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
//curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_COOKIEJAR, '/import/cookies_yandex.txt');
curl_setopt($curl, CURLOPT_COOKIEFILE, '/import/cookies_yandex.txt');
curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.81 Safari/537.36');
curl_setopt($curl, CURLOPT_URL, 'http://yandex.ru/checkcaptcha?key='.$key.'&rep='.$rep.'&retpath='.$retpath);
$html = curl_exec($curl);
*/
/*$curl = curl_init();
curl_setopt($curl, CURLOPT_COOKIESESSION, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
//curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_COOKIEJAR, '/import/cookies_yandex.txt');
curl_setopt($curl, CURLOPT_COOKIEFILE, '/import/cookies_yandex.txt');
curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.81 Safari/537.36');
curl_setopt($curl, CURLOPT_URL, 'https://www.yandex.ru/search/?text=%D0%BF%D0%B0%D1%80%D1%81%D0%B8%D0%BD%D0%B3%20%D0%B8%D0%B7%20%D1%8F%D0%BD%D0%B4%D0%B5%D0%BA%D1%81%20%D0%BF%D0%BE%D0%B8%D1%81%D0%BA%D0%B0%20xml%20%D0%BD%D0%B0%20php&lr=39&clid=9582');
$html = curl_exec($curl);
echo $html;*/
/*$data = file_get_html('https://yandex.ru/search/xml?user=shaxty&key=03.100334990:d51a18138958b2185f5ee6ceb48c0cb6&query=%D0%B1%D0%B5%D1%81%D0%BF%D0%BB%D0%B0%D1%82%D0%BD%D1%8B%D0%B5+%D0%B7%D0%B0%D0%B3%D1%80%D1%83%D0%B7%D0%BA%D0%B8&groupby=attr%3Dd.mode%3Ddeep.groups-on-page%3D100.docs-in-group%3D3');
if($data->innertext!='' and count($data->find('domain'))){
foreach($data->find('domain') as $a){
echo $a->plaintext.'<br />';
}}*/
echo $_SESSION['wer'];
//echo urlencode('порно онлайн');
echo '<br /><form method="post" action="?">';
echo ' <b>Поисковой запрос :</b> <br />
<input type="text" name="site" size="100" value="'.$_SESSION['domain'].'"/><br />';
if(!isset($_SESSION['page'])) $_SESSION['page'] = 1;
echo ' <b>Страница поиска :</b> <br />
<input type="text" name="page" size="20" value="'.$_SESSION['page'].'"/><br />';
if(!isset($_SESSION['groups-on-page'])) $_SESSION['groups-on-page'] = 10;
echo ' <b>Количество сайтов на странице:</b> <br />
<input type="text" name="groups-on-page" size="20" value="'.$_SESSION['groups-on-page'].'"/><br />';
echo '<b>Версия сайта</b>:</b><br/>
<div class="xl"> <input type="radio" name="web" value="0"/>Для мобильных (WAP)</div>
<div class="xl"> <input type="radio" name="web" value="1" checked/>Для ПК (WEB)</div><dl></dl>';
echo '<b>Выберите категории, к которым относится ваш сайт:</b>' . (isset($_SESSION['cat_err']) ? '<br /><span style="color:#DD0000">'.$_SESSION['cat_err'].'</span>' : '') . '';
$k_post = core:: $db -> querySingle("SELECT count(*) FROM `categorii`;");
if ($k_post==0)echo 'Категорий нет<br />';
$r = core:: $db -> query("SELECT * FROM `categorii`;");
$i=0;
echo '<div class="scr">';
while ($raz= $r -> fetch()) {
if ( !preg_match("/[^0-9]/s", ($i/6)) )echo '<div style="display: table-cell;padding: 10px;">';
$i++;
if(@in_array($raz['id'], $_SESSION['cat'])) $checked[$raz['id']] = 'checked'; //checked
echo '<input style="padding: 2px;" type="checkbox" '.$checked[$raz['id']].' value="'.$raz['id'].'" name="cat[]"/>'.$raz['name'].' <br />';
if ( !preg_match("/[^0-9]/s", ($i/6)) )echo "</div>";
}
echo "</div>";
echo ' <input type="submit" value="Добавить сайты" />';
echo '</form>';
echo '</div>';
}else{
$_SESSION['domain'] = $_POST['site'];
$_SESSION['cat'] = $_POST['cat'];
$_SESSION['page'] = $_POST['page']+1;
$_SESSION['groups-on-page'] = $_POST['groups-on-page'];
$cats .= '|';
// формируем список категорий сайтов
foreach ($_POST['cat'] as $v) {
$cats .= func::checkin(intval($v)).'|';
}
$i=0;
$ok = 0;
$sitemap = '';
set_time_limit(0); // разграничиваем время работы скрипта
$data = file_get_html('https://yandex.ru/search/xml?user=shaxty&key=03.100334990:d51a18138958b2185f5ee6ceb48c0cb6&l10n=ru&query='.urlencode($_POST['site']).'&groupby=attr%3Dd.mode%3Ddeep.groups-on-page%3D'.$_POST['groups-on-page'].'.docs-in-group%3D3&page='.$_POST['page'].'');
if(count($data->find('domain')) == 0)exit() ;
if($data->innertext!='' and count($data->find('domain'))){
foreach($data->find('domain') as $a){
$a->plaintext = str_replace("https://","",$a->plaintext);
$a->plaintext = str_replace("http://","",$a->plaintext);
$a->plaintext = str_replace("www.","",$a->plaintext);
$t = $data->find("title", $i); // title из яндекса
//echo $t->plaintext.'<br />';
$e = $data->find("passages", $i); // описание из яндекса
//echo $e->plaintext.'<br />';
/*$answer = check_http_status('http://'.$a->plaintext);
if($answer!=200){
continue;
}*/
if (empty($a->plaintext)){
continue;
}
if (!preg_match('|^[0-9a-zA-Zа-яА-Я-.]+$|i', $a->plaintext)){
continue;
}
if (func::utf_strlen($a->plaintext) < 3){
continue;
}
$m= core::$db -> queryFetch("SELECT * FROM `sites` WHERE `url`=?;", array($a->plaintext));
if ($m != 0) {
continue;
}
$name = getTitle($a->plaintext);
$sites = getSite($a->plaintext);
$res['keywords'] = $sites[0];
$res['description'] = $sites[1];
$key = $sites[0];
$abaut = $sites[1];
$abaut = func::checkin($abaut);
$name = func::checkin($name);
$key = func::checkin($key);
if (func::utf_strlen(trim($abaut)) < 4){
$abaut = func::checkin($e->plaintext);
}
if (func::utf_strlen(trim($name)) < 4){
$name = func::checkin($t->plaintext);
}
if (func::utf_strlen($key) < 4){
$key = $_POST['site'];
}
//if ($err[$i]!='') {
$yandex = new SimpleXMLElement('http://bar-navig.yandex.ru/u?ver=2&show=32&url=http://'.$a->plaintext, NULL, TRUE);
$alexa = new SimpleXMLElement('http://data.alexa.com/data?cli=10&dat=snbamz&url='.$a->plaintext, NULL, TRUE);
if(isset($alexa->SD[1]->POPULARITY['TEXT']))
{
$alexaa = $alexa->SD[1]->POPULARITY['TEXT'];
}
else
{
$alexaa = 'no';
}
$seo = new Seo();
$res['url'] = $a->plaintext;
$res['google_pr'] = pr($a->plaintext);
$res['yandex_cy'] = $yandex->tcy['value'];
$res['yandex_rank'] = $yandex->tcy['rang'];
$res['alexa'] = $alexaa;
$res['google_index'] = $seo->google_index($a->plaintext);
$res['yandex_index'] = $seo->Yandex_Index($a->plaintext);
$res['bing_index'] = getBing($a->plaintext);
$res['yahoo_index'] = getYahoo($a->plaintext);
$res['google_link'] = $seo->google_links($a->plaintext);
$res['yandex_link'] = $seo->Yandex_Links($a->plaintext);
$res['bing_link'] = getBingLink($a->plaintext);
$res['yahoo_link'] = getYahooLink($a->plaintext);
$res['rambler_link'] = getBackRambler($a->plaintext);
$res['google_blog'] = $seo->google_blogs($a->plaintext);
$res['yandex_cat'] = yaca($a->plaintext);
$res['dmoz'] = getDmoz($a->plaintext);
$res['time'] = time();
$res['number'] = 1;
$web = func::checkin($_POST['web']);
if (func::utf_strlen(trim($name)) < 5){
continue;
}
if (func::utf_strlen(trim($key)) < 5){
continue;
}
if (func::utf_strlen(trim($abaut)) < 5){
continue;
}
$dbi = core::$db -> prepare("INSERT INTO `sites` SET `web`=?, `url`=?, `name`=?, `title`=?, `abaut`=?, `key`=?, `description`=?, `keywords`=?, `time_add`=?,`google_pr`=?,`yandex_cy`=?,`yandex_rank`=?,`alexa`=?,`google_index`=?,`yandex_index`=?,`bing_index`=?,`yahoo_index`=?,`google_link`=?,`yandex_link`=?,`bing_link`=?,`yahoo_link`=?,`rambler_link`=?,`google_blog`=?,`yandex_cat`=?,`dmoz`=?,`number`=?,`time`=?,`cat`=?,`user_id`=?");
$dbi -> execute($web,$a->plaintext,$name,func::checkin(getTitle($a->plaintext)),$abaut,$key,func::checkin($sites[1]),func::checkin($sites[0]),core::$realtime,$res['google_pr'],$res['yandex_cy'],$res['yandex_rank'],$res['alexa'],$res['google_index'],$res['yandex_index'],$res['bing_index'],$res['yahoo_index'],$res['google_link'],$res['yandex_link'],$res['bing_link'],$res['yahoo_link'],$res['rambler_link'],$res['google_blog'],$res['yandex_cat'],$res['dmoz'],$res['number'],core::$realtime,$cats,0);
$sitemap .= '<url>
<loc>http://wapxl.ru/cat/'.$a->plaintext.'</loc>
<changefreq>weekly</changefreq>
<priority>1.0</priority>
</url>';
$ok++;
/*
$wer .= $ok.' -<b> '.$a->plaintext.'</b> - <u>'.$name.' </u>- '.$abaut.' - OK<br />';
*/
/*}else{
$ok++;
$wer .= $ok.' -<b> '.$a->plaintext.'</b> - <u>'.$name.' </u>- '.$abaut.' - '.$err[$i].'<br />';
}*/
$i++;
}
//sleep(1);
}
$_SESSION['wer'] =$ok.'<br />из'.$i;
if($sitemap!=''){
// открываем карту
$file = H.'sitemap.xml';
$fil = file($file);
$fil = file($file);
$fp=fopen($file,"a+");
$total=count($fil);
if (!$total){ $total=''; }
for ($i=0; $i<$total; $i++){
if(($total-2)==$i){
flock ($fp,LOCK_EX);
ftruncate($fp,0);
for($i=0; $i<sizeof($fil); $i++){
if (($total-2)!=$i){
fputs($fp,$fil[$i]);
}else{
$bizname=$fil[$i]; fputs($fp,$bizname.$sitemap."rn");
}}
fflush ($fp); flock($fp,LOCK_UN);
fclose($fp);
}
}
}
//header('Location: /adds3.php');
}
echo '</div>';
include_once ('shaxty/foot.php');
?>