Advertisement
wis4nto

Untitled

Feb 8th, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. <?php
  2. session_start();
  3. include "../../settings/connection.php";
  4. if(isset($_SESSION["admin"])){
  5. header("Location: ../index.php");
  6. }
  7.  
  8.  
  9. if(isset($_POST)&&$_POST["username"]&&$_POST["password"]){
  10. $username=$_POST["username"];
  11. $password=$_POST["password"];
  12.  
  13. $perintah="SELECT * FROM karyawan WHERE UserName='".$username."' AND Password='".$password."'";
  14. $ambil=mysql_query($perintah,$server_connect);
  15. if($ambil){if(mysql_num_rows($ambil)>=1){
  16. $data=mysql_fetch_array($ambil);
  17. $_SESSION["admin"]=$data["NIK"];
  18. $_SESSION["level"]=$data["Level"];
  19. header("Location: ../index.php?login_success=true");
  20. }else{header("Location: ../login.php?login_fail=true");}}else{header("Location: ../login.php?login_fail=true");}
  21. }else{header("Location: ../login.php?login_fail=true");}
  22. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement