sri211500

library

Jan 21st, 2020
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. <?php
  2. session_start();
  3.  
  4. function base_url(){
  5. return "http://localhost/db_pwpb20/vLogin.php";
  6. }
  7.  
  8. function flash($pesan){
  9. if(empty($pesan)){
  10. $pesan=$_SESSION[$tipe];
  11. unset($_SESSION[$tipe]);
  12. return $pesan;
  13. }
  14. else{
  15. $_SESSION[$tipe]=$pesan;
  16. }
  17. }
  18.  
  19. function cekLogin(){
  20. $username=@$_SESSION['username'];
  21. $level=@$_SESSION['level'];
  22.  
  23. if(empty($username) AND EMPTY($level)){
  24. header('location:login.php');
  25. }
  26. }
  27.  
  28. function sudahLogin(){
  29. $username=@$_SESSION['username'];
  30. $level=@$_SESSION['level'];
  31.  
  32. if(!empty($username) AND !EMPTY($level)){
  33. header('location:vLogin.php');
  34. }
  35. }
  36. $host='localhost:3306';
  37. $user='root';
  38. $pass='';
  39. $db='db_pwpb20';s
  40. $mysqli= mysqli_connect($host, $user, $pass, $db) or die('Tidak dapat koneksi ke Database');
  41. ?>
Add Comment
Please, Sign In to add comment