Beispiel #1
0
 function testTables($sql)
 {
     if (!($queryResource = mysql_query($sql, $this->dbConn))) {
         @setupDB();
     }
 }
Beispiel #2
0
<?php

require __DIR__ . '/../vendor/autoload.php';
require __DIR__ . '/helpers.php';
setupDB();
Beispiel #3
0
// 	@Author Maikel Zweerink
//	Index.php - contains the webservice supplying information to the webUI.
// -----------------------------------------------------------------------
error_reporting(E_ERROR);
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
if ($_GET['whatsspy'] != 'getProfilePic') {
    header("Content-type: application/json; charset=utf-8");
}
ini_set('session.cookie_lifetime', 25920000);
// 300 days
ini_set('session.gc_maxlifetime', 25920000);
require_once 'config.php';
require_once 'db-functions.php';
require_once 'functions.php';
$DBH = setupDB($dbAuth);
// Setup session management
session_start();
// Process any GET requests that are for WhatsSpy Public.
switch ($_GET['whatsspy']) {
    /**
     *		Do a login attempt with a password	
     */
    case 'doLogin':
        if (isset($_GET['password'])) {
            if (!isset($whatsspyPublicAuth)) {
                echo json_encode(['error' => 'Password is not set in the config.php', 'code' => 403]);
                exit;
            }
            // Login spam protection
            $select = $DBH->prepare('SELECT 1 FROM whatsspy_config WHERE "last_login_attempt" >= NOW() - \'7 second\'::INTERVAL;');
Beispiel #4
0
<?php

define('NOCONNECT', true);
//Don't autoconnect to the DB
require_once 'db.php';
require_once 'ca.php';
$title = 'Setup';
include 'header.php';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    if (isset($_POST['rootpass'])) {
        setupDB($_POST['dbhost'], $_POST['rootpass'], $_POST['adminemail'], $_POST['adminapproval']);
    } else {
        setupDB(NULL, NULL, NULL, NULL);
    }
    setupCA();
    echo '<h1>Congratulations!</h1>
<p class="text">Your EasyAuth base system is set up.</p>';
    if (getUser(GetCertId()) == NULL) {
        echo '<p class="text"><a href="register">Go to registration</a> to complete setup.</p>';
    }
} else {
    ?>
<h1>EasyAuth setup</h1>
<p class="text">To set up this authentication system, you first need a mysql database. You will then either need to manually create a config.php or run this installer with the database host and root password. You must then register; as the first user you will be granted admin permissions.
<h2>Setup with mysql root DB account:</h2>
<form method="post" name="setupform" action="setup">
<table style="text-align: right">
<tbody>
<tr><td>Database host:</td><td><input type="text" name="dbhost" value="localhost"></td></tr>
<tr><td>DB root password:</td><td><input type="password" name="rootpass" value=""></td></tr>
<tr><td>Admin email:</td><td><input type="email" name="adminemail" value=""></td></tr>