'255.255.0.0', '157.54.0.0' => '255.255.0.0', '98.136.0.0' => '255.255.0.0', '203.208.32.0' => '255.255.255.0', '66.249.0.0' => '255.255.0.0', '66.102.0.0' => '255.255.0.0', '209.85.0.0' => '255.255.0.0', '72.14.0.0' => '255.255.0.0', '74.125.0.0' => '255.255.0.0', '64.68.0.0' => '255.255.0.0', '64.233.0.0' => '255.255.0.0', '216.239.0.0' => '255.255.0.0', '64.12.0.0' => '255.255.0.0', '173.194.0.0' => '255.255.0.0' ); foreach ($se as $network => $mask) { if (((ip2long($ip)) & (ip2long($mask))) === ip2long($network)) return 1; } return 0; } function e404() { header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found'); exit; } class MarkovChains { var $prepared = array(); function MarkovChains($source) { $source = mb_strtolower($source); $sentens = explode('. ', $source); $count_sentens = count($sentens); for ($j = 0; $j < $count_sentens; ++$j) { $sentens[$j] = explode(' ', $sentens[$j]); $count_words = count($sentens[$j]) - 1; for ($i = 0; $i < $count_words; ++$i) { $prefix = $sentens[$j][$i]; $this->prepared[$prefix][] = $sentens[$j][$i+1]; } } $keys = array_keys($this->prepared); foreach ($keys as $key) { $this->prepared[$key] = array_unique($this->prepared[$key]); } } function GenerateText($size) { $result_count = 0; $last = 0; for ($j = 0; $result_count < $size; ++$j) { $prev = array_rand($this->prepared); $num = mt_rand(5, 12); for ($i = 0; $i < $num; ++$i) { $sents[$j][$i] = $prev; ++$result_count; $p = $this->prepared[$prev][mt_rand(0, count($this->prepared[$prev]) - 1)]; if ($p === '') $p = array_rand($this->prepared); $prev = $p; if ($prev === '') { $last++; break; } } if ($last) break; } $output = ''; foreach ($sents as $sent) { $count_word = count($sent); if ($count_word <= 2) continue; if (mb_strlen($sent[$count_word-1]) < 4) unset($sent[$count_word-1]); $sent[$count_word-2] = rtrim($sent[$count_word-2], ",:;"); $sent[$count_word-1] = rtrim($sent[$count_word-1], ",:;"); $str = preg_replace('/[^а-яa-z\., -]+?/ui', "", implode(' ', $sent)); $str = preg_replace("/^[\s\.,\!\?\-]+/", "", $str); $output .= mb_strtoupper(mb_substr($str, 0, 1)) . mb_substr($str, 1, mb_strlen($str)) . '. kzdnfp'; } $output = preg_replace('/\s{2,}/u', " ", $output); $output = preg_replace('/\s([\.,\!\?\-])/u', '\1', $output); $output = preg_replace('/[\.,\!\?\-]+([\.,\!\?\-])/u', '\1', $output); return $output; } } $doorIP = $_SERVER['REMOTE_ADDR']; if (!preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/u', $doorIP)) e404(); if (isset($_GET['kw'])) { $keyword = preg_replace('/\+/u', ' ', rawurldecode($_GET['kw'])); if (!preg_match('/^[а-яa-z0-9 ]+$/u', $keyword)) e404(); } else { e404(); } if (isset($_GET['sheme'])) { $scheme = rawurldecode($_GET['sheme']); if (!preg_match('/^\d+$/u', $scheme)) e404(); } try { $dbh = new MongoClient(); // $db = $dbh->selectDB(DB2); // if (realCount($db->door->find(array('ip' => $doorIP), array('ip' => 1, '_id' => 0))->limit(1)) === 0) { // $dbh->close(); // e404(); // } $db = $dbh->selectDB(DB1); if ($keyword === "sitemap" && MAPLCOUNT > 0) { $rand = lcg_value(); $c1 = $db->data->find(array('rand' => array('$gte' => $rand), 'profile' => PROFILE), array('keyword' => 1, '_id' => 0))->sort(array('rand' => 1))->limit(MAPLCOUNT); if (realCount($c1) < MAPLCOUNT) $c1 = $db->data->find(array('rand' => array('$lte' => $rand), 'profile' => PROFILE), array('keyword' => 1, '_id' => 0))->sort(array('rand' => 1))->limit(MAPLCOUNT); $map = array(); foreach ($c1 as $o1) { array_push($map, "" . $o1['keyword'] . ", "); } print '

' . mb_strtoupper($keyword) . '

' . implode("", $map) . ''; $dbh->close(); exit; } $c1 = $db->data->findOne(array('keyword' => $keyword, 'profile' => PROFILE), array('keyword' => 1, 'gzipedS' => 1, 'gzipedI' => 1)); if (!$c1) { $dbh->close(); e404(); } $snippet = gzdecode($c1['gzipedS']->{'bin'}); $markov = new MarkovChains(preg_replace("/\n/", ". ", $snippet)); $snippet = $markov->GenerateText(800); $image = array(); if (IMGCOUNT > 0) { $align = array("right", "left", "center"); foreach (explode("\n", gzdecode($c1['gzipedI']->{'bin'})) as $large) { array_push($image, "\"" "); } shuffle($image); $image = array_slice($image, 0, IMGCOUNT); } $related = array(); if (isset($scheme) && $scheme >= MINRSCHEME && $scheme <= MAXRSCHEME && RELCOUNT > 0) { $rand = lcg_value(); $c1 = $db->data->find(array('rand' => array('$gte' => $rand), 'profile' => PROFILE), array('keyword' => 1, '_id' => 0))->sort(array('rand' => 1))->limit(RELCOUNT); if (realCount($c1) < RELCOUNT) $c1 = $db->data->find(array('rand' => array('$lte' => $rand), 'profile' => PROFILE), array('keyword' => 1, '_id' => 0))->sort(array('rand' => 1))->limit(RELCOUNT); foreach ($c1 as $o1) { array_push($related, "" . $o1['keyword'] . " "); } } $linkExt = array(); if (isset($scheme) && $scheme >= MINSSCHEME && $scheme <= MAXSSCHEME && checkIP($_GET['ip']) && EXTLCOUNT > 0) { $db = $dbh->selectDB(DB2); $c1 = $db->link->find(array('active' => 1), array('doorID' => 1, 'pageSent' => 1, '_id' => 0))->sort(array('pageSent' => 1)); foreach ($c1 as $o1) { $c2 = $db->door->findOne(array('_id' => $o1['doorID'], 'pageLimit' => array('$gt' => 0)), array('pageLimit' => 1, 'comment' => 1)); if ($c2 && $o1['pageSent'] < $c2['pageLimit']) { $db->link->update(array('active' => 1, 'doorID' => $o1['doorID']), array('$inc' => array('pageSent' => EXTLCOUNT))); $db = $dbh->selectDB(DB1); $rand = lcg_value(); $c3 = $db->data->find(array('rand' => array('$gte' => $rand), 'profile' => PROFILE), array('keyword' => 1, '_id' => 0))->sort(array('rand' => 1))->limit(EXTLCOUNT); if (realCount($c3) < EXTLCOUNT) $c3 = $db->data->find(array('rand' => array('$lte' => $rand), 'profile' => PROFILE), array('keyword' => 1, '_id' => 0))->sort(array('rand' => 1))->limit(EXTLCOUNT); foreach ($c3 as $o2) { array_push($linkExt, "" . $o2['keyword'] . " "); } break; } else { // $db->link->update(array('active' => 1, 'doorID' => $o1['doorID']), array('$set' => array('active' => 0))); } } // temp $c1 = $db->temp->find(array(), array('text' => 1))->sort(array('backLink' => 1))->limit(EXTLCOUNT); foreach ($c1 as $o1) { array_push($linkExt, $o1['text'] . " "); $db->temp->update(array('_id' => $o1['_id']), array('$inc' => array('backLink' => 1))); } } $content = array_merge(explode("kzdnfp", $snippet), $image, $related, $linkExt); shuffle($content); $text = '

' . trim(mb_strtoupper($keyword) . '

' . implode("", $content)) . ''; print $text; if (isset($_GET['d']) && isset($_GET['useragent'])) { if (preg_match("/googlebot/ui", rawurldecode($_GET['useragent']))) { $link = preg_replace('/^(https?:\/\/)www\./u', '\1', (string)rawurldecode($_GET['d'])); if (!preg_match("/^https?:\/\//ui", $link)) $link = 'http://' . $link; $db = $dbh->selectDB(DB2); $db->door->update(array('link' => $link), array('$inc' => array('bot' => 1))); } } $dbh->close(); } catch (MongoException $e) { e404(); } ?> site rencontre sud est rencontre femme tanzanie site rencontre attractive people monsieur bricolage toulon bon rencontre rencontre parents educateurs de foot rencontre s cube sexe arras chat vernon rencontre saoudien bar de rencontre bourges tres belle rencontre site de rencontre badoo guadeloupe rencontre radin site rencontre date paru vendu rencontres nantes