Advertisement
Guest User

Untitled

a guest
Nov 24th, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.87 KB | None | 0 0
  1. <?php
  2.  
  3. function GetList($dir){
  4.    
  5.     global $hash;
  6.    
  7.     $folder = scandir($dir);
  8.     foreach($folder as $file){
  9.         if($file != '.' && $file != '..'){
  10.             if(is_dir($dir.'/'.$file)) {
  11.              
  12.             } else {
  13.                 $hash = md5_file($dir . '/' . $file);
  14.     $sql = "INSERT INTO `mydb`.`filehash` (`Dir`,`FName` ,`Hash`)
  15.                   VALUES ('".mysql_escape_string($dir."\\")."', '".mysql_escape_string($file)."',  '".$hash."');";
  16.  
  17.     print $sql."<br>";
  18.     mysql_query($sql);
  19.             }
  20.         }
  21.     }
  22. }
  23.  
  24.  
  25. print '<html>';
  26.  
  27.     $host="localhost";
  28.     $user="MyDBuser";
  29.     $pass="1"; //установленный вами пароль
  30.     $db_name="myDB";
  31.     $link=mysql_connect($host,$user,$pass);
  32.     mysql_select_db($db_name,$link);
  33.  
  34.  
  35. GetList("Z:\Home\Localhost\www");
  36. print '</html>';
  37.  
  38. mysql_close();
  39. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement