diff options
| author | oweissbarth | 2014-03-16 22:00:34 +0100 |
|---|---|---|
| committer | oweissbarth | 2014-03-16 22:00:34 +0100 |
| commit | aa0f70e78032d5c5a8e8223e76661de97d7ec3de (patch) | |
| tree | f387f33301b8ef86b70138ae5126f5d360ee95bf /www | |
| parent | 0665ea1e03f2bbb269e33ab78e4271eabe8f6442 (diff) | |
| download | files.iamfabulous.de-aa0f70e78032d5c5a8e8223e76661de97d7ec3de.tar.gz | |
Added more error cases to register ui
Diffstat (limited to 'www')
| -rw-r--r-- | www/constants.php | 2 | ||||
| -rwxr-xr-x | www/functions/func_register.php | 2 | ||||
| -rwxr-xr-x | www/register.php | 20 |
3 files changed, 13 insertions, 11 deletions
diff --git a/www/constants.php b/www/constants.php index 9935e1c..1487bcc 100644 --- a/www/constants.php +++ b/www/constants.php @@ -14,7 +14,7 @@ define("REGISTER_EMAIL", 8); define("REGISTER_DATABASE", 9); define("REGISTER_PROHIBITED", 10); define("REGISTER_INVITEKEY", 12); -define("REGISTER_USERNANE", 13); +define("REGISTER_USERNAME", 13); define("INVITE_SUCCESSFULL", 14); define("INVITE_INVITES", 15); diff --git a/www/functions/func_register.php b/www/functions/func_register.php index b089e24..ebf6c4f 100755 --- a/www/functions/func_register.php +++ b/www/functions/func_register.php @@ -59,7 +59,7 @@ function register($db){ BEGIN TRANSACTION; UPDATE user SET name='" . $safe_name . "', password='" . $hash_password . "', invites=5, status=1, register=(SELECT datetime()) WHERE id=" . $id . "; INSERT INTO files (id, parent, owner, name, folder, mime, size, share, size, hash) VALUES (NULL, 0, $id, '/', 'DIRECTORY', NULL, NULL, 'PUBLIC', 0, ''); - INSERT INTO log (id, user, login) VALUES (NULL, (SELECT id FROM user WHERE name='" . $safe_name"'), (SELECT datetime())); + INSERT INTO log (id, user, login) VALUES (NULL, (SELECT id FROM user WHERE name='" . $safe_name."'), (SELECT datetime())); COMMIT;") ){ diff --git a/www/register.php b/www/register.php index 05bed6e..aa5dffe 100755 --- a/www/register.php +++ b/www/register.php @@ -2,12 +2,6 @@ /* Displays the register page and possible errors. Users specify their username and password and email address to register. As this page is invite-only users must enter their invite-key aswell. - TODO the email cannot differ from the address the mail was sent to. --that's fine and should be - - TODO Username is not checked for duplicates. --fix 16.3.2014 - - TODO invites should have it's own error. --fix 16.3.2014 - It has already been checked that the user isn't already logged in. $case can have the following values: @@ -31,11 +25,11 @@ function print_register($case){ include("static/header.html"); - $username = (isset($_POST["username"]))? $_POST["username"] : ""; + $username = (isset($_POST["username"]) && $case != REGISTER_USERNAME)? $_POST["username"] : ""; $email = (isset($_POST["email"]) && $case != REGISTER_EMAIL)? $_POST["email"] : ""; - $invite_key = isset($_POST["key"])? $_POST["key"] : ""; + $invite_key = (isset($_POST["key"]) && $case != REGISTER_INVITEKEY)? $_POST["key"] : ""; $message = ""; @@ -45,7 +39,7 @@ function print_register($case){ '; break; case(REGISTER_DATABASE): - $message = '<h1 id="register-error">Activation of your account is prohibited</h1> + $message = '<h1 id="register-error">Internal Error. Please contact admin</h1> '; break; case(REGISTER_EMAIL): @@ -56,6 +50,14 @@ function print_register($case){ $message = '<h1 id="register-error">Activation of your account is prohibited</h1> '; break; + case(REGISTER_INVITEKEY): + $message = '<h1 id="register-error">Your invite-key is not correct.</h1> + '; + break; + case(REGISTER_USERNAME): + $message = '<h1 id="register-error">This username is already in use</h1> + '; + break; } |
