Make submit.php a bit user-friendlier
authorAryeh Gregor <AryehGregor+gitcommit@gmail.com>
Thu, 22 Sep 2011 15:49:58 -0600
changeset 624 3e3d9d45098e
parent 623 e65c152295e3
child 625 6bd5bb0fdb9a
Make submit.php a bit user-friendlier
conformancetest/submit.php
--- a/conformancetest/submit.php	Thu Sep 22 15:39:32 2011 -0600
+++ b/conformancetest/submit.php	Thu Sep 22 15:49:58 2011 -0600
@@ -1,17 +1,21 @@
 <?php
 # I hate PHP, but it's what I know, so this is fastest . . .
+if (empty($_POST)) {
+	die('<!doctype html><title>Error</title><p>Not POSTed');
+}
+
 if (sha1($_POST['password']) !== 'd962ad564032fa99ca43e8f0f6875c8efb9e2905') {
 	# I love how hash functions let me leave the source code open with no
 	# database or secret files, without disclosing the password.
-	die('Incorrect password');
+	die('<!doctype html><title>Error</title><p>Incorrect password');
 }
 
 if ($_POST['ua'] !== 'webkit' && $_POST['ua'] !== 'gecko') {
-	die('No UA provided: must be either "webkit" or "gecko"');
+	die('<!doctype html><title>Error</title><p>No UA provided: must be either "webkit" or "gecko"');
 }
 
 if (file_put_contents($_POST['ua'] . '-data', $_POST['data']) === false) {
-	die('Write failed!');
+	die('<!doctype html><title>Error</title><p>Write failed!');
 }
 
-echo 'Successfully wrote ' . $_POST['ua'] . '-data';
+echo '<!doctype html><title>Success</title><p>Successfully wrote ' . $_POST['ua'] . '-data';