Update register.php
This commit is contained in:
parent
9574428615
commit
f4142c0529
11
register.php
11
register.php
|
|
@ -10,6 +10,7 @@ require_once 'core/config.php';
|
||||||
|
|
||||||
$getitstarted = new PartyStarter;
|
$getitstarted = new PartyStarter;
|
||||||
$getitstarted->header();
|
$getitstarted->header();
|
||||||
|
$usernamespecialchar = false;
|
||||||
$passwordconfirmiswrong = false;
|
$passwordconfirmiswrong = false;
|
||||||
$passwordistooshort = false;
|
$passwordistooshort = false;
|
||||||
$user = new User($con, 0);
|
$user = new User($con, 0);
|
||||||
|
|
@ -24,6 +25,12 @@ if(isset($_POST['submit'])) {
|
||||||
}
|
}
|
||||||
</script>';
|
</script>';
|
||||||
$user = new User($con, $user->getID($con, $username));
|
$user = new User($con, $user->getID($con, $username));
|
||||||
|
if(preg_match('/^[a-zA-Z0-9]+$/', $username) == 0) {
|
||||||
|
$usernamespecialchar = true;
|
||||||
|
} else {
|
||||||
|
$usernamespecialchar = false;
|
||||||
|
}
|
||||||
|
|
||||||
if ($password == $passwordconfirm) {
|
if ($password == $passwordconfirm) {
|
||||||
$passwordconfirmiswrong = false;
|
$passwordconfirmiswrong = false;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -35,7 +42,7 @@ if(isset($_POST['submit'])) {
|
||||||
} else {
|
} else {
|
||||||
$passwordistooshort = false;
|
$passwordistooshort = false;
|
||||||
}
|
}
|
||||||
if ($passwordistooshort == false && $passwordconfirmiswrong == false) {
|
if ($passwordistooshort == false && $passwordconfirmiswrong == false && $usernamespecialchar == false) {
|
||||||
$password = password_hash($password, PASSWORD_BCRYPT);
|
$password = password_hash($password, PASSWORD_BCRYPT);
|
||||||
$query = $con->prepare('SELECT COUNT(*) FROM users WHERE username=:username');
|
$query = $con->prepare('SELECT COUNT(*) FROM users WHERE username=:username');
|
||||||
$query->bindParam(':username', $username);
|
$query->bindParam(':username', $username);
|
||||||
|
|
@ -82,7 +89,7 @@ $thefunfact = json_decode($result);
|
||||||
<h3 class="card-header">Registration</h3>
|
<h3 class="card-header">Registration</h3>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<label class="col-form-label col-form-label-sm mt-4 username " for="inputSmall">Username</label>
|
<label class="col-form-label col-form-label-sm mt-4 username " for="inputSmall">Username</label>
|
||||||
<input class="<?php if($userexists == true) { echo "form-control is-invalid"; } else { echo "form-control form-control-sm"; } ?>" type="text" placeholder="Your username" id="inputSmall" for="inputValid" name="username"> <?php if($userexists == true) { echo '<div class="invalid-feedback" bis_skin_checked="1">Username is already taken.</div>'; } ?>
|
<input class="<?php if($userexists == true || $usernamespecialchar == true) { echo "form-control is-invalid"; } else { echo "form-control form-control-sm"; } ?>" type="text" placeholder="Your username" id="inputSmall" for="inputValid" name="username"> <?php if($userexists == true) { echo '<div class="invalid-feedback" bis_skin_checked="1">Username is already taken.</div>'; } elseif($usernamespecialchar == true) { echo '<div class="invalid-feedback" bis_skin_checked="1">Special characters are not allowed.</div>'; } ?>
|
||||||
<label class="col-form-label col-form-label-sm mt-4 password " for="inputSmall">Password</label>
|
<label class="col-form-label col-form-label-sm mt-4 password " for="inputSmall">Password</label>
|
||||||
<input class="<?php if($passwordconfirmiswrong == true) { echo "form-control is-invalid"; } else { echo "form-control form-control-sm"; } ?>" type="password" placeholder="Your password (Minmum 8 characters)" id="inputSmall" name="pass"> <?php if($passwordconfirmiswrong == true) { echo '<div class="invalid-feedback" bis_skin_checked="1">Password Confirmation field is invalid.</div>'; } else if ($passwordistooshort == true) { echo '<div class="invalid-feedback" bis_skin_checked="1">Password is too short. (8 Characters minmum)</div>'; } ?> <label class="col-form-label col-form-label-sm mt-4 passwordconfirm" for="inputSmall">Password Confirmation</label>
|
<input class="<?php if($passwordconfirmiswrong == true) { echo "form-control is-invalid"; } else { echo "form-control form-control-sm"; } ?>" type="password" placeholder="Your password (Minmum 8 characters)" id="inputSmall" name="pass"> <?php if($passwordconfirmiswrong == true) { echo '<div class="invalid-feedback" bis_skin_checked="1">Password Confirmation field is invalid.</div>'; } else if ($passwordistooshort == true) { echo '<div class="invalid-feedback" bis_skin_checked="1">Password is too short. (8 Characters minmum)</div>'; } ?> <label class="col-form-label col-form-label-sm mt-4 passwordconfirm" for="inputSmall">Password Confirmation</label>
|
||||||
<input class="form-control form-control-sm" type="password" placeholder="Enter your password again" id="inputSmall" name="passconfirm">
|
<input class="form-control form-control-sm" type="password" placeholder="Enter your password again" id="inputSmall" name="passconfirm">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue