select_db('nch'); $db->query("set names utf8"); $db->query("set character set utf8"); header('Content-Type: text/html; charset=utf-8'); function get_anchor($anchors) { if(count($anchors) > 2) { if(rand(0,99) < 75) $anchor_id = rand(0,1); else $anchor_id = rand(2, count($anchors)-1); } else $anchor_id=array_rand($anchors); return($anchors[$anchor_id]); } $door_req = $db->query(sprintf("SELECT url, title, meta, content, template, domain, pack, version FROM ng_doors WHERE small_url='%s' AND active=1", $db->real_escape_string($small_page))); if($door_req and $door_req->num_rows) { /* Проверка на comprimised */ $comp_req = $db->query(sprintf('SELECT id FROM compromised WHERE url=\'%s\'', $db->real_escape_string($small_page))); if($comp_req and $comp_req->num_rows) { $db->close(); exit(0); } /* Проверка на comprimised end */ $door = $door_req->fetch_assoc(); /* внутридоменная линковка ng-доров на ng-доры */ $insidelinkblock=''; $numinsidelinks=rand(1, 3); $shift = rand()/getrandmax(); $ids = $db->query(sprintf('SELECT url, anchors FROM ng_doors USE INDEX (random_domain) WHERE domain=\'%s\' AND active=1 AND random>=%s ORDER BY random LIMIT %s', $db->real_escape_string($door['domain']), $shift, $numinsidelinks)); if($ids && $ids->num_rows) { while($row = $ids->fetch_array()) { $anchors = split(";", $row[1]); $insidelinkblock .= "".get_anchor($anchors)." "; } } /* end */ $outsideblock=''; /* внешняя линковка ng-доров на ng-доры */ $shift = rand()/getrandmax(); $numoutsidelinks=rand(1,3); $ids = $db->query("SELECT url, anchors FROM ng_doors USE INDEX (random_index) WHERE active=1 AND random>=$shift ORDER BY random LIMIT $numoutsidelinks"); if($ids && $ids->num_rows) { while($row = $ids->fetch_array()) { $anchors = split(";", $row[1]); $outsideblock .= "".get_anchor($anchors)." "; } } /* end */ // внутридоменная линковка на newage-доры */ // $numinsidelinks=rand(5, 10); // $shift = rand()/getrandmax(); // $ids = $db->query(sprintf('SELECT url, anchors FROM new_age USE INDEX (random_domain) WHERE domain=\'%s\' AND random>=%s ORDER BY random LIMIT %s', $db->real_escape_string($door['domain']), $shift, $numinsidelinks)); // if($ids && $ids->num_rows) { // while($row = $ids->fetch_array()) { // $anchors = split(";", $row[1]); // $outsideblock .= "".get_anchor($anchors)." "; // } // } // /* внутридоменная линковка на newage-доры - end*/ // // /* внешняя линковка new age doors begin */ // $numoutsidelinks = rand(5, 10); // $shift = rand()/getrandmax(); // $ids = $db->query(sprintf('SELECT url, anchors FROM new_age USE INDEX (random_index) WHERE random>=%s ORDER BY random LIMIT %s', $shift, $numoutsidelinks)); // if($ids && $ids->num_rows) { // while($row = $ids->fetch_array()) { // $anchors = split(";", $row[1]); // $outsideblock .= "".get_anchor($anchors)." "; // } // } // /* внешняя линковка new age doors end if($door['version'] == '2015') { $domain_md5 = md5(md5(preg_replace("/https{0,1}:\/\/(www\.){0,1}(.*?)\/.*/", '$2', $page))); if(preg_match('/<\/body>/i', $door['content'])) $door['content'] = preg_replace('/<\/body>/i', $insidelinkblock.$outsideblock."", $door['content']); else $door['content'].=""; echo $door['content']; $db->close(); return; } $door['title'] = preg_replace("/\"/","",$door['title']); $door['template']=preg_replace("//msi",$door['title'],$door['template']); $door['template']=preg_replace("//msi",$door['meta'],$door['template']); $door['content'].=$insidelinkblock."
\n".$outsideblock; $domain_md5 = md5(md5(preg_replace("/https{0,1}:\/\/(www\.){0,1}(.*?)\/.*/", '$2', $page))); $door['content'].=""; $door['template']=preg_replace("//msi",$door['content'],$door['template']); if($door['pack'] == '2') if(preg_match('/<\/body>/i', $door['template'])) $door['template'] = preg_replace('/<\/body>/i', $insidelinkblock."
\n".$outsideblock.'', $door['template']); else $door['template'] .= $insidelinkblock."
\n".$outsideblock; if(array_key_exists('version', $_REQUEST) && ($_REQUEST['version'] == '2016' || $_REQUEST['version'] == '2011ng' || $_REQUEST['version'] == '2011nght')) { $response = array('content' => $door['template'], 'stop' => true); // $response = array('content' => $door['template'], 'stop' => true, 'sendinfo' => true); echo(md5('data').base64_encode(serialize($response))); } else echo $door['template']; $db->close(); } ?>