Esempio n. 1
0
<?php

session_start();
include "sql.php";
include "web.php";
$db = connect();
$apiHandler = new web();
$json = array("status" => "null", "details" => "null");
if (!isset($_GET["key"])) {
    $json = array("status" => "error", "details" => "Empty ApiKey");
    die(json_encode($json));
} else {
    if (!$apiHandler->isApiToken($_GET["key"], $db)) {
        $json = array("status" => "error", "details" => "Invalid ApiKey");
        die(json_encode($json));
    }
}
// IF WAR *-*
if (isset($_GET["username"]) && $_GET["username"] != "") {
    if (isset($_GET["password"]) && $_GET["password"] != "") {
        if (isset($_GET["mail"]) && $_GET["mail"] != "") {
            if (isset($_GET['password2']) && $_GET["password2"] != "") {
                if ($_GET['password2'] == $_GET['password']) {
                    if ($apiHandler->UsernameExists($_GET['username'], $db) == false) {
                        if ($apiHandler->EmailUsed($_GET['mail'], $db) == false) {
                            $hashed_password = md5($_GET['password'] . "PjSalt");
                            // md5 + salt
                            $username = htmlspecialchars($_GET['username']);
                            $email = htmlspecialchars($_GET['mail']);
                            $UUID = uniqid("table_");
                            $alphabet = "abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789";