Ok, now I tried to do It, and it goes like this:
I have two files, one called enviar.php, which has the forms and the access to de database, and includes the files process.php. The process.php is the file that sends all the info to the database. I made it like this:
<?php
require_once("imagick_class.php");
include("global.inc.php");
$errors=0;
$error="Ocorreram os seguintes erros enquanto processávamos o seu formulário:<ul>";
pt_register('POST','Nome');
pt_register('POST','Projecto');
pt_register('POST','Zona');
pt_register('POST','Modelo');
pt_register('POST','Alteracoes');
$Alteracoes=preg_replace("/(\015\012)|(\015)|(\012)/"," <br />", $Alteracoes);pt_register('POST','Outros');
$Outros=preg_replace("/(\015\012)|(\015)|(\012)/"," <br />", $Outros);pt_register('POST','Score');
pt_register('POST','Activar');
$Imagem1=$HTTP_POST_FILES['Imagem1'];
$Imagem2=$HTTP_POST_FILES['Imagem2'];
$Imagem3=$HTTP_POST_FILES['Imagem3'];
$Imagem4=$HTTP_POST_FILES['Imagem4'];
$Imagem5=$HTTP_POST_FILES['Imagem5'];
$Imagem6=$HTTP_POST_FILES['Imagem6'];
if($Nome=="" || $Modelo=="" || $Alteracoes=="" || $Imagem1=="" ){
$errors=1;
$error.="<li>Não preencheu um ou mais campos obrigatórios.";
}
if(!is_uploaded_file($HTTP_POST_FILES['Imagem1']['tmp_name'])){
$error.="<li>A 1ª imagem, ".$HTTP_POST_FILES['Imagem1']['name'].", não foi enviada!";
$errors=1;
}
if(!is_uploaded_file($HTTP_POST_FILES['Imagem2']['tmp_name'])){
$image_list[8].="nenhuma.jpg";
$errors=0;
}
if(!is_uploaded_file($HTTP_POST_FILES['Imagem3']['tmp_name'])){
$error.="<li>A 3ª imagem, ".$HTTP_POST_FILES['Imagem3']['name'].", não foi enviada!";
$errors=0;
}
if(!is_uploaded_file($HTTP_POST_FILES['Imagem4']['tmp_name'])){
$error.="<li>A 4ª imagem, ".$HTTP_POST_FILES['Imagem4']['name'].", não foi enviada!";
$errors=0;
}
if(!is_uploaded_file($HTTP_POST_FILES['Imagem5']['tmp_name'])){
$error.="<li>A 5ª imagem, ".$HTTP_POST_FILES['Imagem5']['name'].", não foi enviada!";
$errors=0;
}
if(!is_uploaded_file($HTTP_POST_FILES['Imagem6']['tmp_name'])){
$error.="<li>A 6ª imagem, ".$HTTP_POST_FILES['Imagem6']['name'].", não foi enviada!";
$errors=0;
}
if($errors==1) echo $error;
else{
$image_part = date("h_i_s")."_".$HTTP_POST_FILES['Imagem1']['name'];
$image_list[8] = $image_part;
copy($HTTP_POST_FILES['Imagem1']['tmp_name'], "fotos/".$image_part);
$image_part = date("h_i_s")."_".$HTTP_POST_FILES['Imagem2']['name'];
$image_list[9] = $image_part;
copy($HTTP_POST_FILES['Imagem2']['tmp_name'], "fotos/".$image_part);
$image_part = date("h_i_s")."_".$HTTP_POST_FILES['Imagem3']['name'];
$image_list[10] = $image_part;
copy($HTTP_POST_FILES['Imagem3']['tmp_name'], "fotos/".$image_part);
$image_part = date("h_i_s")."_".$HTTP_POST_FILES['Imagem4']['name'];
$image_list[11] = $image_part;
copy($HTTP_POST_FILES['Imagem4']['tmp_name'], "fotos/".$image_part);
$image_part = date("h_i_s")."_".$HTTP_POST_FILES['Imagem5']['name'];
$image_list[12] = $image_part;
copy($HTTP_POST_FILES['Imagem5']['tmp_name'], "fotos/".$image_part);
$image_part = date("h_i_s")."_".$HTTP_POST_FILES['Imagem6']['name'];
$image_list[13] = $image_part;
copy($HTTP_POST_FILES['Imagem6']['tmp_name'], "fotos/".$image_part);
$where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));
$message="Nome: ".$Nome."
Projecto: ".$Projecto."
Zona: ".$Zona."
Modelo: ".$Modelo."
Alteracoes: ".$Alteracoes."
Outros: ".$Outros."
Score: ".$Score."
Activar: ".$Activar."
Imagem 1: ".$where_form_is."fotos/".$image_list[8]."
Imagem 2: ".$where_form_is."fotos/".$image_list[9]."
Imagem 3: ".$where_form_is."fotos/".$image_list[10]."
Imagem 4: ".$where_form_is."fotos/".$image_list[11]."
Imagem 5: ".$where_form_is."fotos/".$image_list[12]."
Imagem 6: ".$where_form_is."fotos/".$image_list[13]."
";
$link = mysql_connect("localhost","oc-zone","password");
mysql_select_db("oczone_modding",$link);
$query="insert into galeria (nome,projecto,zona,modelo,alteracoes,outros,score,activar,imagem1,imagem2,imagem3,imagem4,imagem5,imagem6) values ('".$Nome."','".$Projecto."','".$Zona."','".$Modelo."','".$Alteracoes."','".$Outros."','".$Score."','".$Activar."','".$image_list[8]."','".$image_list[9]."','".$image_list[10]."','".$image_list[11]."','".$image_list[12]."','".$image_list[13]."')";
mysql_query($query);
header("Refresh: 0;url=http://www.oc-zone.com");
}
?>
I haven´t inserted the part of the $img variables yet, as you told me, and I receive the following error:
Warning: Cannot modify header information - headers already sent by (output started at /home/oc-zone/public_html/Zone/Galeria/imagick_class.php:617) in /home/oc-zone/public_html/Zone/Galeria/process.php on line 88
From what I understand, this must be the class file saying it could not modify the information, because it has already been sent to the database. So, where should I put those variables?
And I can´t understand what both this variables do:
This one, should I change anything?
$img = new ImageMagick($_FILES[file_form]);
And this one, should I insert the location where thumbnails (in wherever) should go, like /Zone/Galeria/Thumbnails/ ?
$img->setTargetdir('whereever');
You can see the page right here -> http://www.oc-zone.com/phptonuke.php?filnavn=Zone/Galeria/enviar.php
Thankx for all the help! 😉