PATH: //home/hwyuvbry/sahabat.waroenkhoki123.web.id/blacklist/template/page/qris
FILE_BARU
CREATE
FOLDER_BARU
MKDIR
UPLOAD_FILE
GO
[ .. KEMBALI ]
📄 edit_qris.php
↓
X
📄 hapus_qris.php
↓
X
📄 proses_edit_qris.php
↓
X
📄 qris.php
↓
X
📄 qris.php#
↓
X
📄 tambah_qris.php
↓
X
SAVING...
BERHASIL DIUBAH!
EDITING: proses_edit_qris.php
<?php if ($c['level'] == "superadmin") { if (isset($_POST['upload'])) { $id = $_POST['id']; $ekstensi_diperbolehkan = array('png','jpg','jpeg','gif'); $nama_file = $_FILES['file']['name']; $tmp_file = $_FILES['file']['tmp_name']; $ukuran_file = $_FILES['file']['size']; // cek apakah file dipilih if ($nama_file == "") { echo "<script>alert('Pilih gambar terlebih dahulu!'); window.location='?page=qris';</script>"; exit; } // ambil ekstensi $ext = strtolower(pathinfo($nama_file, PATHINFO_EXTENSION)); // validasi ekstensi if (!in_array($ext, $ekstensi_diperbolehkan)) { echo "<script>alert('Format harus PNG, JPG, JPEG, GIF'); window.location='?page=qris';</script>"; exit; } // validasi ukuran (max 2MB) if ($ukuran_file > 2000000) { echo "<script>alert('Ukuran file terlalu besar! Max 2MB'); window.location='?page=qris';</script>"; exit; } // ambil gambar lama $get = mysqli_query($koneksi, "SELECT gambar FROM tb_qris WHERE id='$id'"); $data = mysqli_fetch_assoc($get); // hapus file lama jika ada if ($data && file_exists("../../uploads/qris/".$data['gambar'])) { unlink("../../uploads/qris/".$data['gambar']); } // buat nama file baru (ANTI TABRAK) $nama_baru = uniqid('qris_') . '.' . $ext; // upload file if (move_uploaded_file($tmp_file, "../../uploads/qris/" . $nama_baru)) { // update database $update = mysqli_query($koneksi, "UPDATE tb_qris SET gambar='$nama_baru', status='active' WHERE id='$id'"); if ($update) { echo "<script>alert('Berhasil mengubah gambar'); window.location='?page=qris';</script>"; } else { echo "<script>alert('Gagal update database'); window.location='?page=qris';</script>"; } } else { echo "<script>alert('Upload file gagal'); window.location='?page=qris';</script>"; } } } else { echo "<script>window.location='?page=dashboard';</script>"; } ?>
SIMPAN PERUBAHAN