Add pedoman content and editor assets
This commit is contained in:
32
pedoman/authlogin.php
Normal file
32
pedoman/authlogin.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
include('koneksi.php');
|
||||
|
||||
session_start();
|
||||
// cek apakah tombol simpan sudah diklik atau blum?
|
||||
if (isset($_POST['login'])) {
|
||||
$username = $_POST['username'];
|
||||
// $username = ereg_replace("\sOR\s|\=|\#", "", $username);
|
||||
|
||||
$pass = $_POST['password'];
|
||||
$pass = md5(trim($pass));
|
||||
|
||||
$sql = "SELECT * FROM user WHERE username='".$username."' AND password='".md5($pass)."'";
|
||||
$query = mysqli_query($koneksi, $sql);
|
||||
|
||||
$user = mysqli_fetch_array($query);
|
||||
|
||||
if ($user['username']==$username) {
|
||||
setcookie('ebookft', "".$username.".".md5($pass)."", (time() + 3600 * 3), "/", "", 0);
|
||||
$_SESSION['ebookft'] = "".$username.".".md5($pass)."";
|
||||
|
||||
$message = 'Login berhasil!';
|
||||
header('Location: admin.php?pesan='.$message.'&tipe=sukses¬if=ok');
|
||||
mysqli_close();
|
||||
} else {
|
||||
$message = 'Gagal! Cek username dan password anda.';
|
||||
header('Location: login.php?notif=ok&tipe=alert&pesan='.$message.'');
|
||||
}
|
||||
} else {
|
||||
die("Akses dilarang!");
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user