mirror of
https://github.com/simon987/Much-Assembly-Required-Frontend.git
synced 2025-12-14 07:09:06 +00:00
Initial commit
This commit is contained in:
35
floppyUp.php
Normal file
35
floppyUp.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
include_once "include/SqlConnection.php";
|
||||
include_once "include/SessionManager.php";
|
||||
|
||||
$user = SessionManager::get();
|
||||
|
||||
if ($user != NULL) {
|
||||
if (isset($_FILES["floppyData"])) {
|
||||
|
||||
if ($_FILES['floppyData']['size'] == (1024 * 1440)) {
|
||||
|
||||
|
||||
$tmpName = $_FILES['floppyData']['tmp_name'];
|
||||
$file = fopen($tmpName, 'rb'); //Read binary
|
||||
|
||||
$conn = new SqlConnection();
|
||||
|
||||
$stmt = $conn->prepare("UPDATE mar_user SET floppyData=? WHERE username=?");
|
||||
$stmt->bindValue(1, $file, PDO::PARAM_LOB);
|
||||
$stmt->bindValue(2, $user['username']);
|
||||
$stmt->execute();
|
||||
|
||||
echo "ok";
|
||||
|
||||
} else {
|
||||
echo "Invalid file size";
|
||||
}
|
||||
} else {
|
||||
echo "File not specified";
|
||||
}
|
||||
} else {
|
||||
echo "Auth problem";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user