Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- header("Access-Control-Allow-Origin: *");
- header("Content-Type: application/json; charset=UTF-8");
- require_once("connection_dev.php");
- //get all data frm angular
- $postdata = file_get_contents("php://input");
- $request = json_decode($postdata);
- //process data here (sanitiation, validation,databation)
- $username = $request->ic_number;
- $password = $request->password;
- //check db, username dan password tu wujud ke tak combinationnya
- // $result = $conn->query("SELECT COUNT(*) FROM pengguna where `pengguna`.`id_pengguna` = 'suliza' AND `pengguna`.`katalaluan` = '2f2a2018e3cb5046e39f6203b3236b7a'");
- // SSO
- $result = 1;
- if ($result == 1) {
- $status = 'pass';
- $role = 'kpkr';
- $msg = "Login sah";
- $dept = 'CDPK';
- $name = 'Ahmad Tarmizi';
- $photo_url = 'http://vectorise.net/vectorworks/logos/Jabatan%20Kerajaan/downloads/Logo%20Jab%20Kerja%20Raya.png';
- } else {
- $status = 'fail';
- $uuid = '';
- $msg = "Username dan password tidak sah.";
- }
- ?>
- {
- "status" : "<?php echo $status; ?>",
- "role" : "<?php echo $role; ?>",
- "msg" : "<?php echo $msg; ?>",
- "dept" : "<?php echo $dept; ?>",
- "name" : "<?php echo $name; ?>",
- "photo_url" : "<?php echo $photo_url; ?>"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement