[ Index ] |
|
Code source de Cr@wltr@ck 2.2.1 |
1 <?php 2 //---------------------------------------------------------------------- 3 // CrawlTrack 2.2.1 4 //---------------------------------------------------------------------- 5 // Crawler Tracker for website 6 //---------------------------------------------------------------------- 7 // Author: Jean-Denis Brun 8 //---------------------------------------------------------------------- 9 // Website: www.crawltrack.fr 10 //---------------------------------------------------------------------- 11 // That script is distributed under GNU GPL license 12 //---------------------------------------------------------------------- 13 // file: testcrawlersuppress.php 14 //---------------------------------------------------------------------- 15 16 if (!defined('IN_CRAWLT_ADMIN')) 17 { 18 echo"<h1>Hacking attempt !!!!</h1>"; 19 exit(); 20 } 21 22 if(isset($_POST['suppresscrawler'])) 23 { 24 $suppresscrawler = (int)$_POST['suppresscrawler']; 25 } 26 else 27 { 28 $suppresscrawler = 0; 29 } 30 31 32 if($suppresscrawler==1) 33 34 { 35 //crawler suppression 36 37 //database connection 38 $connexion = mysql_connect($crawlthost,$crawltuser,$crawltpassword) or die("MySQL connection to database problem"); 39 $selection = mysql_select_db($crawltdb) or die("MySQL database selection problem"); 40 41 //database query to suppress the crawler 42 43 $sqlstats = "SELECT * FROM crawlt_crawler WHERE crawler_name ='Test-Crawltrack'"; 44 45 $requetestats = mysql_query($sqlstats, $connexion) or die("MySQL query error"); 46 47 $nbrresult=mysql_num_rows($requetestats); 48 if($nbrresult>=1) 49 { 50 while ($ligne = mysql_fetch_object($requetestats)) 51 { 52 $testcrawltrackid=$ligne->id_crawler; 53 } 54 55 56 $sqldelete = "DELETE FROM crawlt_crawler WHERE id_crawler= '".sql_quote($testcrawltrackid)."'"; 57 $requetedelete = mysql_query($sqldelete, $connexion) or die("MySQL query error"); 58 59 60 $sqldelete2="DELETE FROM crawlt_visits WHERE crawlt_crawler_id_crawler= '".sql_quote($testcrawltrackid)."'"; 61 $requetedelete2 = mysql_query($sqldelete2, $connexion) or die("MySQL query error"); 62 63 //database query to optimize the table 64 $sqloptimize = "OPTIMIZE TABLE crawlt_visits"; 65 $requeteoptimize = mysql_query($sqloptimize, $connexion) or die("MySQL query error"); 66 67 68 //determine the path to the nocache file 69 if (isset($_SERVER['PATH_TRANSLATED']) && !empty($_SERVER['PATH_TRANSLATED'])) 70 { 71 $path = dirname( $_SERVER['PATH_TRANSLATED'] ); 72 } 73 elseif (isset($_SERVER['SCRIPT_FILENAME']) && !empty($_SERVER['SCRIPT_FILENAME'])) 74 { 75 $path = dirname( $_SERVER['SCRIPT_FILENAME'] ); 76 } 77 else 78 { 79 $path = '.'; 80 } 81 $filename=$path.'/include/nocache.php'; 82 83 //suppress the files 84 unlink($filename); 85 86 //recreate the new file to put back caching 87 @$content.="<?php\n"; 88 @$content.="\$nocachetest=0;\n"; 89 @$content.="?>\n"; 90 91 $filedir=$path; 92 93 94 //chmod the directory 95 if(function_exists('chmod')) 96 { 97 @chmod($filedir, 0777); 98 } 99 100 101 if ( $file = fopen($filename, "w") ) 102 { 103 fwrite($file, $content); 104 fclose($file); 105 } 106 if(function_exists('chmod')) 107 { 108 @chmod($filedir, 0711); 109 } 110 111 //emptied the cache table 112 $sqlcache = "TRUNCATE TABLE crawlt_cache"; 113 $requetecache = mysql_query($sqlcache, $connexion) or die("MySQL query error"); 114 115 if($requetedelete && $requetedelete2) 116 { 117 echo"<br><br><h1>".$language['crawler_suppress_ok']."</h1>\n"; 118 119 echo"<div class=\"form\">\n"; 120 echo"<form action=\"index.php\" method=\"POST\" >\n"; 121 echo "<input type=\"hidden\" name ='navig' value='6'>\n"; 122 echo"<input name='ok' type='submit' value='OK' size='20'>\n"; 123 echo"</form>\n"; 124 echo"</div>\n"; 125 } 126 else 127 { 128 echo"<br><br><h1>".$language['crawler_suppress_no_ok']."</h1>\n"; 129 130 echo"<div class=\"form\">\n"; 131 echo"<form action=\"index.php\" method=\"POST\" >\n"; 132 echo "<input type=\"hidden\" name ='navig' value='6'>\n"; 133 echo"<input name='ok' type='submit' value='OK' size='20'>\n"; 134 echo"</form>\n"; 135 echo"</div>\n"; 136 } 137 138 } 139 else 140 { 141 echo"<br><br><h1>".$language['crawler_test_no_exist']."</h1>\n"; 142 } 143 144 } 145 else 146 { 147 148 149 //display 150 151 echo"<br><br><h1>".$language['crawler_test_suppress']."</h1>\n"; 152 153 echo"<div class=\"form\">\n"; 154 echo"<form action=\"index.php\" method=\"POST\" >\n"; 155 echo "<input type=\"hidden\" name ='navig' value='6'>\n"; 156 echo "<input type=\"hidden\" name ='validform' value=\"12\">"; 157 echo "<input type=\"hidden\" name ='suppresscrawler' value=\"1\">\n"; 158 echo "<input type=\"hidden\" name ='crawlertosuppress' value=\"Test-CrawlTrack\">\n"; 159 echo"<table class=\"centrer\">\n"; 160 echo"<tr>\n"; 161 echo"<td colspan=\"2\">\n"; 162 echo"<input name='ok' type='submit' value=' ".$language['yes']." ' size='20'>\n"; 163 echo"</td>\n"; 164 echo"</tr>\n"; 165 echo"</table>\n"; 166 echo"</form>\n"; 167 echo"</div>"; 168 169 echo"<div class=\"form\">\n"; 170 echo"<form action=\"index.php\" method=\"POST\" >\n"; 171 echo "<input type=\"hidden\" name ='navig' value='6'>\n"; 172 echo "<input type=\"hidden\" name ='suppresscrawler' value=\"0\">\n"; 173 echo"<table class=\"centrer\">\n"; 174 echo"<tr>\n"; 175 echo"<td colspan=\"2\">\n"; 176 echo"<input name='ok' type='submit' value=' ".$language['no']." ' size='20'>\n"; 177 echo"</td>\n"; 178 echo"</tr>\n"; 179 echo"</table>\n"; 180 echo"</form>\n"; 181 echo"</div>"; 182 183 184 echo"<br>\n"; 185 } 186 187 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Thu Sep 6 14:14:11 2007 | par Balluche grâce à PHPXref 0.7 |