22 lines
531 B
PHP
22 lines
531 B
PHP
|
<?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);
|
||
|
|
||
|
if ($stmt->execute())
|
||
|
{
|
||
|
$_SESSION["username"] = $username;
|
||
|
echo json_encode(array("message" => "ok"));
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
echo json_encode(array("message" => "Username or password is incorrect"));
|
||
|
}
|