summaryrefslogtreecommitdiff
path: root/www/functions.php
diff options
context:
space:
mode:
Diffstat (limited to 'www/functions.php')
-rw-r--r--www/functions.php9
1 files changed, 5 insertions, 4 deletions
diff --git a/www/functions.php b/www/functions.php
index 5940aa4..ebad519 100644
--- a/www/functions.php
+++ b/www/functions.php
@@ -84,8 +84,9 @@ function login($db){
/* --LOGOUT-- */
function logout(){
+ $username=$_SESSION["username"];
session_destroy();
- header("Refresh: 0; login?reason=logout&username=" . $unsafe_username);
+ header("Refresh: 0; login?reason=logout&username=" . $username);
exit;
}
@@ -168,7 +169,7 @@ function invite($db){
function register($db){
if($_SERVER['REQUEST_METHOD'] == 'POST') {
- $name = $_POST["name"];
+ $name = $_POST["username"];
$cleartext_password = $_POST["pswd"];
$second_password = $_POST["2ndpswd"];
$email = $_POST["email"];
@@ -200,7 +201,7 @@ function register($db){
$test_key_arr = $test_key_db->fetchArray(SQLITE3_NUM);
$test_key = $test_key_arr[0];
- if ($test_status_int != 0 || $email == "" || $test_key != $_POST["key"] || $test_key == "" || empty($test_status_db)){
+ if (empty($test_status_db) || $test_status_int != 0 || $test_key != $_POST["key"] || $test_key == ""){
header("Refresh: 0; /register?reason=prohibited");
exit;
} else {
@@ -225,7 +226,7 @@ function register($db){
){
$_SESSION["login"] = true;
$_SESSION["username"] = $name;
- header("Refresh: 0; /register?reason=registration");
+ header("Refresh: 0; /user?reason=welcome");
} else {
header("Refresh: 0; /register?reason=database");
}