<?php
ob_start();
session_start();
include("../../../config.php");
$dte=date('d/m/Y');
$dtdoc=date('Y-m-d');
$dteE=date('Y-m-d h:i:s');
$added_by=$_SESSION['user'];
$added_on=date('Y-m-d h:i:s');
$sts="$sts";
$filephoto=$_FILES['pdf']['name'];
$uploadphoto=$_SERVER['DOCUMENT_ROOT'].$download_path;
$fileNamephoto=$filephoto;
$target_pathphoto = $uploadphoto . $fileNamephoto;
move_uploaded_file($_FILES['pdf']['tmp_name'], $target_pathphoto);
$filephoto1=$_FILES['img1']['name'];
$uploadphoto1=$_SERVER['DOCUMENT_ROOT'].$download_path;
$fileNamephoto1=$filephoto1;
$target_pathphoto1 = $uploadphoto1 . $fileNamephoto1;
move_uploaded_file($_FILES['img1']['tmp_name'], $target_pathphoto1);
$filephoto2=$_FILES['img2']['name'];
$uploadphoto2=$_SERVER['DOCUMENT_ROOT'].$download_path;
$fileNamephoto2=$filephoto2;
$target_pathphoto2 = $uploadphoto2 . $fileNamephoto2;
move_uploaded_file($_FILES['img2']['tmp_name'], $target_pathphoto2);
$filephoto3=$_FILES['img3']['name'];
$uploadphoto3=$_SERVER['DOCUMENT_ROOT'].$download_path;
$fileNamephoto3=$filephoto3;
$target_pathphoto3 = $uploadphoto3 . $fileNamephoto3;
move_uploaded_file($_FILES['img3']['tmp_name'], $target_pathphoto3);
$sql=mysqli_query($conn,"select * from pataward where id='".$_POST['idD']."'");
$rw=mysqli_fetch_array($sql);
$pdf=$rw['pdf'];
$img1=$rw['img1'];
$img2=$rw['img2'];
$img3=$rw['img3'];
if($_FILES['pdf']['name']==''){
$pdff=$pdf;
}else{
$pdff=$fileNamephoto;
}
if($_FILES['img1']['name']==''){
$img11=$img1;
}else{
$img11=$fileNamephoto1;
}
if($_FILES['img2']['name']==''){
$img22=$img2;
}else{
$img22=$fileNamephoto2;
}
if($_FILES['img3']['name']==''){
$img33=$img3;
}else{
$img33=$fileNamephoto3;
}
$sqlBl="UPDATE pataward SET ";
$sqlBl=$sqlBl."name='".$_POST['name']."',";
$sqlBl=$sqlBl."title='".$_POST['title']."',";
$sqlBl=$sqlBl."link='".$_POST['link']."',";
$sqlBl=$sqlBl."pdf='".$pdff."',";
$sqlBl=$sqlBl."img1='".$img11."',";
$sqlBl=$sqlBl."img2='".$img22."',";
$sqlBl=$sqlBl."img3='".$img33."',";
$sqlBl=$sqlBl."added_by='".$added_by."',";
$sqlBl=$sqlBl."status='".$sts."',";
$sqlBl=$sqlBl."added_on='".$added_on."'";
$sqlBl=$sqlBl." where id='".$_POST['idD']."'";
$UsQuery=mysqli_query($conn,$sqlBl);
if($UsQuery){
header('location:'.$home_path.'/pages/master/editpa.php?msg=success&id='.$_POST['idD']);
}else{
header('location:'.$home_path.'/pages/master/editpa.php?msg=error&id='.$_POST['idD']);
}
?>
|