[ 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: testcrawlercreation.php 14 //---------------------------------------------------------------------- 15 16 if (!defined('IN_CRAWLT_ADMIN')) 17 { 18 echo"<h1>Hacking attempt !!!!</h1>"; 19 exit(); 20 } 21 22 //valid form 23 24 if($validlogin==1) 25 { 26 27 //database connection 28 $connexion = mysql_connect($crawlthost,$crawltuser,$crawltpassword) or die("MySQL connection to database problem"); 29 $selection = mysql_select_db($crawltdb) or die("MySQL database selection problem"); 30 31 //check if crawler already exist 32 33 $sqlexist = "SELECT * FROM crawlt_crawler 34 WHERE crawler_name='Test-CrawlTrack'"; 35 36 $requeteexist = mysql_query($sqlexist, $connexion) or die("MySQL query error"); 37 38 $nbrresult=mysql_num_rows($requeteexist); 39 40 if($nbrresult>=1) 41 { 42 $ligne = mysql_fetch_object($requeteexist); 43 //crawler already exist 44 echo"<br><br><h2>".$language['crawler_test_creation']."</h2>\n"; 45 echo"<h1>".$language['exist']."</h1>\n"; 46 47 echo"<div class=\"form\">\n"; 48 echo"<form action=\"index.php\" method=\"POST\" >\n"; 49 echo "<input type=\"hidden\" name ='navig' value='6'>\n"; 50 echo"<input name='ok' type='submit' value='OK' size='20'>\n"; 51 echo"</form>\n"; 52 echo"</div>\n"; 53 54 } 55 else 56 { 57 //crawler didn't exist we can add the crawler in the database 58 59 //find user agent to use 60 if (!isset($_SERVER)) 61 { 62 $_SERVER = $HTTP_SERVER_VARS; 63 } 64 65 $agent2 =$_SERVER['HTTP_USER_AGENT']; 66 67 $sqlcrawler="INSERT INTO crawlt_crawler (crawler_user_agent,crawler_name,crawler_url,crawler_info,crawler_ip) VALUES ('".sql_quote($agent2)."','Test-Crawltrack','no-url','me','')"; 68 $requetecrawler = mysql_query($sqlcrawler, $connexion) or die("MySQL query error"); 69 70 71 72 //determine the path to the nocache file 73 if (isset($_SERVER['PATH_TRANSLATED']) && !empty($_SERVER['PATH_TRANSLATED'])) 74 { 75 $path = dirname( $_SERVER['PATH_TRANSLATED'] ); 76 } 77 elseif (isset($_SERVER['SCRIPT_FILENAME']) && !empty($_SERVER['SCRIPT_FILENAME'])) 78 { 79 $path = dirname( $_SERVER['SCRIPT_FILENAME'] ); 80 } 81 else 82 { 83 $path = '.'; 84 } 85 $filename=$path.'/include/nocache.php'; 86 87 //suppress the files 88 unlink($filename); 89 90 //recreate the new file to avoid caching to be able to see the test crawler 91 @$content.="<?php\n"; 92 @$content.="\$nocachetest=1;\n"; 93 @$content.="?>\n"; 94 95 $filedir=$path; 96 97 98 //chmod the directory 99 if(function_exists('chmod')) 100 { 101 @chmod($filedir, 0777); 102 } 103 104 105 if ( $file = fopen($filename, "w") ) 106 { 107 fwrite($file, $content); 108 fclose($file); 109 } 110 if(function_exists('chmod')) 111 { 112 @chmod($filedir, 0711); 113 } 114 115 //emptied the cache table 116 $sqlcache = "TRUNCATE TABLE crawlt_cache"; 117 $requetecache = mysql_query($sqlcache, $connexion) or die("MySQL query error"); 118 119 120 //check is requete is successfull 121 122 if($requetecrawler) 123 { 124 echo"<br><br><h1>".$language['crawler_test_creation']."</h1>\n"; 125 echo"<p>".$language['crawler_ok']."</p>\n"; 126 127 echo"<div class=\"form\">\n"; 128 echo"<form action=\"index.php\" method=\"POST\" >\n"; 129 echo "<input type=\"hidden\" name ='navig' value='6'>\n"; 130 echo"<input name='ok' type='submit' value='OK' size='20'>\n"; 131 echo"</form>\n"; 132 echo"</div>\n"; 133 } 134 else 135 { 136 echo"<br><br><h1>".$language['crawler_test_creation']."</h1>\n"; 137 echo"<p>".$language['crawler_no_ok2']."</p>"; 138 139 echo"<div class=\"form\">\n"; 140 echo"<form action=\"index.php\" method=\"POST\" >\n"; 141 echo "<input type=\"hidden\" name ='navig' value='6'>\n"; 142 echo"<input name='ok' type='submit' value='OK' size='20'>\n"; 143 echo"</form>\n"; 144 echo"</div>\n"; 145 } 146 } 147 148 } 149 150 //form 151 152 else 153 { 154 155 echo"<br><br><h1>".$language['crawler_test_creation']."</h1>\n"; 156 echo"<p>".$language['crawler_test_text']."</p>\n"; 157 echo"<p>".$language['crawler_test_text2']."</p><br>\n"; 158 159 160 echo"<div class=\"form\">\n"; 161 echo"<form action=\"index.php\" method=\"POST\" >\n"; 162 echo "<input type=\"hidden\" name ='navig' value='6'>\n"; 163 echo "<input type=\"hidden\" name ='validform' value=\"11\">"; 164 echo "<input type=\"hidden\" name ='validlogin' value=\"1\">"; 165 echo"<input name='ok' type='submit' value='".$language['crawler_test_creation']."' size='20'>\n"; 166 echo"</form>\n"; 167 echo"</div>\n"; 168 } 169 170 ?>
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 |