summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHorus32014-03-16 22:28:03 +0100
committerHorus32014-03-16 22:28:03 +0100
commit1e526e476e75c936b4229914d63b7ef91aa4a790 (patch)
tree48372996254dcc6842a34f0f0eed8fee3e515ddc
parent3cbe01ea7df2f628e767b7b00e7c1612062c05ab (diff)
parentaa0f70e78032d5c5a8e8223e76661de97d7ec3de (diff)
downloadfiles.iamfabulous.de-1e526e476e75c936b4229914d63b7ef91aa4a790.tar.gz
merge
-rw-r--r--www/constants.php2
-rwxr-xr-xwww/functions/func_register.php2
-rwxr-xr-xwww/register.php20
3 files changed, 13 insertions, 11 deletions
diff --git a/www/constants.php b/www/constants.php
index d8f3229..78a73bf 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", 11);
-define("REGISTER_USERNANE", 12);
+define("REGISTER_USERNAME", 12);
define("REGISTER_INVITE", 13);
define("INVITE_SUCCESSFULL", 14);
diff --git a/www/functions/func_register.php b/www/functions/func_register.php
index bafdbad..bb2a02c 100755
--- a/www/functions/func_register.php
+++ b/www/functions/func_register.php
@@ -61,7 +61,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;
}