changeset 70:d31fc2c53b2b

Added stUpdateUserKey(uid) for updating / regenerating a vote key for given UID.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 11 Oct 2013 09:32:00 +0300
parents 30a4420e85ab
children d74fb8cf0062
files msite.inc.php
diffstat 1 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/msite.inc.php	Fri Oct 11 09:31:25 2013 +0300
+++ b/msite.inc.php	Fri Oct 11 09:32:00 2013 +0300
@@ -500,6 +500,22 @@
 }
 
 
+function stUpdateUserKey($uid)
+{
+  if (($res = stGenerateUserKey()) !== FALSE)
+  {
+    // Nope, add key into database
+    $sql = stPrepareSQL(
+      "UPDATE attendees SET key=%s,active=0 WHERE id=%d",
+      $key, $uid);
+    
+    return stExecSQL($sql);
+  }
+  else
+    return FALSE;
+}
+
+
 function stSetStatus($val, $msg)
 {
   global $statusSet;