Skip to content
Snippets Groups Projects
load.php 1.1 KiB
Newer Older
Sibidharan's avatar
Sibidharan committed
<?php
Aditya's avatar
Aditya committed
 include_once 'includes/Session.class.php';
 include_once 'includes/User.class.php';
 include_once 'includes/Database.class.php';
 include_once 'includes/UserSession.class.php';
Sibidharan's avatar
Sibidharan committed

Aditya's avatar
Aditya committed
    function load_template($template) {
        $templatePath = __DIR__."/../_templates/$template.php";
        if (file_exists($templatePath)) {
            include "$templatePath";
        } else {
            die("Template not found: $templatePath");
        }
    };
Sibidharan's avatar
Sibidharan committed

Aditya's avatar
Aditya committed
    function get_config($key){
        $configPath = __DIR__."/../photogramconfig.json";
        $json = file_get_contents($configPath);
        if (file_exists($configPath)){
            $array = json_decode($json, true);
            if (isset($array[$key])) {
                return $array[$key];
            } else {
                return false;
            }
        }else{
            die("File Not Found: $configPath");
        }
        
Sibidharan's avatar
Sibidharan committed

Aditya's avatar
Aditya committed
    }
    
    function validate_credentials($username, $password){
Sibidharan's avatar
Sibidharan committed
    if ($username == "sibi@selfmade.ninja" and $password == "password") {
        return true;
    } else {
        return false;
    }