コード例 #1
0
ファイル: ctrl.php プロジェクト: jambonbill/ip.jambonbill.org
<?php

//Admin login page
header('Content-Type: application/json');
session_start();
require __DIR__ . "/../../vendor/autoload.php";
$admin = new LTE\AdminLte2();
switch ($_POST['do']) {
    case "login":
        print_r($_POST);
        break;
    case "logout":
        print_r($_POST);
        $admin->logout();
        break;
    case "testProfile":
        $dat = [];
        $dat['POST'] = $_POST;
        $configfile = __DIR__ . "/../../profiles/" . $_POST['conf'];
        if (is_file($configfile)) {
            $conf = json_decode(file_get_contents($configfile));
            //exit;
            if ($err = json_last_error_msg()) {
                if ($err != 'No error') {
                    $dat['error'] = 'Profile error (json):' . $err;
                    exit(json_encode($dat));
                }
            }
            try {
                $dsn = "mysql:host=" . $conf->pdo->host . ";";
                $db = new \PDO($dsn, $conf->pdo->user, $conf->pdo->pass);