Пример #1
0
<?php

include_once 'privateplc_php.ini.php';
include "web_authentification.inc.php";
include "xmlhandler.inc.php";
error_reporting(E_ALL | E_STRICT);
// Um die Fehler auch auszugeben, aktivieren wir die Ausgabe
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
// Da man in einem Produktivsystem ?blicherweise keine Fehler ausgeben
// will sondern sie nur mitloggen will, bietet es sich an dort die
// Ausgabe der Fehler zu deaktivieren und sie stattdessen in ein Log-File
// schreiben zu lassen
session_start();
$loginflag = -1;
//-1 is false / 0 is true
$DNSservice = -1;
$authent = new authentification();
$xmlhandler = new xmlhandler();
if ($authent->session_authentification('userdata.xml')) {
    $loginflag = 0;
}
if ($loginflag == 0) {
    //todo:get registered devices
    $services = $xmlhandler->get_services('userdata.xml');
    //todo:display user data (= address, e-mail address, etc.)
    //todo:get booked services
}
$arr = array('loginflag' => $loginflag, 'DNSbooked' => $services['DNSbooked'], 'DNSexpiration' => $services['DNSexpiration']);
echo json_encode($arr);
Пример #2
0
    $loginflag = 0;
}
$errorUsername = -1;
//If username exists already value = -1
$errorPasswordRepeat = -1;
//If password and password2 are not equal value = -1
$errordeviceID = -1;
unset($arr);
unset($errordeviceID, $errorUsername, $errorPasswordRepeat);
if ($loginstatusrequestflag == 1) {
    $username = $_POST["username"];
    $password = $_POST["password"];
    $password2 = $_POST["passwordRepeat"];
    $deviceID = $_POST["deviceID"];
    $authent = new authentification();
    $xmlhandler = new xmlhandler();
    if ($authent->deviceID_verification($deviceID, "deviceID.xml")) {
        $errordeviceID = 0;
    }
    if (trim($password) == trim($password2)) {
        $errorPasswordRepeat = 0;
    }
    if ($xmlhandler->searchdoubleuser(trim($username), 'userdata.xml')) {
        $errorUsername = 0;
    }
    if ($errorPasswordRepeat == 0 && $errorUsername == 0 && $errordeviceID == 0) {
        $passwordencrypt = $authent->encryptpwd($password);
        $deviceID_hash = $authent->hash_sha256($deviceID);
        $xmlhandler->addnewuser($username, $passwordencrypt, $deviceID_hash, 'userdata.xml');
    }
}
Пример #3
0
unset($username, $password, $rememberlogin);
$rememberlogin = 0;
$username = $_POST["username"];
$password = $_POST["password"];
$rememberlogin = $_POST["rememberlogin"];
//$username = "******";
//$password = "******";
unset($arr);
unset($errorLogin);
$Loginflag = -1;
//If password is wrong value = -1 else 0
$errorUsername = -1;
$errorpwd = -1;
$errorsetcookie = -1;
$authent = new authentification();
$xmlhandler = new xmlhandler();
$userpwdarray = $authent->getuserpwd($username, "userdata.xml");
if ($userpwdarray['userflag']) {
    $errorUsername = 0;
}
if ($authent->verifypwd($password, $userpwdarray['password_hash'])) {
    $errorpwd = 0;
}
if ($errorUsername == 0 && $errorpwd == 0) {
    $_SESSION['username'] = $username;
    $Loginflag = 0;
}
if ($rememberlogin == 1 && $errorpwd == 0 && $errorUsername == 0) {
    //generate random cookie_ID to store on clients browser
    $cookiearray = $authent->Cookie_remember_code();
    $username_hash = $authent->hash_sha256($username);
Пример #4
0
<?php

// Gibt an welche PHP-Fehler ?berhaupt angezeigt werden
error_reporting(E_ALL | E_STRICT);
// Um die Fehler auch auszugeben, aktivieren wir die Ausgabe
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
include "xmlhandler.inc.php";
$username = $_GET['username'];
$xmlhandler = new xmlhandler();
if ($xmlhandler->searchdoubleuser(trim($username), 'userdata.xml')) {
    echo "Funktioniert";
}
/*
$count = $userxml->user->count();
$userxml->addChild('user', 'Martin');
*/