Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- include "koneksi.php";
- if ( isset($_POST['username']) && isset($_POST['password'])){
- $username = $_POST['username'];
- $password = md5($_POST['password']);
- $sql = "SELECT id FROM user WHERE username='$username' AND password='$password' LIMIT 1";
- $qry = mysqli_query($kon,$sql);
- $hsl = mysqli_fetch_array($qry);
- if ( mysqli_num_rows($qry) == 1){
- $_SESSION['userid'] = $hsl[0];
- $_SESSION['username'] = $hsl[1];
- header('location:admin/');
- } else {
- header('location:index.php?error='.base64_encode('Username dan Password salah!'));
- }
- }
- else{
- header('location:index.php');
- exit;
- }
- ?>
Add Comment
Please, Sign In to add comment