introduced "isadmin" flag to code and registration
This commit is contained in:
parent
d6877f2349
commit
5b5e96f970
@ -19,6 +19,7 @@ if(isset($_GET['login'])) {
|
|||||||
$_SESSION['lastName'] = $user['lastName'];
|
$_SESSION['lastName'] = $user['lastName'];
|
||||||
$_SESSION['activated'] = $user['activated'];
|
$_SESSION['activated'] = $user['activated'];
|
||||||
$_SESSION['updated_at'] = $user['updated_at'];
|
$_SESSION['updated_at'] = $user['updated_at'];
|
||||||
|
$_SESSION['isadmin'] = $user['isadmin'];
|
||||||
die('<div class="alert alert-success" role="alert"> successfull. go to: <a href="secure.php">secure page</a></div> <meta http-equiv="refresh" content="0; URL=secure.php">');
|
die('<div class="alert alert-success" role="alert"> successfull. go to: <a href="secure.php">secure page</a></div> <meta http-equiv="refresh" content="0; URL=secure.php">');
|
||||||
} else {
|
} else {
|
||||||
$errorMessage = '<div class="alert alert-danger" role="alert">somethings wrong (maybe wrong password or wrong user)</div><br>';
|
$errorMessage = '<div class="alert alert-danger" role="alert">somethings wrong (maybe wrong password or wrong user)</div><br>';
|
||||||
|
@ -11,4 +11,9 @@ echo "<br />";
|
|||||||
echo $_SESSION['lastName'];
|
echo $_SESSION['lastName'];
|
||||||
echo "<br />";
|
echo "<br />";
|
||||||
echo $_SESSION['activated'];
|
echo $_SESSION['activated'];
|
||||||
|
echo "<br />";
|
||||||
|
echo $_SESSION['updated_at'];
|
||||||
|
echo "<br />";
|
||||||
|
echo $_SESSION['isadmin'];
|
||||||
|
|
||||||
?>
|
?>
|
@ -75,7 +75,7 @@ if(isset($_GET['register'])) {
|
|||||||
if(!$error) {
|
if(!$error) {
|
||||||
$password_hash = password_hash($password, PASSWORD_DEFAULT);
|
$password_hash = password_hash($password, PASSWORD_DEFAULT);
|
||||||
|
|
||||||
$statement = $pdo->prepare("INSERT INTO users (email, username, givenName, activated, lastName, password) VALUES (:email, :username, :givenName, '0', :lastName, :password)");
|
$statement = $pdo->prepare("INSERT INTO users (email, username, givenName, activated, isadmin, lastName, password) VALUES (:email, :username, :givenName, '0', '0', :lastName, :password)");
|
||||||
$result = $statement->execute(array('email' => $email, 'username' => $username, 'givenName' => $givenName, 'lastName' => $lastName, 'password' => $password_hash));
|
$result = $statement->execute(array('email' => $email, 'username' => $username, 'givenName' => $givenName, 'lastName' => $lastName, 'password' => $password_hash));
|
||||||
|
|
||||||
if($result) {
|
if($result) {
|
||||||
|
@ -14,6 +14,7 @@ $_SESSION['givenName'] = $user['givenName'];
|
|||||||
$_SESSION['lastName'] = $user['lastName'];
|
$_SESSION['lastName'] = $user['lastName'];
|
||||||
$_SESSION['activated'] = $user['activated'];
|
$_SESSION['activated'] = $user['activated'];
|
||||||
$_SESSION['updated_at'] = $user['updated_at'];
|
$_SESSION['updated_at'] = $user['updated_at'];
|
||||||
|
$_SESSION['isadmin'] = $user['isadmin'];
|
||||||
|
|
||||||
|
|
||||||
echo 'Session newly validated!<br />';
|
echo 'Session newly validated!<br />';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user