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

$name = $_POST['name'];
$text = stripslashes($_POST['text']);
$pass = $_POST['pass'];

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

if ($crypt_pass != $saved_crypt_pass)
	echo "Password error";
else {
	try {
		$f = fopen("data/$name", 'w');
		fwrite($f, $text);
		fclose($f);
	} catch (Exception $e) {
		echo "File open/write error";
	}
}
?>
