include("connessione.php");
if ($userlog<>"OK"){
session_start();
session_destroy();
session_start();
header("Location:login.php");
exit();
}
if($passa=="3"){
$sql_delete = "DELETE FROM cv WHERE ID='$id'";
$result_delete = mysql_db_query($database, $sql_delete, $db);
}
if($passa=="2"){
if($id==""){
$sql_in = "INSERT INTO cv (data) VALUES ('".mktime()."')";
$result_in = mysql_db_query($database, $sql_in, $db);
$id=mysql_insert_id($db);
}
ini_set("memory_limit", "128M");
if(copy( $fprincipale , "/web/htdocs/www.encocrema.com/home/immagini/$fprincipale_name" )){
$new_file_d="cv_".mktime().".jpg";
$image = "/web/htdocs/www.encocrema.com/home/immagini/$fprincipale_name";
$newimage = "/web/htdocs/www.encocrema.com/home/immagini/t_$new_file_d";
$image_quality = 80;
$addborder = 1;
$max_height = 150;
$max_width = 150;
$src_img = ImageCreateFromJpeg($image);
$orig_x = ImageSX($src_img);
$orig_y = ImageSY($src_img);
$new_y = $max_height;
$new_x = $orig_x/($orig_y/$max_height);
if ($new_x > $max_width) {
$new_x = $max_width;
$new_y = $orig_y/($orig_x/$max_width);
}
$dst_img = ImageCreateTrueColor($new_x,$new_y);
ImageCopyResampled($dst_img, $src_img, 0, 0, 0, 0, $new_x, $new_y, $orig_x, $orig_y);
if ($addborder == 1) {
// Add border
$black = ImageColorAllocate($dst_img, 0, 0, 0);
ImageSetThickness($dst_img, 1);
ImageLine($dst_img, 0, 0, $new_x, 0, $black);
ImageLine($dst_img, 0, 0, 0, $new_y, $black);
ImageLine($dst_img, $new_x-1, 0, $new_x-1, $new_y, $black);
ImageLine($dst_img, 0, $new_y-1, $new_x, $new_y-1, $black);
}
ImageJpeg($dst_img, $newimage, $image_quality);
ImageDestroy($src_img);
ImageDestroy($dst_img);
}
ini_set("memory_limit", "32M");
$sql_up = "UPDATE cv SET ";
if($new_file_d<>""){
$sql_up.= "foto = '$new_file_d', ";
}
$sql_up.= "nome = '$nome', ";
if($lg=="1"){
$sql_up.= " testoita = '$FCKeditor1' ";
}else{
$sql_up.= " testoing = '$FCKeditor1' ";
}
$sql_up.= "WHERE id = '$id'";
$result = mysql_db_query($database,$sql_up,$db);
header("location:cv.php?passa=1&id=$id&lg=$lg");
}
if($passa=="1"){
$query = "SELECT * FROM cv where id='$id'";
$result = mysql_db_query($database, $query, $db);
$row=mysql_fetch_assoc($result);
include("FCKeditor/fckeditor.php");
?>
..::: Enco engineering consulting s.r.l. :::..
exit();
}
$query = "SELECT * FROM cv order by id ";
$result = mysql_db_query($database, $query, $db);
?>
..::: Enco engineering consulting s.r.l. :::..
mysql_close(); ?>