Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(isset($_SESSION['access']) != 'admin'){
- header('location:index.php');
- }
- if(isset($_SESSION['username']) && isset($_SESSION['kelass'])){
- $user = $_SESSION['username'];
- $kelas = $_SESSION['kelass'];
- $query = mysqli_query($con,"SELECT * FROM piket WHERE
- kelas = '$kelas' ORDER BY tgl_piket DESC");
- }else {
- header('location:login.php');
- }
- ?>
- if(isset($_SESSION['access']) != 'user'){
- header('location:indexp.php');
- }
- if(isset($_SESSION['username']) && isset($_SESSION['kelass'])){
- $user = $_SESSION['username'];
- $kelas = $_SESSION['kelass'];
- if (date('D')=='Mon') {
- $query = mysqli_query($con,"SELECT * FROM siswa where hari='senin' and kelas='$kelas' ORDER BY no ASC");
- $haridb="senin";
- }
- elseif (date('D')=='Tue') {
- $query = mysqli_query($con,"SELECT * FROM siswa where hari='selasa' and kelas='$kelas' ORDER BY no ASC");
- $haridb="selasa";
- }
- elseif (date('D')=='Wed') {
- $query = mysqli_query($con,"SELECT * FROM siswa where hari='rabu' and kelas='$kelas' ORDER BY no ASC");
- $haridb="rabu";
- }
- elseif (date('D')=='Thu') {
- $query = mysqli_query($con,"SELECT * FROM siswa where hari='kamis' and kelas='$kelas' ORDER BY no ASC");
- $haridb="kamis";
- }
- elseif (date('D')=='Fri') {
- $query = mysqli_query($con,"SELECT * FROM siswa where hari='jumat' and kelas='$kelas' ORDER BY no ASC");
- $haridb="jumat";
- }
- }else {
- header('location:login.php');
- }
- if(isset($_POST['submit'])){
- $username = $_POST['username'];
- $password = md5($_POST['password']);
- $query = mysqli_query($con, "SELECT * FROM users WHERE username = '$username' and password = '$password'");
- $gettype = mysqli_fetch_assoc($query);
- echo $gettype['access'];
- $check = mysqli_num_rows($query);
- if ($check > 0) {
- if($gettype['access']=='user'){
- $_SESSION['access'] = 'user';
- $_SESSION['username'] = $gettype['username'];
- header('location:index.php');
- }
- else if ($gettype['access']=='admin') {
- $_SESSION['access']== 'admin';
- $_SESSION['username'] = $gettype['username'];
- $_SESSION['admin'] = 1;
- header('location:indexp.php');
- }
- }
- }
Add Comment
Please, Sign In to add comment