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.
		
		
		
		
		
			
		
			
				
					
					
						
							76 lines
						
					
					
						
							2.1 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							76 lines
						
					
					
						
							2.1 KiB
						
					
					
				| <?php | |
| $DATAhst="62.149.150.48"; | |
| $DATAusr="Sql90805"; | |
| $DATApwd="601ea4bd"; | |
| $DATAdtb="Sql90805_5"; | |
| 
 | |
| $conn=mysqli_connect($DATAhst,$DATAusr,$DATApwd,$DATAdtb); | |
| 
 | |
| $NEW = 'ricette-e-timbri'; | |
| $DIR = "../../OLD/docs/ricette_timbri"; | |
| 
 | |
| $month = array(); | |
| $month["Gennaio"]="01"; | |
| $month["Febbraio"]="02"; | |
| $month["Marzo"]="03"; | |
| $month["Aprile"]="04"; | |
| $month["Maggio"]="05"; | |
| $month["Giugno"]="06"; | |
| $month["Luglio"]="07"; | |
| $month["Agosto"]="08"; | |
| $month["Settembre"]="09"; | |
| $month["Ottobre"]="10"; | |
| $month["Novembre"]="11"; | |
| $month["Dicembre"]="12"; | |
| 
 | |
| $d=dir($DIR); | |
| while($r=$d->read()){ | |
| 
 | |
|     if(substr($r,0,1)!='.'){ | |
| 
 | |
|         $dy=dir($DIR."/".$r); | |
|         while($ry=$dy->read()){ | |
|             if(substr($ry,0,1)!='.'){ | |
| 
 | |
|                 $fileDate = $r."-".$month[$ry]."-01"; | |
| 
 | |
|                 $df=dir($DIR."/".$r."/".$ry); | |
|                 while($rf=$df->read()){ | |
|                     if(substr($rf,0,1)!='.'){ | |
| 
 | |
|                         if(intval($r) > 2008){ | |
|                             $fileDate = substr($rf,0,4)."-".substr($rf,4,2)."-".substr($rf,6,2); | |
|                         } | |
| 
 | |
|                         $filePath = $DIR."/".$r."/".$ry."/".$rf; | |
|                         $filePathInfo = pathinfo($filePath); | |
| 
 | |
|                         //echo $fileDate."------".$filePath."<br>"; | |
|  | |
|                         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."', '".date("Y-m-d", filemtime($filePath))."', '$filesize');\n"; | |
| 
 | |
|                         } | |
|                     } | |
|                 } | |
| 
 | |
| 
 | |
|             } | |
|         } | |
| 
 | |
|     } | |
| } | |
| 
 | |
| echo $query; | |
| //mysql_query($query); | |
|  | |
| mysqli_close($conn);
 |