changeset 311:2f46b6254ff2

We'll be checking key validity in login phase, so start working on that.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 26 Nov 2013 23:36:11 +0200
parents 8098b5b80f8c
children 9340eb112ccc
files usrlogin.php
diffstat 1 files changed, 16 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/usrlogin.php	Tue Nov 26 23:35:00 2013 +0200
+++ b/usrlogin.php	Tue Nov 26 23:36:11 2013 +0200
@@ -28,16 +28,28 @@
 $password = stGetRequestItem("key", FALSE);
 $error = 0;
 
-$sql = stPrepareSQL("SELECT id FROM votekeys WHERE key=%s", $password);
-if (($votekey_id = stFetchSQLColumn($sql)) !== false)
+$sql = stPrepareSQL("SELECT * FROM votekeys WHERE key=%s", $password);
+if (($key = stFetchSQL($sql)) !== false)
 {
+  switch (stGetSetting("voteKeyMode"))
+  {
+    case VOTE_ACTIVATE:
+      break;
+
+    case VOTE_ASSIGN:
+      break;
+  }
+
   if (!stSessionStart(SESS_USER, $password, "userTimeout"))
   {
     error_log("User session AUTH LOGIN failed (session setup)");
     $error = 2;
   }
   else
+  {
+    stSetSessionItem("key_id", $key["id"]);
     stSetSessionItem("mode", stGetRequestItem("mode", "error"));
+  }
 }
 else
 {
@@ -47,6 +59,7 @@
 
 $nextPage = ($error != 0) ? $errorPage : $gotoPage;
 
-header("Location: ".($nextPage !== FALSE ? $nextPage : stGetSetting("defaultPage"))
+header("Location: ".
+  ($nextPage !== FALSE ? $nextPage : stGetSetting("defaultPage")).
   ($error ? "?error=".$error : "");
 ?>
\ No newline at end of file