changeset 15:ea0f98a0bed8

Fix some issues and bugs caused by recent changes.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 06 Dec 2012 16:52:38 +0200
parents e36c4d2b09c4
children 6da681d1f62a
files admin.inc.php dovote.php login.php msite.inc.php vote.inc.php
diffstat 5 files changed, 25 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/admin.inc.php	Thu Dec 06 16:13:08 2012 +0200
+++ b/admin.inc.php	Thu Dec 06 16:52:38 2012 +0200
@@ -49,7 +49,7 @@
     "<form name=\"admlogin\" action=\"login.php\" method=\"post\">\n".
     stGetFormHiddenInput("mode", "check")."\n".
     stGetFormHiddenInput("goto", $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"])."\n".
-    stGetFormPasswordInput("admpass", "pass", "")."\n".
+    stGetFormPasswordInput("admpass","", "")."\n".
     " <input type=\"submit\" value=\" Login \" />\n".
     "</form>\n";
 
--- a/dovote.php	Thu Dec 06 16:13:08 2012 +0200
+++ b/dovote.php	Thu Dec 06 16:52:38 2012 +0200
@@ -3,6 +3,19 @@
 require "msite.inc.php";
 
 stSetupCacheControl();
+
+// Initiate SQL database connection
+if (!stConnectSQLDB())
+{
+  header("Location: vote");
+  exit;
+}
+
+// Get settings
+stReloadSettings();
+
+
+// Start vote session
 if (!stVoteSessionStart())
 {
   header("Location: vote");
@@ -13,7 +26,7 @@
 stSetVoteStatus(0);
 
 
-if (stCheckHTTPS() && stChkSetting("allowVoting") && stConnectSQLDB())
+if (stCheckHTTPS() && stChkSetting("allowVoting"))
 {
   stGetCompoList(FALSE);
   $mode = stGetRequestItem("mode");
--- a/login.php	Thu Dec 06 16:13:08 2012 +0200
+++ b/login.php	Thu Dec 06 16:52:38 2012 +0200
@@ -6,6 +6,10 @@
 
 if (stGetRequestItem("admpass", FALSE) == stGetSetting("admPassword"))
   stAdmSessionStart();
+else
+{
+  if (stGetSetting("debug")) error_log("Admin session AUTH LOGIN failed (".stGetRequestItem("admpass", FALSE).")");
+}
 
 header("Location: https://".stGetRequestItem("goto"));
 ?>
\ No newline at end of file
--- a/msite.inc.php	Thu Dec 06 16:13:08 2012 +0200
+++ b/msite.inc.php	Thu Dec 06 16:52:38 2012 +0200
@@ -275,7 +275,7 @@
 function stPrintFormTextInput($text1, $text2, $size, $len, $name, $extra="")
 {
   echo "  <tr><th>".chentities($text1)."</th><td>".
-    stGetFormTextInput($size, $len, $name, "", "", $_REQUEST[$name], $extra).
+    stGetFormTextInput($size, $len, $name, "", "", stGetRequestItem($name), $extra).
     "</td><td>".chentities($text2)."</td></tr>\n";
 }
 
--- a/vote.inc.php	Thu Dec 06 16:13:08 2012 +0200
+++ b/vote.inc.php	Thu Dec 06 16:52:38 2012 +0200
@@ -32,12 +32,12 @@
     echo
     "<h1>Voting system</h1>\n".
     "<form name=\"vote\" action=\"dovote.php\" method=\"post\">\n".
-    stGetFormHiddenInput("mode", "key")."\n".
+    " ".stGetFormHiddenInput("mode", "key")."\n".
     " <div class=\"votectrl\">\n".
-    "  Enter your vote key: ".
-    stGetFormTextInput(30, 30, "key", "key", "", stGetSessionItem("key"), "autocomplete=\"off\"").
-    "  <input type=\"submit\" value=\" Login \" />".
-    " </div>\n";
+    "  Enter your vote key:\n".
+    "  ".stGetFormTextInput(30, 30, "key", "", "", stGetSessionItem("key"), "autocomplete=\"off\"")."\n".
+    "  <input type=\"submit\" value=\" Login \" />\n".
+    " </div>\n".
     "</form>\n";
   }
   else