mirror of
https://github.com/dyzulk/raisen-app.git
synced 2026-01-26 13:22:00 +07:00
first commit
This commit is contained in:
29
act/hapus-pelanggan.php
Normal file
29
act/hapus-pelanggan.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
if( !isset($_SESSION["login"]) ) {
|
||||
header("Location: login.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
require '../functions.php';
|
||||
|
||||
$id = $_GET["id"];
|
||||
|
||||
if( hapusPelanggan($id) > 0 ) {
|
||||
echo "
|
||||
<script>
|
||||
alert('data berhasil dihapus!');
|
||||
document.location.href = '../admin/index.php?p=Data+Pelanggan';
|
||||
</script>
|
||||
";
|
||||
} else {
|
||||
echo "
|
||||
<script>
|
||||
alert('data gagal ditambahkan!');
|
||||
document.location.href = '../admin/index.php?p=Data+Pelanggan';
|
||||
</script>
|
||||
";
|
||||
}
|
||||
|
||||
?>
|
||||
29
act/hapus.php
Normal file
29
act/hapus.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
if( !isset($_SESSION["login"]) ) {
|
||||
header("Location: login.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
require 'functions.php';
|
||||
|
||||
$id = $_GET["id"];
|
||||
|
||||
if( hapus($id) > 0 ) {
|
||||
echo "
|
||||
<script>
|
||||
alert('data berhasil dihapus!');
|
||||
document.location.href = 'index.php';
|
||||
</script>
|
||||
";
|
||||
} else {
|
||||
echo "
|
||||
<script>
|
||||
alert('data gagal ditambahkan!');
|
||||
document.location.href = 'index.php';
|
||||
</script>
|
||||
";
|
||||
}
|
||||
|
||||
?>
|
||||
16
act/index.php
Normal file
16
act/index.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php require_once('../core.php');?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>404 - Forbidden</title>
|
||||
<script>window.location.href = "<?=base_url();?>";</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
85
act/ubah.php
Normal file
85
act/ubah.php
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
if( !isset($_SESSION["login"]) ) {
|
||||
header("Location: login.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
require '../functions.php';
|
||||
|
||||
// ambil data di URL
|
||||
$id = $_GET["id"];
|
||||
|
||||
// query data mahasiswa berdasarkan id
|
||||
$mhs = query("SELECT * FROM mahasiswa WHERE id = $id")[0];
|
||||
|
||||
|
||||
// cek apakah tombol submit sudah ditekan atau belum
|
||||
if( isset($_POST["submit"]) ) {
|
||||
|
||||
// cek apakah data berhasil diubah atau tidak
|
||||
if( ubah($_POST) > 0 ) {
|
||||
echo "
|
||||
<script>
|
||||
alert('data berhasil diubah!');
|
||||
document.location.href = 'index.php';
|
||||
</script>
|
||||
";
|
||||
} else {
|
||||
echo "
|
||||
<script>
|
||||
alert('data gagal diubah!');
|
||||
document.location.href = 'index.php';
|
||||
</script>
|
||||
";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Ubah data mahasiswa</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Ubah data mahasiswa</h1>
|
||||
|
||||
<form action="" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="id" value="<?= $mhs["id"]; ?>">
|
||||
<input type="hidden" name="gambarLama" value="<?= $mhs["gambar"]; ?>">
|
||||
<ul>
|
||||
<li>
|
||||
<label for="nrp">NRP : </label>
|
||||
<input type="text" name="nrp" id="nrp" required value="<?= $mhs["nrp"]; ?>">
|
||||
</li>
|
||||
<li>
|
||||
<label for="nama">Nama : </label>
|
||||
<input type="text" name="nama" id="nama" value="<?= $mhs["nama"]; ?>">
|
||||
</li>
|
||||
<li>
|
||||
<label for="email">Email :</label>
|
||||
<input type="text" name="email" id="email" value="<?= $mhs["email"]; ?>">
|
||||
</li>
|
||||
<li>
|
||||
<label for="jurusan">Jurusan :</label>
|
||||
<input type="text" name="jurusan" id="jurusan" value="<?= $mhs["jurusan"]; ?>">
|
||||
</li>
|
||||
<li>
|
||||
<label for="gambar">Gambar :</label> <br>
|
||||
<img src="../img/<?= $mhs['gambar']; ?>" width="40"> <br>
|
||||
<input type="file" name="gambar" id="gambar">
|
||||
</li>
|
||||
<li>
|
||||
<button type="submit" name="submit">Ubah Data!</button>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user