Advertisement
Guest User

Untitled

a guest
Apr 4th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. <?php
  2. header("Access-Control-Allow-Origin: *");
  3. header("Content-Type: application/json; charset=UTF-8");
  4. require_once("connection_dev.php");
  5.  
  6. //get all data frm angular
  7. $postdata = file_get_contents("php://input");
  8. $request = json_decode($postdata);
  9.  
  10. //process data here (sanitiation, validation,databation)
  11. $username = $request->ic_number;
  12. $password = $request->password;
  13.  
  14. //check db, username dan password tu wujud ke tak combinationnya
  15. // $result = $conn->query("SELECT COUNT(*) FROM pengguna where `pengguna`.`id_pengguna` = 'suliza' AND `pengguna`.`katalaluan` = '2f2a2018e3cb5046e39f6203b3236b7a'");
  16. // SSO
  17. $result = 1;
  18.  
  19. if ($result == 1) {
  20. $status = 'pass';
  21. $role = 'kpkr';
  22. $msg = "Login sah";
  23. $dept = 'CDPK';
  24. $name = 'Ahmad Tarmizi';
  25. $photo_url = 'http://vectorise.net/vectorworks/logos/Jabatan%20Kerajaan/downloads/Logo%20Jab%20Kerja%20Raya.png';
  26.  
  27. } else {
  28. $status = 'fail';
  29. $uuid = '';
  30. $msg = "Username dan password tidak sah.";
  31. }
  32. ?>
  33. {
  34. "status" : "<?php echo $status; ?>",
  35. "role" : "<?php echo $role; ?>",
  36. "msg" : "<?php echo $msg; ?>",
  37. "dept" : "<?php echo $dept; ?>",
  38. "name" : "<?php echo $name; ?>",
  39. "photo_url" : "<?php echo $photo_url; ?>"
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement