<?php
header('Content-type: text/plain; charset=UTF-8');

$img = $_POST['image'];
$info = $_POST['uptext'];
$pass = $_POST['uppass'];
$info_path = "../info/$img.info";

// Password check
include('../saved_crypt_pass.php');
$crypt_pass = crypt($pass, $saved_crypt_pass);

if ($crypt_pass != $saved_crypt_pass) {
	echo "Password error";
	die();
}

$info = str_replace('\\\'', '\'', str_replace('\"', "\"", $info));

// Info file
$f = fopen($info_path, 'w');
fwrite($f, $info);
fclose($f);

header("Location: http://pictures.metanohi.org/$img");
?>