Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- header('Content-type: application/json');
- include 'db.php';
- $conn = OpenCon();
- $username = $_GET['username'];
- $password = $_GET['password'];
- $sql = "SELECT * FROM users WHERE username='$username' AND password='$password'";
- $result = $conn->query($sql);
- //echo "Connected Successfully";
- if ($result->num_rows === 1) {
- $resultJSON=array('message' => 'success');
- while($row = $result->fetch_assoc()) {
- array_push($resultJSON['user_id'] = $row['user_id']);
- array_push($resultJSON['user_full_name'] = $row['name']);
- array_push($resultJSON['username'] = $row['username']);
- echo json_encode($resultJSON);
- }
- } else {
- $resultJSON=array('message' => 'error');
- echo json_encode($resultJSON);
- }
- CloseCon($conn);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement