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.
		
		
		
		
		
			
		
			
				
					
					
						
							121 lines
						
					
					
						
							2.5 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							121 lines
						
					
					
						
							2.5 KiB
						
					
					
				| <?php | |
| $DATAhst="62.149.150.48"; | |
| $DATAusr="Sql90805"; | |
| $DATApwd="601ea4bd"; | |
| $DATAdtb="Sql90805_1"; | |
| 
 | |
| $conn=mysql_connect($DATAhst,$DATAusr,$DATApwd); | |
| mysql_select_db($DATAdtb); | |
| 
 | |
| $q = mysql_query("SELECT * FROM news"); | |
| 
 | |
| $query=''; | |
| $cnt=1; | |
| 
 | |
| while($r=mysql_fetch_array($q)){ | |
| 
 | |
|     $append = array(); | |
|     $dl = strpos($r[3], 'download.php?file='); | |
| 
 | |
|     if($dl>0){ | |
|         $offset = strpos($r[3], '"', $dl); | |
|         //echo $dl." - ".$offset." - ".str_replace('download.php?file=','',substr($r[3], $dl, $offset-$dl))."<br>\n"; | |
|         $filePath = str_replace("//","/", "../../docs/".str_replace('download.php?file=','',substr($r[3], $dl, $offset-$dl))); | |
|         $filePathInfo = pathinfo($filePath); | |
| 
 | |
|         if(file_exists($filePath)){ | |
|             //print_r($filePathInfo); | |
|  | |
|             //echo filesize($filePath)."\n<br>"; | |
|             $filename = $cnt.'_'.preg_replace('/[^a-zA-Z0-9\-\._]/','', $filePathInfo['basename']); | |
|             $filesize = (filesize($filePath) < 1000000) ? round(filesize($filePath) / 1000)."k" : round(filesize($filePath) / 1000000)."M"; | |
|             $title = "Scarica la relativa circolare"; | |
|             $path = '../../docs/files/news'; | |
| 
 | |
|             copy($filePath, "$path/$filename"); | |
| 
 | |
|             $query.="INSERT INTO files VALUES($cnt, '$title', '$filename', '".$path."', '".$r[1]."', '$filesize');\n"; | |
|             $append[$index] = $cnt; | |
|             $cnt++; | |
|         } | |
| 
 | |
|         $r[3]=substr($r[3],0,strpos($r[3],'<hr size="1">')); | |
|     } | |
| 
 | |
|     $query.="INSERT INTO news VALUES(". | |
|     "'".$r[0]."', ". | |
|     "'".addslashes(str_replace(''','\'',$r[2]))."', ". | |
|     "'".addslashes(str_replace(''','\'',$r[3]))."', ". | |
|     "'".addslashes(str_replace(''','\'',$r[1]))."', ". | |
|     "'".implode(',',$append)."' ". | |
|     ");\n"; | |
| 
 | |
| 
 | |
| } | |
| 
 | |
| echo $query; | |
| //mysql_query($query); | |
|  | |
| mysql_close($conn); | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| /* | |
|  | |
| @include 'new/cgi-bin/conn.conn'; | |
| $conn = mysql_connect($DATAhst,$DATAusr,$DATApwd); | |
| mysql_select_db("Sql90805_1"); | |
|  | |
| $op=fopen("alboNew.csv","r"); | |
|  | |
| while($res=fgets($op)){ | |
|  | |
| $scom=explode("%",$res); | |
|  | |
| $q=mysql_query("UPDATE albo SET | |
| 	email='".$scom[13]."', | |
| 	cognome='".$scom[2]."', | |
| 	nome='".$scom[3]."', | |
| 	data_iscr='".$scom[1]."', | |
| 	indirizzo='".$scom[4]."', | |
| 	cap='".$scom[5]."', | |
| 	citta='".$scom[6]."', | |
| 	provincia='".$scom[7]."', | |
| 	laurea_a='".$scom[9]."', | |
| 	laurea_il='".$scom[8]."', | |
| 	laurea_in='".$scom[10]."', | |
| 	abilitazione_nel='".$scom[11]."', | |
| 	abilitazione_a='".$scom[12]."' | |
| 	WHERE iscrizione='".$scom[0]."'"); | |
|  | |
|  | |
| if($q){ | |
| echo "ok <br>"; | |
| }else{ | |
| echo "ERRORE <br>"; | |
| } | |
|  | |
| } | |
|  | |
| fclose($op);*/ | |
| ?>
 |