예제 #1
0
파일: signUp.php 프로젝트: gpichurov/cram
    if (!getValue($data, 'userName') || mb_strlen(getValue($data, 'userName'), 'UTF-8') < 5) {
        $errors[] = 'Username at last 5 characters is required';
    }
    if (!getValue($data, 'email')) {
        $errors[] = 'Email is required';
    }
    if (!getValue($data, 'pwd') || mb_strlen(getValue($data, 'pwd'), 'UTF-8') < 5) {
        $errors[] = 'Password at last 5 characters is required';
    }
    if ($data['pwd'] !== $data['pwdRep']) {
        $errors[] = 'Password must match';
    }
    if (DbStorage::checkUsername($user)) {
        $errors[] = 'Username exist';
    }
    if (DbStorage::checkEmail($user)) {
        $errors[] = 'Email exist';
    }
    if (!$errors) {
        DbStorage::insertObject($user);
        header('Location: login.php');
        die;
    }
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">