more beauty!

This commit is contained in:
Thies Mueller 2021-01-08 21:48:20 +01:00
parent a859694bd7
commit 97423f3d68
4 changed files with 9 additions and 6 deletions

View File

@ -19,7 +19,7 @@ if(isset($_GET['login'])) {
$_SESSION['lastName'] = $user['lastName']; $_SESSION['lastName'] = $user['lastName'];
die('successfull. go to: <a href="secure.php">secure page</a><meta http-equiv="refresh" content="0; URL=secure.php">'); die('successfull. go to: <a href="secure.php">secure page</a><meta http-equiv="refresh" content="0; URL=secure.php">');
} else { } else {
$errorMessage = "somethings wrong (maybe wrong password or wrong user)<br>"; $errorMessage = "<div class="alert alert-danger" role="alert">somethings wrong (maybe wrong password or wrong user)</div><br>";
} }
} }

View File

@ -18,7 +18,7 @@ $useremail = $_SESSION['email'];
$usergn = $_SESSION['givenName']; $usergn = $_SESSION['givenName'];
$userln = $_SESSION['lastName']; $userln = $_SESSION['lastName'];
echo "Profile of ".$username; echo '<div class="alert alert-info" role="alert">Profile of '.$username.'</div>';
echo "<br/>"; echo "<br/>";
echo '<table class="table table-dark table-striped" style="width:30%">'; echo '<table class="table table-dark table-striped" style="width:30%">';
echo "<tr>"; echo "<tr>";

View File

@ -10,7 +10,7 @@
$pdo = new PDO('mysql:host=localhost;dbname=usertable', 'usertable', 'password'); $pdo = new PDO('mysql:host=localhost;dbname=usertable', 'usertable', 'password');
if(!isset($_GET['userid']) || !isset($_GET['code'])) { if(!isset($_GET['userid']) || !isset($_GET['code'])) {
die("No code delivered. nothing to do here."); die('<div class="alert alert-warning" role="alert">No code delivered. nothing to do here.</div>');
} }
$userid = $_GET['userid']; $userid = $_GET['userid'];
@ -23,17 +23,20 @@ $user = $statement->fetch();
//check if theres a code for the user delivered //check if theres a code for the user delivered
if($user === null || $user['passwordcode'] === null) { if($user === null || $user['passwordcode'] === null) {
die("No User matching your request."); die('<div class="alert alert-danger" role="alert">
No User matching your request.</div>');
} }
if($user['passwordcode_time'] === null || strtotime($user['passwordcode_time']) < (time()-24*3600) ) { if($user['passwordcode_time'] === null || strtotime($user['passwordcode_time']) < (time()-24*3600) ) {
die("Ooops. This code isn't valid anymore."); die('<div class="alert alert-danger" role="alert">
Ooops. This code isnt valid anymore.</div>');
} }
if(sha1($code) != $user['passwordcode']) { if(sha1($code) != $user['passwordcode']) {
die("Thats not your code. Naughty user!"); die('<div class="alert alert-danger" role="alert">
Thats not your code. Naughty user!</div>');
} }