Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //===========================proses login=======================================
- <?php
- include("../koneksi.php");
- $usr = $_POST['username'];
- $pwd = md5($_POST['password']);
- $user = stripcslashes($usr);
- $password = stripcslashes($pwd);
- $query = "SELECT * FROM user where username = '$user' and password = '$password'";
- $sql = mysqli_query($koneksi,$query) or die(mysqli_error());
- $hitung = mysqli_fetch_array($sql,MYSQLI_ASSOC);
- mysqli_close($koneksi);
- if($hitung['Status'] == 'admin'){
- $_SESSION['user'] = $pengguna;
- header('location: ../utama.php');
- }
- else if($hitung['Status'] == 'kepsek'){
- $_SESSION['user'] = $pengguna;
- header('location: ../utama.php');
- }
- else{
- echo "username atau password salah, silahkan <a href='../index.php'>coba lagi</a>";
- }
- ?>
- //=============================halaman admin===========================================
- <?php
- include("koneksi.php");
- session_start();
- if(isset($_SESSION['pengguna'])){
- header('location:index.php');
- }
- print_r($_SESSION['pengguna']) ;
- ?>
- <html>...........</html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement