First commit.

This commit is contained in:
Niels Serup
2011-08-02 19:57:57 +02:00
commit 0cc9d8fdc5
623 changed files with 28299 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
<?php
header('Content-type: text/html; charset=UTF-8');
?><!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>
<meta name='description' content='Upload a picture. Owner only.' />
<meta http-equiv='content-language' content='en' />
<meta http-equiv='content-type' content='text/html; charset=utf-8' />
<title>Upload picture</title>
</head>
<body>
<form enctype='multipart/form-data' action='upload.php' method='post'>
<p><input name='upfile' type='file' /></p>
<p><textarea name='uptext' rows='10' cols='80'></textarea></p>
<p><input name='uppass' type='password' /></p>
<p><input type='submit' value='Upload file' /></p>
</form>
</body>
</html>

View File

@@ -0,0 +1,42 @@
<?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>