PATH: /home/hwyuvbry/public_html/kerbau/function
FILE_BARU
CREATE
FOLDER_BARU
MKDIR
UPLOAD_FILE
GO
[ .. KEMBALI ]
📄 add-bank.php
↓
X
📄 add-banner.php
↓
X
📄 add-game.php
↓
X
📄 add-member.php
↓
X
📄 add-post.php
↓
X
📄 add-promo.php
↓
X
📄 add-promosid.php
↓
X
📄 add-slide.php
↓
X
📄 add-user.php
↓
X
📄 api_call_scatter.php
↓
X
📄 api_nexusggr.php
↓
X
📄 api_set_rtp.php
↓
X
📄 bank-status.php
↓
X
📄 banner-status.php
↓
X
📄 banner.php
↓
X
📄 del-backup.php
↓
X
📄 del-bank.php
↓
X
📄 del-banner.php
↓
X
📄 del-post.php
↓
X
📄 del-promosid.php
↓
X
📄 del-slide.php
↓
X
📄 del-user.php
↓
X
📄 delete_qris.php
↓
X
📄 edit-member.php
↓
X
📄 edit-user.php
↓
X
📄 end-session.php
↓
X
📄 error_log
↓
X
📄 getwinner.php
↓
X
📄 getwinner_2.php
↓
X
📄 index.php
↓
X
📄 integapi.php
↓
X
📄 minimal.php
↓
X
📄 nexus.php
↓
X
📄 post-chat.php
↓
X
📄 post-status.php
↓
X
📄 proses-group.php
↓
X
📄 proses_topup-manual.php
↓
X
📄 proses_topup.php
↓
X
📄 proses_withdraw.php
↓
X
📄 qris.php
↓
X
📄 reject_topup.php
↓
X
📄 reject_withdraw.php
↓
X
📄 setting.php
↓
X
📄 slide-status.php
↓
X
📄 social.php
↓
X
📄 topup.php
↓
X
📄 update_qris.php
↓
X
📄 user-game.php
↓
X
📄 user-status.php
↓
X
SAVING...
BERHASIL DIUBAH!
EDITING: update_qris.php
<?php require_once('session.php'); $id_qris = intval($_POST['id'] ?? 0); $nama_qris = mysqli_real_escape_string($conn, $_POST['nama_qris'] ?? ''); $status = intval($_POST['status'] ?? 1); // default aktif $uploadDir = '../../upload/'; // Pastikan folder upload ada if (!file_exists($uploadDir)) { mkdir($uploadDir, 0777, true); } // Ambil data lama $old = mysqli_fetch_assoc(mysqli_query($conn, "SELECT * FROM tb_qris WHERE id = '$id_qris' LIMIT 1")); $old_image = $old['gambar_qris'] ?? ''; if (isset($_FILES['image']) && $_FILES['image']['error'] == 0) { $allowed = ['jpg', 'jpeg', 'png']; $filename = $_FILES['image']['name']; $filesize = $_FILES['image']['size']; $filetmp = $_FILES['image']['tmp_name']; $ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); // Validasi ekstensi if (!in_array($ext, $allowed)) { header("Location: ../edit_qris.php?id=$id_qris¬if=3"); exit; } // Validasi ukuran if ($filesize > 2 * 1024 * 1024) { header("Location: ../edit_qris.php?id=$id_qris¬if=2"); exit; } // Nonaktifkan semua QRIS lama jika status baru adalah aktif if ($status == 1) { mysqli_query($conn, "UPDATE tb_qris SET status = 0"); } // Nama file baru unik $newname = 'qris_' . time() . '.' . $ext; $target = $uploadDir . $newname; if (move_uploaded_file($filetmp, $target)) { // Hapus gambar lama jika ada if ($old_image && file_exists($uploadDir . $old_image)) { unlink($uploadDir . $old_image); } // Update database dengan gambar baru $sql = "UPDATE tb_qris SET nama_qris='$nama_qris', gambar_qris='$newname', keterangan='Aktif', status='$status' WHERE id='$id_qris'"; } else { echo "Upload gagal!"; exit; } } else { // Jika tidak upload gambar baru, tetap update nama & status if ($status == 1) { mysqli_query($conn, "UPDATE tb_qris SET status = 0"); } $sql = "UPDATE tb_qris SET nama_qris='$nama_qris', keterangan='Aktif', status='$status' WHERE id='$id_qris'"; } // Jalankan query update if (mysqli_query($conn, $sql)) { header("Location: ../qris.php?notif=1"); exit; } else { echo "Database error: " . mysqli_error($conn); } ?>
SIMPAN PERUBAHAN