Buonasera, avrei bisogno d'aiuto... non ricevo risposte.
sono 2 pagine: pagina.php e pagineManage.php, ho copiato manage che non risponde e manda una pagina bianca... Grazie.
<?php
include("../config/config.inc.php");
foreach($_REQUEST as $chiave => $valore){
$chiave = $valore;
}
/*
foreach($_REQUEST as $chiave => $valore){
$$chiave = $valore;
}
*/
if ($action == "deleteimg1"){
unlink('../imgpagine/' . $id . "-01.gif");
unlink('../imgpagine/' . $id . "-01.jpg");
$sql = "UPDATE pagine SET nomeimg1='' WHERE id=$id";
mysql_db_query($db_name,$sql);
mysql_close();
}
if ($action == "deleteimg2"){
unlink('../imgpagine/' . $id . "-02.gif");
unlink('../imgpagine/' . $id . "-02.jpg");
$sql = "UPDATE pagine SET nomeimg2='' WHERE id=$id";
mysql_db_query($db_name,$sql);
mysql_close();
}
if ($action == "deleteimg3"){
unlink('../imgpagine/' . $id . "-03.gif");
unlink('../imgpagine/' . $id . "-03.jpg");
$sql = "UPDATE pagine SET nomeimg3='' WHERE id=$id";
mysql_db_query($db_name,$sql);
mysql_close();
header('location: pagine.php?action=modify&id='.$id);
exit;
}
if ($action == "deleteimg4"){
unlink('../imgpagine/' . $id . "-04.gif");
unlink('../imgpagine/' . $id . "-04.jpg");
$sql = "UPDATE pagine SET nomeimg4='' WHERE id=$id";
mysql_db_query($db_name,$sql);
mysql_close();
header('location: pagine.php?action=modify&id='.$id);
exit;
}
/*MODIFICA RECORD ESISTENTE */
If ($action == "update") {
$sql = "UPDATE pagine SET ";
$sql = $sql . "titolo = '$titolo',";
$sql = $sql . "testo = '$testo',";
$sql = $sql . "descrizione = '$descrizione',";
$sql = $sql . "keys = '$keys',";
$sql = $sql . "WHERE id = $id";
mysql_query($sql) or die('Errore: '.mysql_error());
// inserimento immagini
for($i = 1 ; $i < 5 ; $i++){
$file = "";
$app = "";
if (($_FILES['img'.$i]['name']) != "") {
if($_FILES['img'.$i]['size'] < $MAX_FILE_SIZE) { //il file deve essere inferiore ai 300kb
$estensione = substr($_FILES['img'.$i]['name'],-3);
if ($estensione == "gif" or $estensione == "jpg" or $estensione == "JPG" or $estensione == "GIF") {
$app = $i;
if(strlen($app)==1){
$app = '0'.$app;
}
$file = $id . "-" . $app .'.'. $estensione;
$destination = '../imgpagine/'.$file;
$temp_file = $_FILES['img'.$i]['tmp_name'];
// RIDIMENSIONAMENTO IMMAGINE
// Ottengo le informazioni sull'immagine originale
list($width, $height, $type, $attr) = getimagesize($_FILES['img'.$i]['tmp_name']);
$proporzione = $width/$height;
if($width > $height){
$larg = 640;
$alte = $larg / $proporzione;
}else{
$alte = 480;
$larg = $alte * $proporzione;
}
$thumb = imagecreatetruecolor($larg, $alte);
if($estensione == 'jpg' OR $estensione == 'JPG'){
$source = imagecreatefromjpeg($_FILES['img'.$i]['tmp_name']);
}elseif($estensione == 'gif' OR $estensione == 'GIF'){
$source = imagecreatefromgif($_FILES['img'.$i]['tmp_name']);
}
imagecopyresized($thumb, $source, 0, 0, 0, 0, $larg, $alte, $width, $height);
if($estensione == 'jpg' OR $estensione == 'JPG'){
if (imagejpeg($thumb, $destination, 85)) {
$sql = "UPDATE pagine SET nomeimg" . $i . " = '" . $file . "' WHERE id = $id";
mysql_query($sql) or die('Errore: '.mysql_error());
}
}elseif($estensione == 'gif' OR $estensione == 'GIF'){
if (imagegif($thumb, $destination)) {
$sql = "UPDATE pagine SET nomeimg" . $i . " = '" . $file . "' WHERE id = $id";
mysql_query($sql) or die('Errore: '.mysql_error());
}
}
}
}
}
}
// fine inserimento immagini
mysql_close();
header("Location
agine.php?msg=ok");
exit;
}
?>
sono 2 pagine: pagina.php e pagineManage.php, ho copiato manage che non risponde e manda una pagina bianca... Grazie.
<?php
include("../config/config.inc.php");
foreach($_REQUEST as $chiave => $valore){
$chiave = $valore;
}
/*
foreach($_REQUEST as $chiave => $valore){
$$chiave = $valore;
}
*/
if ($action == "deleteimg1"){
unlink('../imgpagine/' . $id . "-01.gif");
unlink('../imgpagine/' . $id . "-01.jpg");
$sql = "UPDATE pagine SET nomeimg1='' WHERE id=$id";
mysql_db_query($db_name,$sql);
mysql_close();
}
if ($action == "deleteimg2"){
unlink('../imgpagine/' . $id . "-02.gif");
unlink('../imgpagine/' . $id . "-02.jpg");
$sql = "UPDATE pagine SET nomeimg2='' WHERE id=$id";
mysql_db_query($db_name,$sql);
mysql_close();
}
if ($action == "deleteimg3"){
unlink('../imgpagine/' . $id . "-03.gif");
unlink('../imgpagine/' . $id . "-03.jpg");
$sql = "UPDATE pagine SET nomeimg3='' WHERE id=$id";
mysql_db_query($db_name,$sql);
mysql_close();
header('location: pagine.php?action=modify&id='.$id);
exit;
}
if ($action == "deleteimg4"){
unlink('../imgpagine/' . $id . "-04.gif");
unlink('../imgpagine/' . $id . "-04.jpg");
$sql = "UPDATE pagine SET nomeimg4='' WHERE id=$id";
mysql_db_query($db_name,$sql);
mysql_close();
header('location: pagine.php?action=modify&id='.$id);
exit;
}
/*MODIFICA RECORD ESISTENTE */
If ($action == "update") {
$sql = "UPDATE pagine SET ";
$sql = $sql . "titolo = '$titolo',";
$sql = $sql . "testo = '$testo',";
$sql = $sql . "descrizione = '$descrizione',";
$sql = $sql . "keys = '$keys',";
$sql = $sql . "WHERE id = $id";
mysql_query($sql) or die('Errore: '.mysql_error());
// inserimento immagini
for($i = 1 ; $i < 5 ; $i++){
$file = "";
$app = "";
if (($_FILES['img'.$i]['name']) != "") {
if($_FILES['img'.$i]['size'] < $MAX_FILE_SIZE) { //il file deve essere inferiore ai 300kb
$estensione = substr($_FILES['img'.$i]['name'],-3);
if ($estensione == "gif" or $estensione == "jpg" or $estensione == "JPG" or $estensione == "GIF") {
$app = $i;
if(strlen($app)==1){
$app = '0'.$app;
}
$file = $id . "-" . $app .'.'. $estensione;
$destination = '../imgpagine/'.$file;
$temp_file = $_FILES['img'.$i]['tmp_name'];
// RIDIMENSIONAMENTO IMMAGINE
// Ottengo le informazioni sull'immagine originale
list($width, $height, $type, $attr) = getimagesize($_FILES['img'.$i]['tmp_name']);
$proporzione = $width/$height;
if($width > $height){
$larg = 640;
$alte = $larg / $proporzione;
}else{
$alte = 480;
$larg = $alte * $proporzione;
}
$thumb = imagecreatetruecolor($larg, $alte);
if($estensione == 'jpg' OR $estensione == 'JPG'){
$source = imagecreatefromjpeg($_FILES['img'.$i]['tmp_name']);
}elseif($estensione == 'gif' OR $estensione == 'GIF'){
$source = imagecreatefromgif($_FILES['img'.$i]['tmp_name']);
}
imagecopyresized($thumb, $source, 0, 0, 0, 0, $larg, $alte, $width, $height);
if($estensione == 'jpg' OR $estensione == 'JPG'){
if (imagejpeg($thumb, $destination, 85)) {
$sql = "UPDATE pagine SET nomeimg" . $i . " = '" . $file . "' WHERE id = $id";
mysql_query($sql) or die('Errore: '.mysql_error());
}
}elseif($estensione == 'gif' OR $estensione == 'GIF'){
if (imagegif($thumb, $destination)) {
$sql = "UPDATE pagine SET nomeimg" . $i . " = '" . $file . "' WHERE id = $id";
mysql_query($sql) or die('Errore: '.mysql_error());
}
}
}
}
}
}
// fine inserimento immagini
mysql_close();
header("Location

exit;
}
?>