[ 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: updatelocal.php 14 //---------------------------------------------------------------------- 15 16 if (!defined('IN_CRAWLT_ADMIN')) 17 { 18 echo"<h1>Hacking attempt !!!!</h1>"; 19 exit(); 20 } 21 //initialize array 22 $updatelistua=array(); 23 $updatelistname=array(); 24 $updatelisturl=array(); 25 $updatelistuser=array(); 26 $listcrawler=array(); 27 $crawlernameadd=array(); 28 $crawleruaadd=array(); 29 30 31 if(file_exists('include/crawlerlist.php')) 32 { 33 include "include/crawlerlist.php"; 34 35 //databaseconnection 36 37 $connexion = mysql_connect($crawlthost,$crawltuser,$crawltpassword) or die("MySQL connection to database problem"); 38 $selection = mysql_select_db($crawltdb) or die("MySQL database selection problem"); 39 40 //requete to get the actual liste id 41 42 $sqlupdate = "SELECT * FROM crawlt_update"; 43 44 $requeteupdate = mysql_query($sqlupdate, $connexion) or die("MySQL query error"); 45 46 $idlastupdate=0; 47 48 while ($ligne = mysql_fetch_object($requeteupdate)) 49 { 50 $update=$ligne->update_id; 51 if($update>$idlastupdate) 52 { 53 $idlastupdate=$update; 54 } 55 } 56 57 //test to know is the crawler list is up to date. 58 if($idlist==$idlastupdate) 59 { 60 //the list is up to date 61 echo"<br><br><h1>".$language['list_up_to_date']."</h1><br><br>"; 62 } 63 else 64 { 65 $tabdata=explode("crawltrack",$crawlerlist); 66 67 $nbr=count($tabdata)/4; 68 69 //we treat the file content 70 $i=0; 71 for ($j=1;$j<=$nbr;$j++) 72 { 73 $updatelistua[$j]=$tabdata[$i]; 74 $i=$i+1; 75 $updatelistname[$j]=$tabdata[$i]; 76 $i=$i+1; 77 $updatelisturl[$j]=$tabdata[$i]; 78 $i=$i+1; 79 $updatelistuser[$j]=$tabdata[$i]; 80 $i=$i+1; 81 } 82 83 84 $sqlexist = "SELECT * FROM crawlt_crawler"; 85 86 $requeteexist = mysql_query($sqlexist, $connexion) or die("MySQL query error"); 87 88 89 while ($ligne = mysql_fetch_object($requeteexist)) 90 { 91 $crawlerua=$ligne->crawler_user_agent; 92 $listcrawler[]=$crawlerua; 93 } 94 95 96 $nbrdata =count($updatelistua); 97 $nbrupdate=0; 98 99 for ($k=1;$k<=$nbrdata;$k++) 100 { 101 $uatest=stripslashes($updatelistua[$k]); 102 $ua=$updatelistua[$k]; 103 $name=$updatelistname[$k]; 104 $url=$updatelisturl[$k]; 105 $user=$updatelistuser[$k]; 106 107 108 if(in_array($uatest,$listcrawler)) 109 { 110 } 111 else 112 { 113 $sqlinsert ="INSERT INTO crawlt_crawler (crawler_user_agent,crawler_name, crawler_url, crawler_info, crawler_ip) 114 VALUES ('".sql_quote($ua)."','".sql_quote($name)."','".sql_quote($url)."','".sql_quote($user)."','')"; 115 116 $requeteinsert = mysql_query($sqlinsert, $connexion) or die("MySQL query error"); 117 $nbrupdate=$nbrupdate+1; 118 $crawlernameadd[] = $name; 119 $crawleruaadd[] = $ua; 120 } 121 122 } 123 124 echo"<h1><br><br>$nbrupdate ".$language['crawler_add']."<br></h1>"; 125 $sqlinsertid ="INSERT INTO crawlt_update (update_id) VALUES ('".sql_quote($idlist)."')"; 126 127 $requeteinsertid = mysql_query($sqlinsertid, $connexion) or die("MySQL query error"); 128 129 echo"<div align='center'><table cellpadding='0px' cellspacing='0' width='750px'><tr><td class='tableau1'>".$language['crawler_name']."</td><td class='tableau2'>".$language['user_agent']."</td></tr>\n"; 130 for ($l=0;$l<$nbrupdate;$l++) 131 { 132 $crawlnamedisplay=htmlentities($crawlernameadd[$l]); 133 $crawluadisplay=htmlentities($crawleruaadd[$l]); 134 if ($l%2 ==0) 135 { 136 echo"<tr><td class='tableau3'>$crawlnamedisplay</td>\n"; 137 echo"<td class='tableau5'>$crawluadisplay</td></tr>\n"; 138 } 139 else 140 { 141 echo"<tr><td class='tableau30'>$crawlnamedisplay</td>\n"; 142 echo"<td class='tableau50'>$crawluadisplay</td></tr>\n"; 143 } 144 } 145 echo"</tr></table></div><br><br>"; 146 147 148 } 149 } 150 else 151 { 152 echo"<br><br><h1>".$language['no_crawler_list']."</h1><br>"; 153 } 154 155 156 157 ?>
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 |