From d225afbdc4633b9a836decb717166f19f2c3440f Mon Sep 17 00:00:00 2001 From: Horus3 Date: Mon, 10 Mar 2014 23:09:12 +0100 Subject: instructions 4 oli --- www/createfolder.php | 2 +- www/functions.php | 9 +++++---- www/index.php | 7 ++++--- www/login.php | 14 ++++++++++++++ www/register.php | 16 ++++++++++++++++ 5 files changed, 40 insertions(+), 8 deletions(-) (limited to 'www') diff --git a/www/createfolder.php b/www/createfolder.php index c559691..bba776d 100644 --- a/www/createfolder.php +++ b/www/createfolder.php @@ -80,7 +80,7 @@ if($_SERVER['REQUEST_METHOD'] == 'POST'){ } else { - echo "Hallo $name + echo "Hallo $_SESSION[username];

Folder:

Public?

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"); } diff --git a/www/index.php b/www/index.php index 77a29e6..3cc5377 100644 --- a/www/index.php +++ b/www/index.php @@ -7,12 +7,13 @@ require_once("interface_functions.php"); $db = new SQLite3("../database/sqlite.db"); + if(empty($_GET)){ - if($_SESSION["login"]){ - header("Refresh: 0; /$_SESSION[username]"); + if(!$_SESSION["login"]){ + header("Refresh: 0; /login"); exit; } else { - header("Refresh: 0; /login"); + header("Refresh: 0; /" . $_SESSION[username]); exit; } } else { diff --git a/www/login.php b/www/login.php index 470065d..e28b940 100644 --- a/www/login.php +++ b/www/login.php @@ -1,3 +1,17 @@ + + diff --git a/www/register.php b/www/register.php index bdac189..670e0c4 100644 --- a/www/register.php +++ b/www/register.php @@ -1,3 +1,19 @@ + + + -- cgit v1.2.3