Exemplo n.º 1
0
<?php

/*
 * Login Script
 */
session_start();
require_once "lib/BeaconAuthenticator.php";
require_once "lib/BeaconMySQL.php";
require_once 'settings.php';
$beacon_db_instance = NULL;
$beacon_runnable = false;
if ($beacon_db_type == "mysql") {
    $beacon_db_instance = new BeaconMySQL();
}
$beacon_runnable = $beacon_db_instance->init_db($beacon_mysql_hostname, $beacon_mysql_database, $beacon_mysql_username, $beacon_mysql_password);
if ($beacon_runnable < 0) {
    echo '<h3>Database Error. <a href="index.php">Go to main page</a> to review the problem.</h3>';
    @session_destroy();
}
$auth = new BeaconAuth($beacon_db_instance);
if (!$auth->check_session()) {
    if (!isset($_POST['name1'])) {
        echo '<h3>You are not authorized to view this page. <a href="index.php">Login Here.</a></h3>';
        @session_destroy();
    } else {
        $username = $_POST['name1'];
        $password = $_POST['password1'];
        /* BEGIN: Code for external auth */
        /*$output = "AAA";
                $return = false;
        
Exemplo n.º 2
0
<?php

/*
 * Quick Beacon Install Script
 *
 */
require_once 'settings.php';
require_once 'lib/BeaconMySQL.php';
$beacon_db_instance = NULL;
$beacon_runnable = false;
$beacon_install = false;
$beacon_error = "";
if ($beacon_db_type == "mysql") {
    $beacon_db_instance = new BeaconMySQL();
}
switch ($beacon_db_instance->init_db($beacon_mysql_hostname, $beacon_mysql_database, $beacon_mysql_username, $beacon_mysql_password)) {
    case -1:
        $beacon_error = " Error: Could not connect to DB. Check your settings";
        break;
    case -2:
        $beacon_error = "Error: Please check the database name in your settings.";
        break;
    case -3:
        $beacon_install = true;
        break;
    case 1:
        $beacon_error = "Database is already setup.";
        $beacon_runnable = true;
        break;
}
$request = json_decode(file_get_contents($beacon_conf_path));