コード例 #1
0
<?php

require_once 'includes/QBCoref.class.php';
$qbc = new QBCoref();
$qbc->logout();
// initialize variables
$username = "";
$firstname = "";
$lastname = "";
$email = "";
if (!empty($_POST['action']) && $_POST['action'] == "register") {
    $username = filter_input(INPUT_POST, 'username', FILTER_SANITIZE_STRING);
    $firstname = filter_input(INPUT_POST, 'first-name', FILTER_SANITIZE_STRING);
    $lastname = filter_input(INPUT_POST, 'last-name', FILTER_SANITIZE_STRING);
    $email = $_POST['email'];
    $errors = array();
    if (empty($username)) {
        $errors[] = "Please include a username.";
    } else {
        if ($username != $_POST['username']) {
            $errors[] = "Invalid characters, please pick another username.";
        } else {
            if (!$qbc->isUsernameUnique($username)) {
                $errors[] = "Duplicate username detected, please try another username.";
            }
        }
    }
    if (empty($_POST['password'])) {
        $errors[] = "Password can not be empty.";
    } else {
        if ($_POST['password'] != $_POST['password-confirm']) {