From 1a51b3797d4c3a846e47b105a5edcb8283726651 Mon Sep 17 00:00:00 2001
From: Patrick Simianer
Date: Tue, 14 Jun 2016 13:15:10 +0200
Subject: submit name, some fixes
---
inc/db.inc.php | 2 +-
index.php | 20 ++++++++++++++------
interface.php | 1 +
js/interface.js | 1 +
server.rb | 4 ++++
util/run_all | 1 +
6 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/inc/db.inc.php b/inc/db.inc.php
index 7356076..e023c3a 100644
--- a/inc/db.inc.php
+++ b/inc/db.inc.php
@@ -2,7 +2,7 @@
$SESSION_DIR="/srv/postedit/sessions";
$key = $_GET["key"];
-if (preg_match('/^[a-z0-9]{4}$/', $key)) {
+if (preg_match('/^[a-z0-9]{1,4}$/', $key)) {
$json = file_get_contents($SESSION_DIR."/".$key."/data.json");
}
$db = json_decode($json);
diff --git a/index.php b/index.php
index 320e653..4b7e13c 100644
--- a/index.php
+++ b/index.php
@@ -4,7 +4,13 @@
Post-Editing Interface
@@ -13,16 +19,18 @@
-
diff --git a/js/interface.js b/js/interface.js
index 0f0b9f3..b86bf50 100644
--- a/js/interface.js
+++ b/js/interface.js
@@ -286,6 +286,7 @@ var next = function ()
}
send_data["key"] = key;
+ send_data["name"] = $("#name").val();
// send data
if (oov_correct.value=="false" && post_edit != "") {
diff --git a/server.rb b/server.rb
index b93464b..d25e216 100755
--- a/server.rb
+++ b/server.rb
@@ -179,6 +179,10 @@ def process_next reply
return
end
$lock = true # lock
+ if !data['name'] || data['name'] == ""
+ $status = "Error: Name not given."
+ return
+ end
if data['key'] != SESSION_KEY
$status = "Error: Key mismatch (#{data['key']}, #{SESSION_KEY})"
return
diff --git a/util/run_all b/util/run_all
index 801d553..ef3386a 100755
--- a/util/run_all
+++ b/util/run_all
@@ -4,5 +4,6 @@
for i in `cat ../sessions/sessions | cut -f 1`; do
echo $i
./util/run_server $i &
+ sleep 15
done
--
cgit v1.2.3