$file) {
if(is_uploaded_file($file['tmp_name'])){
$filename = date("Ymd")."-".preg_replace('/[^a-zA-Z0-9\-\._]/','_', $file['name']);
$filesize = ($file['size'] < 1000000) ? round($file['size'] / 1000)."k" : round($file['size'] / 1000000)."M";
$title = $_POST['titles'][$index];
$path = '/docs/files/news';
move_uploaded_file($file['tmp_name'], "..$path/$filename");
$qf=mysqli_query($conn, "INSERT INTO files VALUES(null, '$title', '$filename', '".$path."', NOW(), '$filesize')");
$append[$index] = mysqli_insert_id($conn);
}
}
}
if($_POST['section'] != "NONE") {
$q=mysqli_query($conn, "INSERT INTO links VALUES(null,
'".addslashes(trim($_POST['title']))."',
'".addslashes(trim($_POST['text']))."',
'".$_POST['section']."')");
}
$q=mysqli_query($conn, "INSERT INTO news VALUES(null,
'".addslashes(trim($_POST['title']))."', '".addslashes(trim($_POST['text']))."',
'".trim(conv_date_en($_POST['date']))."','".implode(',',$append)."')");
echo '
Notizia aggiunta correttamente!