Login.php 1012 Bytes
Newer Older
Tanmim's avatar
Tanmim committed
1
<?php
2
    $con = mysqli_connect("localhost", "jsusz001", "password", "jsusz001_TravelPals");
Tanmim's avatar
Tanmim committed
3
4
5
6
7
8
9
10
11
    
    $username = $_POST["username"];
    $password = $_POST["password"];
    
    $statement = mysqli_prepare($con, "SELECT * FROM user WHERE username = ? AND password = ?");
    mysqli_stmt_bind_param($statement, "ss", $username, $password);
    mysqli_stmt_execute($statement);
    
    mysqli_stmt_store_result($statement);
12
    mysqli_stmt_bind_result($statement, $id, $name, $dob, $password, $picture, $email, $location, $username);
Tanmim's avatar
Tanmim committed
13
14
15
16
17
    
    $response = array();
    $response["success"] = false;  
    
    while(mysqli_stmt_fetch($statement)){
18
        $response["success"] = true; 
Tanmim's avatar
Tanmim committed
19
        $response["name"] = $name;
20
        $response["dob"] = $dob; 
Tanmim's avatar
Tanmim committed
21
        $response["password"] = $password;
22
23
24
25
        $response["picture"] = $picture;
        $response["email"] = $email;
        $response["location"] = $location;
        $response["username"] = $username;
Tanmim's avatar
Tanmim committed
26
27
28
29
30
31
32
    }
    
    echo json_encode($response);


	
;?>