[ Index ]
 

Code source de Cr@wltr@ck 2.2.1

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/include/ -> updateremote.php (source)

   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: updateremote.php

  14  //----------------------------------------------------------------------

  15  
  16  if (!defined('IN_CRAWLT_ADMIN'))
  17  {
  18      echo"<h1>Hacking attempt !!!!</h1>";
  19      exit();
  20  }
  21  
  22  //initialize array

  23  $updatelistua=array();
  24  $updatelistname=array();
  25  $updatelisturl=array();
  26  $updatelistuser=array();
  27  $listcrawler=array();
  28  $crawlernameadd=array();
  29  $crawleruaadd=array();    
  30  
  31  //databaseconnection

  32  $connexion = mysql_connect($crawlthost,$crawltuser,$crawltpassword) or die("MySQL connection to database problem");
  33  $selection = mysql_select_db($crawltdb) or die("MySQL database selection problem");
  34  
  35  
  36      //requete to get the actual liste id

  37  
  38      $sqlupdate = "SELECT * FROM crawlt_update";
  39  
  40      $requeteupdate = mysql_query($sqlupdate, $connexion) or die("MySQL query error");
  41  
  42      $idlastupdate=0;
  43  
  44      while ($ligne = mysql_fetch_object($requeteupdate))                                                                              
  45          {
  46          $update=$ligne->update_id; 
  47          if($update>$idlastupdate)
  48              {
  49              $idlastupdate=$update;
  50              }        
  51          }
  52      // we get the actual list number on www.crawltrack.fr

  53  
  54      $idlist="";
  55      $file="";
  56      if(function_exists('fopen'))
  57          {
  58          $nofile=0;
  59          $file = fopen("http://www.crawltrack.fr/listcrawler/idlist.txt", "r");
  60      
  61          }
  62      else
  63          {
  64          $nofile=1;
  65          }
  66  
  67      if (!$file OR $nofile==1)
  68          {
  69          //no connection to the file

  70      
  71      
  72          echo"<br><br><h5>".$language['no_access']."</h5>\n";
  73          
  74  
  75          echo"<h2><a href=\"http://www.crawltrack.fr/download/zdn.php?F=crawlerlist.zip\">".$language['download']."</a></h2>\n";        
  76          
  77          echo"<h5>".$language['download_update']."</h5>\n";        
  78          echo"<div class=\"form\">\n";
  79          echo"<form action=\"index.php\" method=\"POST\" >\n";
  80          echo "<input type=\"hidden\" name ='validform' value='15'>\n";
  81          echo "<input type=\"hidden\" name ='navig' value='6'>\n";
  82          echo"<input name='ok' type='submit'  value='OK ' size='20'>\n";
  83          echo"</form>\n";
  84          echo"</div><br>\n";
  85  
  86          }
  87      else
  88          {
  89          while (!feof($file))
  90              {
  91              $data = fgets($file, 1024);
  92              $idlist=$idlist.$data;
  93              }
  94  
  95          fclose($file);
  96  
  97          if($idlist=="")
  98              {
  99              //file empty

 100          
 101              echo"<br><br><h2>".$language['no_access2']."</h2><br><br>";    
 102  
 103              }
 104          else
 105              {
 106  
 107              //test to know is the crawler list is up to date.

 108              if($idlist==$idlastupdate)
 109                  {
 110                  //the list is up to date

 111                  echo"<br><br><h1>".$language['list_up_to_date']."</h1><br><br>";    
 112                  }
 113              else
 114                  {
 115                  //we can update the list

 116                  // we get the actual list on www.crawltrack.info

 117  
 118                  $crawlerlist="";
 119                  $file2="";
 120                  if( function_exists('fopen'))
 121                      {
 122                      $nofile2=0;
 123                      $file2 = fopen("http://www.crawltrack.fr/listcrawler/crawlerlist.txt", "r");
 124                      }
 125                  else
 126                      {
 127                      $nofile2=1;
 128                      }    
 129                                  
 130                  if (!$file2 OR $nofile2==1) 
 131                      {
 132                      //no connection to the file

 133                      echo"<br><br><h2>".$language['no_access2']."</h2><br><br>";
 134                  
 135                      }
 136                  else
 137                      {
 138                      while (!feof($file2))
 139                          {
 140                          $data2 = fgets($file2, 1024);
 141                          $crawlerlist=$crawlerlist.$data2;
 142                          }
 143  
 144                      fclose($file2);
 145                  
 146                      if($crawlerlist=="")
 147                          {
 148                          //file empty

 149          
 150                          echo"<br><br><h2>".$language['no_access2']."</h2><br><br>";    
 151                          }
 152                      else
 153                          {                
 154      
 155                          $tabdata=explode("crawltrack",$crawlerlist);
 156  
 157                          $nbr=count($tabdata)/4;
 158  
 159                          //we treat the file content

 160                          $i=0;
 161                          for ($j=1;$j<=$nbr;$j++)
 162                              {
 163                              $updatelistua[$j]=$tabdata[$i];
 164                              $i=$i+1;
 165                              $updatelistname[$j]=$tabdata[$i];
 166                              $i=$i+1;
 167                              $updatelisturl[$j]=$tabdata[$i];
 168                              $i=$i+1;
 169                              $updatelistuser[$j]=$tabdata[$i];
 170                              $i=$i+1;
 171                              }
 172          
 173          
 174                          $sqlexist = "SELECT * FROM crawlt_crawler";
 175      
 176                          $requeteexist = mysql_query($sqlexist, $connexion);
 177      
 178      
 179                          while ($ligne = mysql_fetch_object($requeteexist))                                                                              
 180                              {
 181                              $crawlerua=$ligne->crawler_user_agent;
 182                              $listcrawler[]=$crawlerua;
 183                              }    
 184  
 185          
 186                          $nbrdata =count($updatelistua);
 187                          $nbrupdate=0;    
 188      
 189                          for ($k=1;$k<=$nbrdata;$k++)
 190                              {
 191                              $uatest=stripslashes($updatelistua[$k]);
 192                              $ua=$updatelistua[$k];
 193                              $name=$updatelistname[$k];
 194                              $url=$updatelisturl[$k];
 195                              $user=$updatelistuser[$k];
 196          
 197  
 198                              if(in_array($uatest,$listcrawler))
 199                                  {
 200                                  }
 201                              else
 202                                  {
 203                                  $sqlinsert ="INSERT INTO crawlt_crawler (crawler_user_agent,crawler_name, crawler_url, crawler_info, crawler_ip)
 204                                  VALUES ('".sql_quote($ua)."','".sql_quote($name)."','".sql_quote($url)."','".sql_quote($user)."','')";    
 205          
 206                                  $requeteinsert = mysql_query($sqlinsert, $connexion) or die("MySQL query error");
 207                                  $nbrupdate=$nbrupdate+1;
 208                                  $crawlernameadd[] = $name;
 209                                  $crawleruaadd[] = $ua;
 210                                  }                
 211                  
 212                              }
 213  
 214                          echo"<h1><br><br>$nbrupdate&nbsp;".$language['crawler_add']."<br></h1>";
 215                          $sqlinsertid ="INSERT INTO crawlt_update (update_id) VALUES ('".sql_quote($idlist)."')";    
 216          
 217                          $requeteinsertid = mysql_query($sqlinsertid, $connexion) or die("MySQL query error");
 218                          
 219                          
 220                          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";
 221                          for ($l=0;$l<$nbrupdate;$l++)
 222                              {
 223                              $crawlnamedisplay=htmlentities($crawlernameadd[$l]);
 224                              $crawluadisplay=htmlentities($crawleruaadd[$l]);
 225                              if ($l%2 ==0)
 226                                  {
 227                                  echo"<tr><td class='tableau3'>$crawlnamedisplay</td>\n";
 228                                  echo"<td class='tableau5'>$crawluadisplay</td></tr>\n";
 229                                  }
 230                              else
 231                                  {
 232                                  echo"<tr><td class='tableau30'>$crawlnamedisplay</td>\n";
 233                                  echo"<td class='tableau50'>$crawluadisplay</td></tr>\n";
 234                                  } 
 235                              }
 236                          echo"</tr></table></div><br><br>";
 237                                  
 238                          }
 239                      }
 240                  }
 241              }
 242  
 243          }
 244  
 245  ?>


Généré le : Thu Sep 6 14:14:11 2007 par Balluche grâce à PHPXref 0.7