$nama_file = $_FILES['fupload']['name']; $acak = rand(00, 999); $judul_seo = seo_title($_POST['nama']); $img_seo = substr($judul_seo, 0, 50); $nama_web = 'cincinkawinperak'; $nama_file_unik = $nama_web . '-' . $acak . '-' . $img_seo . '-' . $nama_file; if (!empty($lokasi_file)) { if ($tipe_file != "image/jpeg" and $tipe_file != "image/pjpeg" and $tipe_file != "image/gif" and $tipe_file != "image/png") { ?> <script>window.alert("Upload Gagal, Pastikan File yang di Upload bertipe *.JPG, *.GIF, *.PNG"); window.location=("../../media.php?module=<?php echo $module . '&act=insertnew'; ?> ")</script>; <?php die; } ImageUpload($fupload_name = $nama_file_unik, $to_dir = '../../../joimg/articles/'); // Proses watermark image //watermark_image("../../../joimg/articles/$nama_file_unik", "../../../joimg/articles/$nama_file_unik"); mysql_query("INSERT INTO articles(\n\t \t\t\t\t\ttitle,\n\t\t\t\t\t\tcontent,\n\t\t\t\t\t\tdate,\n\t\t\t\t\t\timage,\n\t\t\t\t\t\tseo) \n\t VALUES(\n\t\t\t\t\t\t'{$_POST['nama']}',\n\t\t\t\t\t\t'{$text}',\n\t\t\t\t\t\t'{$tgl_sekarang}',\n\t\t\t\t\t\t'{$nama_file_unik}',\n\t\t\t\t\t\t'{$judul_seo}' )"); } else { mysql_query("INSERT INTO articles(\n\t\t\t\t\t\ttitle,\n\t\t\t\t\t\tdate,\n\t\t\t\t\t\tcontent,\n\t\t\t\t\t\tseo) \n\t \tVALUES(\n\t\t\t\t\t\t'{$_POST['nama']}',\n\t\t\t\t\t\t'{$tgl_sekarang}',\n\t\t\t\t\t\t'{$text}',\n\t\t\t\t\t\t'{$judul_seo}' )"); } echo "<script>alert('Sukses! Data Telah Berhasil Disimpan.'); window.location = '../../media.php?module={$module}';</script>"; //header('location:../../media.php?module='.$module); } else { echo "<script>alert('Maaf ! Data Gagal Disimpan, Silahkan coba lagi.'); window.location = '../../media.php?module={$module}';</script>"; } } }
$tipe_file = $_FILES['fupload']['type']; $nama_file = $_FILES['fupload']['name']; $acak = rand(00, 999999); $nama_file_unik = $acak . $nama_file; if (!empty($lokasi_file)) { if ($tipe_file != "image/jpeg" and $tipe_file != "image/pjpeg" and $tipe_file != "image/gif" and $tipe_file != "image/png") { ?> <script>window.alert("Upload Gagal, Pastikan File yang di Upload bertipe *.JPG, *.GIF, *.PNG"); window.location=("../../media.php?module=<?php echo $module . '&act=edit&id=' . $_POST['id']; ?> ")</script>; <?php die; } $tampil = mysql_query("SELECT * FROM modul WHERE id_modul='{$_POST['id']}'"); $ex = mysql_fetch_array($tampil); if ($ex['gambar'] != '') { unlink("../../../joimg/logo/{$ex['gambar']}"); } ImageUpload($fupload_name = $nama_file_unik, $to_dir = '../../../joimg/logo/'); mysql_query("UPDATE modul SET\n\t\t\t\t\t\t\t\tnama_modul \t= '{$_POST['nama']}',\n\t\t\t\t\t\t\t\tlink \t= '{$_POST['link']}',\n\t\t\t\t\t\t\t\tgambar \t= '{$nama_file_unik}'\n\t\t\t\t\t\n\t\t\t\t\t\t\tWHERE id_modul \t= '{$_POST['id']}'\n\t\t\t\t\t"); } else { mysql_query("UPDATE modul SET \t\n\t\t\t\t\t\t\t\tnama_modul \t= '{$_POST['nama']}',\n\t\t\t\t\t\t\t\tlink \t= '{$_POST['link']}',\n\t\t\t\t\t\t\t\tgambar \t= '{$nama_file_unik}'\n\n\t\t\t\t\t\t\tWHERE id_modul \t= '{$_POST['id']}'\n\t\t\t\t\t"); } echo "<script>alert('Sukses! Data Telah Berhasil Disimpan.'); window.location = '../../media.php?module={$module}';</script>"; } else { echo "<script>alert('Maaf! Data Gagal Disimpan, Silahkan coba lagi.'); window.location = '../../media.php?module={$module}';</script>"; } } }
// Update Room Type if ($module == 'testimoni' and $act == 'insertnew') { $lokasi_file = $_FILES['fupload']['tmp_name']; $tipe_file = $_FILES['fupload']['type']; $nama_file = $_FILES['fupload']['name']; $judul_seo = seo_title($_POST['nama']); $img_seo = substr($judul_seo, 0, 50); $acak = rand(00, 999); $nama_file_unik = 'cincin-kawin-perak-' . $acak . '-' . $img_seo . '-' . $nama_file; if (!empty($lokasi_file)) { if ($tipe_file != "image/jpeg" and $tipe_file != "image/pjpeg" and $tipe_file != "image/gif" and $tipe_file != "image/png") { ?> <script>window.alert("Upload Gagal, Pastikan File yang di Upload bertipe *.JPG, *.GIF, *.PNG"); window.location=("../../media.php?module=<?php echo $module . '&act=edit&id=' . $_POST['id']; ?> ")</script>; <?php die; } ImageUpload($fupload_name = $nama_file_unik, $to_dir = '../../../joimg/testimoni/'); mysql_query("INSERT INTO testimoni \n\t\t \t\t\t\t\t\t\t(\t\n\t\t \t\t\t\t\t\t\t\tnama,\n\t\t\t\t\t\t\t\t\t\tisi,\n\t\t\t\t\t\t\t\t\t\tgambar,\n\t\t\t\t\t\t\t\t\t\ttanggal\n\t\t\t\t\t\t\t\t\t) \n\t\t \tVALUES\n\t\t \t\t\t\t(\n\t\t \t\t\t\t\t'{$_POST['nama']}',\n\t\t\t\t\t\t\t\t\t\t'{$text}',\n\t\t\t\t\t\t\t\t\t\t'{$nama_file_unik}',\n\t\t\t\t\t\t\t\t\t\t'{$_POST['tanggal']}'\n\t\t\t\t\t\t\t\t\t)\n\t\t \t\t\t"); } else { mysql_query("INSERT INTO testimoni\n\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\tnama,\n\t\t\t\t\t\t\t\t\t\tisi,\n\t\t\t\t\t\t\t\t\t\ttanggal\n\t\t\t\t\t\t\t\t\t) \n\t \t\tVALUES\n\t \t\t\t\t\t(\n\t \t\t\t\t\t \t'{$_POST['nama']}',\n\t\t\t\t\t\t\t\t\t\t'{$text}',\n\t\t\t\t\t\t\t\t\t \t'{$_POST['tanggal']}'\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t"); } echo "<script>alert('Sukses! Data Telah Berhasil Disimpan.'); window.location = '../../media.php?module={$module}';</script>"; } else { echo "<script>alert('Maaf! Data Gagal Disimpan, Silahkan coba lagi.'); window.location = '../../media.php?module={$module}';</script>"; } } }