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.
129 lines
2.6 KiB
129 lines
2.6 KiB
<?php
|
|
$DATAhst="62.149.150.48";
|
|
$DATAusr="Sql90805";
|
|
$DATApwd="601ea4bd";
|
|
$DATAdtb="Sql90805_1";
|
|
|
|
$conn=mysqli_connect($DATAhst,$DATAusr,$DATApwd,$DATAdtb);
|
|
|
|
$q = mysqli_query($conn, "SELECT * FROM inserzioni");
|
|
|
|
$query='';
|
|
$cnt=1281;
|
|
|
|
while($r=mysqli_fetch_array($q)){
|
|
|
|
if($r[9]!="") {
|
|
$NEW = 'files/advertisement/';
|
|
$DIR = "../../OLD/docs/inserzioni";
|
|
|
|
|
|
$filePath = $DIR.'/'.$r[9];
|
|
$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."', '".date("Y-m-d", filemtime($filePath))."', '$filesize');\n";
|
|
|
|
$r[9] = $cnt;
|
|
$cnt++;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$query.="INSERT INTO advertisement VALUES(".
|
|
"'".$r[0]."', ".
|
|
"'".addslashes(str_replace(''','\'',$r[1]))."', ".
|
|
"'".addslashes(str_replace(''','\'',$r[2]))."', ".
|
|
"'".addslashes(str_replace(''','\'',$r[3]))."', ".
|
|
"'".addslashes(str_replace(''','\'',$r[4]))."', ".
|
|
"'".addslashes(str_replace(''','\'',$r[5]))."', ".
|
|
"'".addslashes(str_replace(''','\'',$r[6]))."', ".
|
|
"'".addslashes(str_replace(''','\'',$r[7]))."', ".
|
|
"'".addslashes(str_replace(''','\'',$r[8]))."', ".
|
|
"'".addslashes(str_replace(''','\'',$r[9]))."', ".
|
|
"'".addslashes(str_replace(''','\'',$r[10]))."', ".
|
|
"'".addslashes(str_replace(''','\'',$r[11]))."' ".
|
|
");\n";
|
|
|
|
|
|
}
|
|
|
|
|
|
echo $query;
|
|
//mysql_query($query);
|
|
|
|
mysqli_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);*/
|
|
?>
|