Nimbin[12]?Web & Tools / dienstplancreator / api/login.php

dienstplancreator git · main

Dienstplan (roster) creator, PHP/JS web app

php javascript roster web · first commit 2023-07-13 · last commit 2023-09-14 (3 years ago) · synced 3 days ago · upstream: github.com/nimbin2/dienstplancreator

JavaScript 50% PHP 40.5% CSS 8.5%
git clone https://git.christianimmanuel.de/web-tools/dienstplancreator.gitwget https://git.christianimmanuel.de/web-tools/dienstplancreator/archive/dienstplancreator.tar.gz
api/login.php 874 B · 35 lines raw
<?php
// required headers
header("Access-Control-Allow-Origin: *");
header("Content-Type: application/json; charset=UTF-8");
header("Access-Control-Allow-Methods: POST");
header("Access-Control-Max-Age: 3600");
header("Access-Control-Allow-Headers: Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With");
  
session_start();

require 'config/db_inc.php';
require 'objects/account_class.php';
require 'objects/settings_class.php';

$account = new Account();

$data = json_decode(file_get_contents("php://input"));

$name = $data->name;
$password = $data->password;
$data_id = $data->data_id;
try {
	$login = $account->login($name, $password, $data_id);
} catch (Exception $e) {
	echo json_encode($e->getMessage());
	die();
}   

if ($login) {
    echo json_encode("success");
    //header("Location: ");
} else {
	echo json_encode('mismatch');
}   
?>