Add pedoman content and editor assets
This commit is contained in:
75
pedoman/editdatapejabat.php
Normal file
75
pedoman/editdatapejabat.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
include('authsession.php');
|
||||
|
||||
if(isset($_POST['submit'])){
|
||||
|
||||
$sqlisi="SELECT * FROM menu WHERE id='".$_GET['id']."'";
|
||||
$queryisi=mysqli_query($koneksi, $sqlisi);
|
||||
$isi=mysqli_fetch_array($queryisi);
|
||||
|
||||
|
||||
$nama =$_POST['nama'];
|
||||
// $tanggal_lahir =$_POST['tanggal_lahir'];
|
||||
$nip= $_POST['nip'];
|
||||
$pangkat= $_POST['pangkat'];
|
||||
$golongan= $_POST['golongan'];
|
||||
|
||||
echo sys_get_temp_dir();
|
||||
|
||||
echo $nama;
|
||||
echo $nip;
|
||||
echo $pangkat;
|
||||
echo $golongan;
|
||||
|
||||
$target_dir = "uploads/";
|
||||
$target_file = $target_dir.basename($_FILES["foto"]["name"]);
|
||||
$uploadOk = 1;
|
||||
echo $_FILES["foto"]["tmp_name"];
|
||||
echo $_FILES["foto"]["name"];
|
||||
echo $_FILES["foto"]["error"];
|
||||
echo $isi["isimenu"];
|
||||
|
||||
$imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
|
||||
// Check if image file is a actual image or fake image
|
||||
$check = getimagesize($_FILES["foto"]["tmp_name"]);
|
||||
if($check !== false) {
|
||||
echo "File is an image - ".$check["mime"].".";
|
||||
$uploadOk = 1;
|
||||
} else {
|
||||
echo "File is not an image.";
|
||||
$uploadOk = 0;
|
||||
}
|
||||
// Check if file already exists
|
||||
// if (file_exists($target_file)) {
|
||||
// echo "Sorry, file already exists.";
|
||||
// $uploadOk = 0;
|
||||
// }
|
||||
if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg"
|
||||
&& $imageFileType != "gif" ) {
|
||||
echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";
|
||||
$uploadOk = 0;
|
||||
}
|
||||
// Check if $uploadOk is set to 0 by an error
|
||||
if ($uploadOk == 0) {
|
||||
echo "Sorry, your file was not uploaded.";
|
||||
// if everything is ok, try to upload file
|
||||
} else {
|
||||
if (move_uploaded_file($_FILES["foto"]["tmp_name"], $target_file)) {
|
||||
echo "The file ".basename( $_FILES["foto"]["name"])." has been uploaded.";
|
||||
} else {
|
||||
echo "Sorry, there was an error uploading your file.";
|
||||
echo $_FILES["foto"]["error"];
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "UPDATE tb_pejabat SET nama='$nama', nip='$nip', golongan='$golongan', pangkat='$pangkat', foto='$target_file' WHERE id='".$isi['isimenu']."'";
|
||||
$query = mysqli_query($koneksi, $sql);
|
||||
if ($query) {
|
||||
$message = 'Data berhasil disimpan!';
|
||||
header('Location: admin.php?id='.$_GET["id"].'&pesan='.$message.'&tipe=sukses¬if=ok');
|
||||
} else {
|
||||
$message = 'Data gagal disimpan! Mohon diisi ulang.';
|
||||
header('Location: admin.php?id='.$_GET["id"].'&pesan='.$message.'&tipe=alert¬if=ok');
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user