here we go with a need for difficult passwords
This commit is contained in:
parent
9c641b8b89
commit
2b0dd631f3
11
register.php
11
register.php
@ -15,6 +15,12 @@ $pdo = new PDO('mysql:host=localhost;dbname=usertable', 'usertable', 'password')
|
|||||||
<?php
|
<?php
|
||||||
$showFormular = true;
|
$showFormular = true;
|
||||||
|
|
||||||
|
//regexes for validation:
|
||||||
|
$REuppercase = preg_match('@[A-Z]@', $password);
|
||||||
|
$RElowercase = preg_match('@[a-z]@', $password);
|
||||||
|
$REnumber = preg_match('@[0-9]@', $password);
|
||||||
|
$REspecialChars = preg_match('@[^\w]@', $password);
|
||||||
|
|
||||||
if(isset($_GET['register'])) {
|
if(isset($_GET['register'])) {
|
||||||
$error = false;
|
$error = false;
|
||||||
$email = $_POST['email'];
|
$email = $_POST['email'];
|
||||||
@ -36,6 +42,11 @@ if(isset($_GET['register'])) {
|
|||||||
echo 'passwords doesnt match<br>';
|
echo 'passwords doesnt match<br>';
|
||||||
$error = true;
|
$error = true;
|
||||||
}
|
}
|
||||||
|
if(!$REuppercase || !$RElowercase || !$REnumber || !$REspecialChars || strlen($password) < 8) {
|
||||||
|
echo 'Password needs to be more complex.<br />';
|
||||||
|
echo 'Please implement at least 8 chars, upper & downer caser, one number & one special char.<br />';
|
||||||
|
$error = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(!$error) {
|
if(!$error) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user