Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- ob_start();
- include "../koneksi.php";
- if (isset($_POST['username']) && isset($_POST['password'])) {
- $username = addslashes(htmlspecialchars(mysqli_real_escape_string($con, $_POST['username'])));
- $password = addslashes(htmlspecialchars(mysqli_real_escape_string($con, md5($_POST['password']))));
- }
- else {
- die("<h1>Login Dulu >:(</h1>");
- }
- $q = "SELECT * FROM admin WHERE username='$username' AND password='$password'";
- $query = mysqli_query($con, $q);
- $srow = mysqli_num_rows($query);
- $r=mysqli_fetch_array($query);
- if ($srow > 0) {
- $_SESSION[level]= $r[level];
- $_SESSION[username] = $r[username];
- $_SESSION[password] = $r[password];
- header('location:index.php');
- }
- else{
- ?><script>alert("U/P salah");document.location.href="index.php"</script> <!--document.location.href="index.php"-->
- <?php
- }
- mysqli_close($con);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement