|
|
@@ -35,9 +35,8 @@ class Alter {
|
|
35
|
35
|
die("Error, please enable browser redirects.");
|
|
36
|
36
|
}
|
|
37
|
37
|
|
|
38
|
|
-
|
|
39
|
38
|
/* Event functions */
|
|
40
|
|
-
|
|
|
39
|
+
|
|
41
|
40
|
public static function addEvent($title, $content, $type, $eventdate) {
|
|
42
|
41
|
$db = new DBClass();
|
|
43
|
42
|
$sql = "INSERT INTO `events` (`id`, `title`, `img`, `type`, `description`, `time`) VALUES (NULL, '$title', 'image', '$type', '$content', '" . strtotime($eventdate) . "');";
|
|
|
@@ -61,30 +60,32 @@ class Alter {
|
|
61
|
60
|
header('Location: ' . Config::$sys_url . '?page=eventadmin');
|
|
62
|
61
|
die("Error, please enable browser redirects.");
|
|
63
|
62
|
}
|
|
64
|
|
-
|
|
65
|
|
- public static function addUser($username, $password, $realname, $mail, $level) {
|
|
|
63
|
+
|
|
|
64
|
+ public static function addUser($username, $password, $realname, $mail, $level) {
|
|
66
|
65
|
if (Get::checkExists($username)) { // check if user exists
|
|
67
|
66
|
// ERROR USER EXISTS
|
|
68
|
|
- die();
|
|
|
67
|
+ return false;
|
|
|
68
|
+ } elseif (strlen($username) < 3) {
|
|
|
69
|
+ return false;
|
|
|
70
|
+ } elseif (strlen($password) < 5) {
|
|
|
71
|
+ return false;
|
|
|
72
|
+ } elseif (strlen($realname) < 5) {
|
|
|
73
|
+ return false;
|
|
|
74
|
+ } elseif (strlen($mail) < 5) {
|
|
|
75
|
+ return false;
|
|
|
76
|
+ } else {
|
|
|
77
|
+ // Now we know everything contains something.
|
|
|
78
|
+ // Time to sanitize!
|
|
|
79
|
+
|
|
|
80
|
+ $username = filter_var($username, FILTER_SANITIZE_STRING);
|
|
|
81
|
+ $realname = filter_var($realname, FILTER_SANITIZE_STRING);
|
|
|
82
|
+ $mail = filter_var($mail, FILTER_SANITIZE_EMAIL);
|
|
|
83
|
+ // Gr8, we are sanitized. We dont sanitize password, as we hash it anyway using argon2
|
|
|
84
|
+
|
|
|
85
|
+ $db = new DBClass();
|
|
|
86
|
+ $sql = "INSERT INTO `users` (`id`, `realname`, `username`, `password`, `email`, `level`) VALUES (NULL, '$realname', '$username', '" . User::hashPass($password) . "', '$mail', '$level');";
|
|
|
87
|
+ return $db->query($sql);
|
|
69
|
88
|
}
|
|
70
|
|
-
|
|
71
|
|
- // lets check the variables
|
|
72
|
|
-
|
|
73
|
|
- if (strlen($username) < 3) { die(); }
|
|
74
|
|
- elseif (strlen($password) < 5) { die(); }
|
|
75
|
|
- elseif (strlen($realname) < 5) { die(); }
|
|
76
|
|
- elseif (strlen($mail) < 5) { die(); }
|
|
77
|
|
- // Now we know everything contains something.
|
|
78
|
|
- // Time to sanitize!
|
|
79
|
|
-
|
|
80
|
|
- $username = filter_var($username, FILTER_SANITIZE_STRING);
|
|
81
|
|
- $realname = filter_var($realname, FILTER_SANITIZE_STRING);
|
|
82
|
|
- $mail = filter_var($mail, FILTER_SANITIZE_EMAIL);
|
|
83
|
|
- // Gr8, we are sanitized. We dont sanitize password, as we hash it anyway using argon2
|
|
84
|
|
-
|
|
85
|
|
- $db = new DBClass();
|
|
86
|
|
- $sql = "INSERT INTO `users` (`id`, `realname`, `username`, `password`, `email`, `level`) VALUES (NULL, '$realname', '$username', '" . User::hashPass($password) . "', '$mail', '$level');";
|
|
87
|
|
- return $db->query($sql);
|
|
88
|
89
|
}
|
|
89
|
90
|
|
|
90
|
91
|
}
|