Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- include('connect.php');
- // Get JSON from UI
- $postdata = file_get_contents("php://input");
- $request = json_decode($postdata);
- $username = $request->username;
- $password = $request->password;
- $password = md5($password);
- $query = "SELECT * FROM c_security_user WHERE c_security_user.username = '$username' AND c_security_user.password = '$password'";
- $result = mysql_query($query);
- $data = mysql_fetch_array($result);
- if (mysql_num_rows($result) != 0) {
- $_SESSION['username'] = $data['username'];
- $msg = array('status' => 'success');
- } else {
- $msg = array('status' => 'failed');
- }
- echo json_encode($msg);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement