about summary refs log tree commit diff
diff options
context:
space:
mode:
authorKevin Mandura <webmaster@kevin-mandura.de>2024-03-11 00:23:06 +0100
committerKevin Mandura <webmaster@kevin-mandura.de>2024-03-11 00:23:06 +0100
commitd7026dba814637f42fb1c0c1e3f9e67752b96e13 (patch)
tree052f7c5654dafdd51f00355a220ee0f5b2a325ea
parent1290682ea21c3e8c8d90cce02e2387aed2189129 (diff)
downloadktls-website-d7026dba814637f42fb1c0c1e3f9e67752b96e13.tar.gz
ktls-website-d7026dba814637f42fb1c0c1e3f9e67752b96e13.zip
Apply file upload quota default value with account registration
-rw-r--r--includes/functions/user-account-functions/createAccount.inc.php34
1 files changed, 17 insertions, 17 deletions
diff --git a/includes/functions/user-account-functions/createAccount.inc.php b/includes/functions/user-account-functions/createAccount.inc.php
index a954477..2c458e1 100644
--- a/includes/functions/user-account-functions/createAccount.inc.php
+++ b/includes/functions/user-account-functions/createAccount.inc.php
@@ -16,25 +16,25 @@
  * @copyright Copyright (c) 2023, Kevin Mandura <webmaster@kevin-mandura.de>
  */
 function createAccount(object $dbConn, string $username, string $passwordHash) {
-  /* Require dependency script */
-  require_once(__DIR__ . "/../logIP.inc.php");
+    /* Require dependency script */
+    require_once(__DIR__ . "/../logIP.inc.php");
 
-  /* Also set the registration date */
-  $registrationDate = date("Y-m-d H:i:s");
+    /* Also set the registration date */
+    $registrationDate = date("Y-m-d H:i:s");
 
-  /* Define SQL statement */
-  $sql = "INSERT INTO accounts (username, password_hash, created_at) VALUES (?, ?, ?);";
-  $stmt = mysqli_stmt_init($dbConn);
+    /* Define SQL statement */
+    $sql = "INSERT INTO accounts (username, password_hash, upload_quota_bytes, created_at) VALUES (?, ?, " . DEFAULT_UPLOAD_QUOTA_PER_USER . ", ?);";
+    $stmt = mysqli_stmt_init($dbConn);
 
-  /* If statement preparation fails, abort with error message */
-  if (!mysqli_stmt_prepare($stmt, $sql)) {
-    logIP($dbConn, $_SERVER["REMOTE_ADDR"]);
-    header("Location: /register.php?action=signup&error=db");
-    exit();
-  }
+    /* If statement preparation fails, abort with error message */
+    if (!mysqli_stmt_prepare($stmt, $sql)) {
+        logIP($dbConn, $_SERVER["REMOTE_ADDR"]);
+        header("Location: /register.php?action=signup&error=db");
+        exit();
+    }
 
-  /* Complete and execute SQL statement */
-  mysqli_stmt_bind_param($stmt, "sss", $username, $passwordHash, $registrationDate);
-  mysqli_stmt_execute($stmt);
-  mysqli_stmt_close($stmt);
+    /* Complete and execute SQL statement */
+    mysqli_stmt_bind_param($stmt, "sss", $username, $passwordHash, $registrationDate);
+    mysqli_stmt_execute($stmt);
+    mysqli_stmt_close($stmt);
 }