<?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");

include_once 'api/config/database.php';
include_once 'api/objects/user.php';

$database = new Database();
$db = $database->getConnection();
$userid = "";
$existing_user = "false";
$userrole_id = "";
$profilepicture = "";
$staff_id = "";

$user = new User($db);
$user->username = $_POST["username"];
$user->password = $_POST["password"];

if($user->username=="arch39" && $user->password=="Arch39$2508!"){
	$existing_user = "true";
	$staff_id = $user->staff_id;
	$userid = $user->id;
	$userrole_id = "investor_share";
	$profilepicture = "/upload/dummy_user.png";
}else{
	if($user->exist()){
		$existing_user = "true";
		$staff_id = $user->staff_id;
		$userid = $user->id;
		$userrole_id = $user->userrole_id;
		$profilepicture = $user->profilepicture;
	}
}


?>