connect_error) { die("Server Error"); } $sql = "INSERT INTO smz_files_data (id, name, description, public, type, hash) VALUES ('$fileId', '$fileName', '$fileDesc', '$public', '$fileType', '$fileHash')"; if ($conn->query($sql) === TRUE) { echo "New record created successfully"; } else { echo "Error: " . $sql . "
" . $conn->error; } $conn->close(); } function getId() { include('../Auth/random.php'); $id = random_int(0, 65535); global $dbservername; global $dbusername; global $dbpassword; global $dbname; $conn = new mysqli($dbservername, $dbusername, $dbpassword, $dbname); if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $sql = "SELECT id FROM smz_files_data WHERE id='$id'"; $result = $conn->query($sql); $conn->close(); if ($result->num_rows > 0) { getId(); } else { return $id; } } function hashCheck($hash) { global $dbservername; global $dbusername; global $dbpassword; global $dbname; $conn = new mysqli($dbservername, $dbusername, $dbpassword, $dbname); if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $sql = "SELECT id FROM smz_files_data WHERE hash='$hash'"; $result = $conn->query($sql); $conn->close(); if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { die("Datei Existiert schon (siehe " . $row["id"] . ")."); } } else { return true; } } ?> smzint/Files - UPLOAD





Select File to upload: