2022-11-24 09:15:38 +00:00
|
|
|
<?php
|
|
|
|
session_start();
|
|
|
|
require_once 'config.php';
|
|
|
|
|
|
|
|
$username = $_POST["username"];
|
|
|
|
$password = $_POST["password"];
|
|
|
|
|
|
|
|
$conn = dbConn();
|
|
|
|
|
|
|
|
$stmt = $conn->prepare("SELECT * FROM Users WHERE Users_username = :username AND Users_password = :password");
|
|
|
|
$stmt->bindParam(":username", $username);
|
|
|
|
$stmt->bindParam(":password", $password);
|
2022-11-29 15:48:18 +00:00
|
|
|
$stmt->execute();
|
2022-11-24 09:15:38 +00:00
|
|
|
|
2022-11-29 15:48:18 +00:00
|
|
|
if (count($stmt->fetchAll(PDO::FETCH_ASSOC)) > 0)
|
2022-11-24 09:15:38 +00:00
|
|
|
{
|
|
|
|
$_SESSION["username"] = $username;
|
|
|
|
echo json_encode(array("message" => "ok"));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo json_encode(array("message" => "Username or password is incorrect"));
|
|
|
|
}
|