Example #1
0
<?php

include_once "databse.php";
if (isset($_POST["userID"]) && isset($_POST["userIDAdd"])) {
    @session_start();
    $databse = new Database();
    $databse->addUser($_POST["userID"], $_POST["userIDAdd"]);
}
Example #2
0
$register = new Register();
$result = $register->tryRegisterUser();
$displayDuplicateUsernameModal = FALSE;
$displayRegistrationSuccessModal = FALSE;
$displayRegistrationConfirmedModal = FALSE;
if (isset($_GET["username"]) && isset($_GET["token"])) {
    $displayRegistrationConfirmedModal = TRUE;
    $database->validateUser($_GET["username"], $_GET["token"]);
}
if ($result) {
    if ($database->checkIfExistsUsername($register->getUsername())) {
        $displayDuplicateUsernameModal = TRUE;
    } else {
        $displayRegistrationSuccessModal = TRUE;
        $token = $register->getRandomToken();
        $database->addUser($register->getUsername(), $register->getEmail(), $register->getPassword(), $token);
        $register->sendRegistrationConfirmationEmail($token);
    }
}
?>

        

    </head>
    <body>
        <img id="background" alt="background" src="assets/register/background.jpg"/>

        <div class="center">
            <img id ="panel" alt="panel" src="assets/register/panel.png"></img>
            <div id ="panelContent" style="position: absolute;">
Example #3
0
    $login = trim(strtolower($login));
    $login2 = urlencode(htmlentities(htmlspecialchars($login), ENT_QUOTES));
    $password = urlencode(htmlentities(htmlspecialchars($password), ENT_QUOTES));
    if (strlen($login) < 5 || strlen($login) > 15) {
        $reason_text = "Identyfikator musi mie&#x107; od 5 do 15 znak&#xf3;w";
    } elseif (strcmp($login, $login2) != 0) {
        $reason_text = "Identyfikator mo&#x17c;e zawiera&#x107; tylko litery i cyfry";
    } elseif (strcmp($password, $password2) != 0) {
        $reason_text = "Pola hase&#x142; nie zgadzaj&#x105; si&#x119;";
    } else {
        $db = new Database();
        $rowUser = $db->getUser($login, NULL);
        if ($rowUser != NULL) {
            $reason_text = "U&#x17c;ytkownik o podanym identyfikatorze ju&#x17c; istnieje";
        } else {
            $rowUser = $db->addUser($login, $password);
            $uid = $rowUser['id'];
            $isAllowed = TRUE;
            $sid = getCode();
            if ($db->updateUserSid($uid, $sid) == FALSE) {
                $reason_text = "Undefined error";
                $isAllowed = FALSE;
            }
            trigger_error("login:"******" password(" . $rowUser['password'] . "):" . $password . "uid:" . $uid . " sid" . $sid, E_USER_NOTICE);
        }
        $db->destroy();
    }
}
$wap_title = "mobiKAR - login";
include "add_head.php";
if ($isAllowed == FALSE) {
Example #4
0
}
function attemptDataRetrieval($key)
{
    if (array_key_exists($key, $_POST)) {
        return $_POST[$key];
    }
    response(["success" => false, "message" => "<strong>Uh oh!</strong> Please fill out the form completely."]);
}
$recaptcha = new \ReCaptcha\ReCaptcha("6LdcjCUTAAAAAF5fvOKpF-dAPBjACkIzFNLxxgis");
$resp = $recaptcha->verify(attemptDataRetrieval("captcha"), $_SERVER["REMOTE_ADDR"]);
if (!$resp->isSuccess()) {
    response(["success" => false, "message" => "<strong>Uh oh!</strong> Invalid captcha."]);
}
$username = attemptDataRetrieval("username");
$password = attemptDataRetrieval("password");
$color = attemptDataRetrieval("color");
$colors = range(1, 17);
if (strlen($username) < 4 || strlen($username) > 12) {
    $lengthWord = strlen($username) < 3 ? "short" : "long";
    response(["success" => false, "message" => "<strong>Uh oh!</strong> Username is too {$lengthWord}."]);
} elseif (strlen($password) < 4) {
    response(["success" => false, "message" => "<strong>Uh oh!</strong> Password is too short."]);
} elseif (!is_numeric($color) || !in_array($color, $colors)) {
    response(["success" => false, "message" => "<strong>Uh oh!</strong> Invalid color specified."]);
}
$db = new Database();
if ($db->usernameTaken($username)) {
    response(["success" => false, "message" => "<strong>Uh oh!</strong> The username you've specified is already in use."]);
}
$playerId = $db->addUser($username, $password, $color);
response(["success" => true, "message" => "<strong>Hooray!</strong> You have successfully registered your account. Your player id is <strong>{$playerId}</strong>."]);