Commit 1afb50cc by Cici

Fungsi login dan logout

parent d14c7912
<?php
session_start();
include_once 'functions/fungsi.php';
include_once 'connection/koneksi.php';
$username = $_POST["username"];
$password = $_POST["password"];
$res_set = mysqli_query($database, "select * from user where username='$username' and password='$password'");
$res = mysqli_fetch_array($res_set);
if ($res_set->num_rows < 1) {
redirect('login.php');
$_SESSION['error'] = TRUE;
} else {
set_session('role', $res["role"]);
set_session('id', $res["id"]);
set_session('first_name', $res["first_name"]);
// die(get_session('role'));
$_SESSION['isLogin'] = TRUE;
// die(get_session('id'));
redirect('index.php');
}
<?php
session_start();
include_once 'functions/fungsi.php';
include_once 'connection/koneksi.php';
destroy_session("role");
destroy_session("isLogin");
redirect('index.php');
?>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment