User Management
- - - - -Users List
-| Username | -Admin | -Default Path | -Delete Permission | -Download Permission | -Upload Permission | -Actions | -
|---|---|---|---|---|---|---|
| - | - | - | - | - | - | - - | -
diff --git a/Documentation/usbraidlogin.sql b/Documentation/usbraidlogin.sql index b261119..087df16 100644 --- a/Documentation/usbraidlogin.sql +++ b/Documentation/usbraidlogin.sql @@ -35,7 +35,7 @@ CREATE TABLE `users` ( `delPer` tinyint(1) NOT NULL DEFAULT '0', `downPer` tinyint(1) NOT NULL DEFAULT '0', `upPer` tinyint(1) NOT NULL DEFAULT '0' -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Vypisuji data pro tabulku `users` diff --git a/Web/.claude/settings.local.json b/Web/.claude/settings.local.json new file mode 100644 index 0000000..8c1f328 --- /dev/null +++ b/Web/.claude/settings.local.json @@ -0,0 +1,7 @@ +{ + "permissions": { + "allow": [ + "Bash(git add *)" + ] + } +} diff --git a/Web/betatest/composer.json b/Web/betatest/composer.json deleted file mode 100644 index 8f8e167..0000000 --- a/Web/betatest/composer.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "require": { - "phpseclib/phpseclib": "^3.0" - } -} diff --git a/Web/betatest/composer.lock b/Web/betatest/composer.lock deleted file mode 100644 index 8175aae..0000000 --- a/Web/betatest/composer.lock +++ /dev/null @@ -1,246 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", - "This file is @generated automatically" - ], - "content-hash": "6b7a718f1b7b53a21b92507cfa57827a", - "packages": [ - { - "name": "paragonie/constant_time_encoding", - "version": "v3.0.0", - "source": { - "type": "git", - "url": "https://github.com/paragonie/constant_time_encoding.git", - "reference": "df1e7fde177501eee2037dd159cf04f5f301a512" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/df1e7fde177501eee2037dd159cf04f5f301a512", - "reference": "df1e7fde177501eee2037dd159cf04f5f301a512", - "shasum": "" - }, - "require": { - "php": "^8" - }, - "require-dev": { - "phpunit/phpunit": "^9", - "vimeo/psalm": "^4|^5" - }, - "type": "library", - "autoload": { - "psr-4": { - "ParagonIE\\ConstantTime\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Paragon Initiative Enterprises", - "email": "security@paragonie.com", - "homepage": "https://paragonie.com", - "role": "Maintainer" - }, - { - "name": "Steve 'Sc00bz' Thomas", - "email": "steve@tobtu.com", - "homepage": "https://www.tobtu.com", - "role": "Original Developer" - } - ], - "description": "Constant-time Implementations of RFC 4648 Encoding (Base-64, Base-32, Base-16)", - "keywords": [ - "base16", - "base32", - "base32_decode", - "base32_encode", - "base64", - "base64_decode", - "base64_encode", - "bin2hex", - "encoding", - "hex", - "hex2bin", - "rfc4648" - ], - "support": { - "email": "info@paragonie.com", - "issues": "https://github.com/paragonie/constant_time_encoding/issues", - "source": "https://github.com/paragonie/constant_time_encoding" - }, - "time": "2024-05-08T12:36:18+00:00" - }, - { - "name": "paragonie/random_compat", - "version": "v9.99.100", - "source": { - "type": "git", - "url": "https://github.com/paragonie/random_compat.git", - "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/paragonie/random_compat/zipball/996434e5492cb4c3edcb9168db6fbb1359ef965a", - "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a", - "shasum": "" - }, - "require": { - "php": ">= 7" - }, - "require-dev": { - "phpunit/phpunit": "4.*|5.*", - "vimeo/psalm": "^1" - }, - "suggest": { - "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." - }, - "type": "library", - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Paragon Initiative Enterprises", - "email": "security@paragonie.com", - "homepage": "https://paragonie.com" - } - ], - "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", - "keywords": [ - "csprng", - "polyfill", - "pseudorandom", - "random" - ], - "support": { - "email": "info@paragonie.com", - "issues": "https://github.com/paragonie/random_compat/issues", - "source": "https://github.com/paragonie/random_compat" - }, - "time": "2020-10-15T08:29:30+00:00" - }, - { - "name": "phpseclib/phpseclib", - "version": "3.0.43", - "source": { - "type": "git", - "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "709ec107af3cb2f385b9617be72af8cf62441d02" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/709ec107af3cb2f385b9617be72af8cf62441d02", - "reference": "709ec107af3cb2f385b9617be72af8cf62441d02", - "shasum": "" - }, - "require": { - "paragonie/constant_time_encoding": "^1|^2|^3", - "paragonie/random_compat": "^1.4|^2.0|^9.99.99", - "php": ">=5.6.1" - }, - "require-dev": { - "phpunit/phpunit": "*" - }, - "suggest": { - "ext-dom": "Install the DOM extension to load XML formatted public keys.", - "ext-gmp": "Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.", - "ext-libsodium": "SSH2/SFTP can make use of some algorithms provided by the libsodium-php extension.", - "ext-mcrypt": "Install the Mcrypt extension in order to speed up a few other cryptographic operations.", - "ext-openssl": "Install the OpenSSL extension in order to speed up a wide variety of cryptographic operations." - }, - "type": "library", - "autoload": { - "files": [ - "phpseclib/bootstrap.php" - ], - "psr-4": { - "phpseclib3\\": "phpseclib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jim Wigginton", - "email": "terrafrost@php.net", - "role": "Lead Developer" - }, - { - "name": "Patrick Monnerat", - "email": "pm@datasphere.ch", - "role": "Developer" - }, - { - "name": "Andreas Fischer", - "email": "bantu@phpbb.com", - "role": "Developer" - }, - { - "name": "Hans-Jürgen Petrich", - "email": "petrich@tronic-media.com", - "role": "Developer" - }, - { - "name": "Graham Campbell", - "email": "graham@alt-three.com", - "role": "Developer" - } - ], - "description": "PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.", - "homepage": "http://phpseclib.sourceforge.net", - "keywords": [ - "BigInteger", - "aes", - "asn.1", - "asn1", - "blowfish", - "crypto", - "cryptography", - "encryption", - "rsa", - "security", - "sftp", - "signature", - "signing", - "ssh", - "twofish", - "x.509", - "x509" - ], - "support": { - "issues": "https://github.com/phpseclib/phpseclib/issues", - "source": "https://github.com/phpseclib/phpseclib/tree/3.0.43" - }, - "funding": [ - { - "url": "https://github.com/terrafrost", - "type": "github" - }, - { - "url": "https://www.patreon.com/phpseclib", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/phpseclib/phpseclib", - "type": "tidelift" - } - ], - "time": "2024-12-14T21:12:59+00:00" - } - ], - "packages-dev": [], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": [], - "platform-dev": [], - "plugin-api-version": "2.6.0" -} diff --git a/Web/betatest/content/adminpanel.php b/Web/betatest/content/adminpanel.php deleted file mode 100644 index 191e79d..0000000 --- a/Web/betatest/content/adminpanel.php +++ /dev/null @@ -1,265 +0,0 @@ -set_charset("utf8"); - -if ($conn->connect_error) { - die("Database connection failed: " . $conn->connect_error); -} - -if ($_SERVER['REQUEST_METHOD'] === 'POST') { - if (isset($_POST['uname']) && isset($_POST['pswd'])) { - $uname = trim($_POST['uname']); - $pswd = trim($_POST['pswd']); - $is_admin = isset($_POST['admin']) ? 1 : 0; - $defPath = isset($_POST['defPath']) ? trim($_POST['defPath']) : ''; - $delPer = isset($_POST['delPer']) ? (int)$_POST['delPer'] : 0; - $dowPer = isset($_POST['downPer']) ? (int)$_POST['downPer'] : 0; - $upPer = isset($_POST['upPer']) ? (int)$_POST['upPer'] : 0; - - if (empty($uname) || empty($pswd)) { - $_SESSION['message'] = 'Error: Username and password are required!'; - $_SESSION['message_type'] = 'error'; - } else if (!CheckPassword($pswd)) { - $_SESSION['message'] = 'Error: Password must be at least 8 characters long, contain at least one number and one uppercase letter!'; - $_SESSION['message_type'] = 'error'; - } else { - $sql_check = "SELECT * FROM users WHERE uname = ?"; - $stmt_check = $conn->prepare($sql_check); - if (!$stmt_check) { - $_SESSION['message'] = 'Error: Database preparation failed.'; - $_SESSION['message_type'] = 'error'; - } else { - $stmt_check->bind_param("s", $uname); - $stmt_check->execute(); - $result_check = $stmt_check->get_result(); - - if ($result_check->num_rows > 0) { - $_SESSION['message'] = 'Error: Username already exists!'; - $_SESSION['message_type'] = 'error'; - } else { - $sql_insert = "INSERT INTO users (uname, pswd, admin, defPath, delPer, downPer, upPer) VALUES (?, ?, ?, ?, ?, ?, ?)"; - $stmt_insert = $conn->prepare($sql_insert); - if (!$stmt_insert) { - $_SESSION['message'] = 'Error: Database preparation failed.'; - $_SESSION['message_type'] = 'error'; - } else { - $hash = password_hash($pswd, PASSWORD_BCRYPT); - if (!$hash) { - $_SESSION['message'] = 'Error: Password hashing failed.'; - $_SESSION['message_type'] = 'error'; - } else { - $stmt_insert->bind_param("ssisiii", $uname, $hash, $is_admin, $defPath, $delPer, $dowPer, $upPer); - if ($stmt_insert->execute()) { - $_SESSION['message'] = 'User added successfully!'; - $_SESSION['message_type'] = 'success'; - } else { - $_SESSION['message'] = 'Error: Failed to add user. Please try again later.'; - $_SESSION['message_type'] = 'error'; - } - } - } - } - $stmt_check->close(); - if (isset($stmt_insert)) { - $stmt_insert->close(); - } - } - } - - header("Location: adminpanel.php"); - exit(); - } else { - $_SESSION['message'] = 'Error: Missing form data!'; - $_SESSION['message_type'] = 'error'; - header("Location: adminpanel.php"); - exit(); - } -} - -if (isset($_GET['delete'])) { - $delete_uname = htmlspecialchars($_GET['delete']); - $sql = "DELETE FROM users WHERE uname=?"; - $stmt = $conn->prepare($sql); - if ($stmt) { - $stmt->bind_param("s", $delete_uname); - if ($stmt->execute()) { - $_SESSION['message'] = 'User deleted successfully!'; - $_SESSION['message_type'] = 'success'; - } else { - $_SESSION['message'] = 'Error: Failed to delete user.'; - $_SESSION['message_type'] = 'error'; - } - $stmt->close(); - } else { - $_SESSION['message'] = 'Error: Database preparation failed.'; - $_SESSION['message_type'] = 'error'; - } - - header("Location: adminpanel.php"); - exit(); -} - -$result = $conn->query("SELECT uname, admin, defPath, delPer, downPer, upPer FROM users"); - -$message = $_SESSION['message'] ?? ''; -$message_type = $_SESSION['message_type'] ?? ''; -unset($_SESSION['message']); -unset($_SESSION['message_type']); - -function CheckPassword($password) { - if (strlen($password) < 8) { - return false; - } - if (!preg_match('/[0-9]/', $password)) { - return false; - } - if (!preg_match('/[A-Z]/', $password)) { - return false; - } - return true; -} -?> - - - -
-| Username | -Admin | -Default Path | -Delete Permission | -Download Permission | -Upload Permission | -Actions | -
|---|---|---|---|---|---|---|
| - | - | - | - | - | - | - - | -
| Name | -Size | -Actions | -
|---|---|---|
| .. (Go Back) | -||
| - = htmlspecialchars($directory) ?>/ - | -- - - - - - - - - - - | -|
| - - - - = htmlspecialchars($file) ?> - - - Image - - Video - - Audio - - - - = htmlspecialchars($file) ?> - - = htmlspecialchars($fileExtension) ?> - - - = htmlspecialchars($file) ?> - - PDF - - = htmlspecialchars($file) ?> - = htmlspecialchars($fileExtension) ?> - - | -- = formatBytes($sftp->stat($currentPath . '/' . $file)['size']) ?> - | -- - - - - - - - - - - - - - | -
This link will expire on = date('F j, Y, g:i a', strtotime($share['expiration'])) ?>
-| File Name | -= htmlspecialchars($fileName) ?> | -
|---|---|
| File Type | -= htmlspecialchars(strtoupper($fileExtension)) ?> | -
| File Size | -= formatBytes($fileSize) ?> | -
Share link created successfully!
-This link will expire on = date('F j, Y, g:i a', strtotime($shareExpiration)) ?>
-| File Name | -= htmlspecialchars($fileName) ?> | -
|---|---|
| File Type | -= htmlspecialchars(strtoupper($fileExtension)) ?> | -
| MIME Type | -= htmlspecialchars($mimeType) ?> | -
| File Size | -= formatBytes($fileSize) ?> | -