-
Notifications
You must be signed in to change notification settings - Fork 11
/
logo.php
43 lines (37 loc) · 1.1 KB
/
logo.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
session_start();
require_once('lib.php');
$player = Player::getSessionPlayer();
if (!$player->isSuper()) {
header("Location: index.php");
}
if ($_POST['mode'] == 'Upload') {
if ($_FILES['logo']['size'] > 0) {
$file = $_FILES['logo'];
$seriesname = $_POST['series'];
$name = $file['name'];
$tmp = $file['tmp_name'];
$size = $file['size'];
$type = $file['type'];
$f = fopen($tmp, 'r');
$content = fread($f, filesize($tmp));
fclose($f);
$db = Database::getConnection();
$stmt = $db->prepare("UPDATE series SET logo = ?, imgsize = ?,
imgtype = ? WHERE name = ?");
$stmt->bind_param("bdss", $null, $size, $type, $seriesname);
$stmt->send_long_data(0, $content);
$stmt->execute() or die($stmt->error);
$stmt->close();
} else {
echo "No file found";
}
}
else {
echo "<form action=\"logo.php\" method=\"post\" enctype=\"multipart/form-data\">";
echo "<input type=\"file\" id=\"logo\" name=\"logo\">";
echo "<input type=\"text\" name=\"series\">";
echo "<input type=\"submit\" name=\"mode\" value=\"Upload\">";
echo "</form>";
}
?>