43 lines
1.1 KiB
PHP
43 lines
1.1 KiB
PHP
|
<?php
|
||
|
header('Content-type: text/html; charset=UTF-8');
|
||
|
|
||
|
$file = $_FILES['upfile'];
|
||
|
$filename = basename($file['name']);
|
||
|
$info = $_POST['uptext'];
|
||
|
$pass = $_POST['uppass'];
|
||
|
$img_path = "../img/$filename";
|
||
|
$info_path = "../info/$filename.info";
|
||
|
|
||
|
// Password check
|
||
|
include('../saved_crypt_pass.php');
|
||
|
$crypt_pass = crypt($pass, $saved_crypt_pass);
|
||
|
|
||
|
if ($crypt_pass != $saved_crypt_pass)
|
||
|
$msg = "Password error";
|
||
|
else {
|
||
|
// Image file
|
||
|
if (move_uploaded_file($file['tmp_name'], $img_path)) {
|
||
|
$msg = "'<a href='http://pictures.metanohi.org/$filename'>$filename</a>' uploaded";
|
||
|
if (!(file_exists($info_path) && $info == '')) {
|
||
|
$info = str_replace('\\\'', '\'', str_replace('\"', "\"", $info));
|
||
|
// Info file
|
||
|
$f = fopen($info_path, 'w');
|
||
|
fwrite($f, $info);
|
||
|
fclose($f);
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
$msg = "Upload error";
|
||
|
}
|
||
|
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||
|
<html xmlns='http://www.w3.org/1999/xhtml'>
|
||
|
<head>
|
||
|
<title>Uploader</title>
|
||
|
</head>
|
||
|
<body>
|
||
|
<p><?php echo $msg; ?></p>
|
||
|
<a href='index.php'>New</a>
|
||
|
</body>
|
||
|
</html>
|
||
|
|