You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							52 lines
						
					
					
						
							1.3 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							52 lines
						
					
					
						
							1.3 KiB
						
					
					
				| <?php | |
| $DATAhst="62.149.150.48"; | |
| $DATAusr="Sql90805"; | |
| $DATApwd="601ea4bd"; | |
| $DATAdtb="Sql90805_5"; | |
| 
 | |
| $conn=mysqli_connect($DATAhst,$DATAusr,$DATApwd,$DATAdtb); | |
| 
 | |
| $NEW = 'variazioni-albo'; | |
| $DIR = "../../OLD/docs/variazioni/albo"; | |
| 
 | |
| $d=dir($DIR); | |
| while($r=$d->read()){ | |
| 
 | |
|     if(substr($r,0,1)!='.'){ | |
| 
 | |
|         //@mkdir('../..//docs/'.$NEW.'/'.$r); | |
|  | |
|         $df=dir($DIR."/".$r); | |
| 
 | |
|         while($rf=$df->read()){ | |
|             if(substr($rf,0,1)!='.'){ | |
| 
 | |
|                 $filePath = $DIR."/".$r."/".$rf; | |
|                 $filePathInfo = pathinfo($filePath); | |
| 
 | |
| 
 | |
|                 if(file_exists($filePath)){ | |
| 
 | |
|                     $filename = preg_replace('/[^a-zA-Z0-9\-\._]/','', $filePathInfo['basename']); | |
|                     $filesize = (filesize($filePath) < 1000000) ? round(filesize($filePath) / 1000)."k" : round(filesize($filePath) / 1000000)."M"; | |
|                     $title = $filename; | |
|                     $path = '../../docs/'.$NEW; | |
|                     $dbPath = '/docs/'.$NEW; | |
| 
 | |
|                     copy($filePath, "$path/$filename"); | |
| 
 | |
|                     $query.="INSERT INTO files VALUES(null, '$title', '$filename', '".$dbPath."', '".substr($rf,0,10)."', '$filesize');\n"; | |
| 
 | |
|                 } | |
| 
 | |
| 
 | |
|             } | |
|         } | |
| 
 | |
|     } | |
| } | |
| 
 | |
| echo $query; | |
| //mysql_query($query); | |
|  | |
| mysqli_close($conn);
 |