changeset 716:e7fbcf4190e6

Add registration host.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 12 Nov 2014 16:31:35 +0200
parents 0fa410eb9bf1
children 6178399820b9
files admajax.php admin.js dbdefs.inc.php msite.inc.php pages/register.inc.php
diffstat 5 files changed, 18 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/admajax.php	Wed Nov 12 04:37:50 2014 +0200
+++ b/admajax.php	Wed Nov 12 16:31:35 2014 +0200
@@ -1120,6 +1120,7 @@
           "  <th class=\"regtime\">Registered</th>\n".
           "  <th class=\"oneliner\">Oneliner</th>\n".
           "  <th class=\"email\">E-mail</th>\n".
+          "  <th class=\"reghost\">RegHost</th>\n".
           "  <th>Actions</th>\n".
           " </tr>\n";
 
@@ -1503,10 +1504,7 @@
     else
     if ($type == "attendees" && stValidateRequestUserData(TRUE, FALSE))
     {
-      $sql = stPrepareSQL(
-        "INSERT INTO attendees (regtime,name,groups,oneliner,email) VALUES (%d,%S,%S,%S,%S)",
-        time(), "name", "groups", "oneliner", "email");
-
+      $sql = stGetAttendeeRegistrationSQL();
       stExecSQLCond($sql, "OK, attendee added.");
     }
     else
@@ -1555,6 +1553,7 @@
             "groups" => "S",
             "email" => "S",
             "oneliner" => "S",
+            "reghost" => "S",
           ));
 
         stExecSQLCond($sql, "OK, attendee updated.");
--- a/admin.js	Wed Nov 12 04:37:50 2014 +0200
+++ b/admin.js	Wed Nov 12 16:31:35 2014 +0200
@@ -212,7 +212,7 @@
 
 function updateAttendee(id)
 {
-  var args = jsMakePostArgs({"name":1,"groups":1,"oneliner":1,"email":1}, "at", id);
+  var args = jsMakePostArgs({"name":1,"groups":1,"oneliner":1,"email":1,"reghost":1}, "at", id);
 
   var msuccess = function(txt)
   {
--- a/dbdefs.inc.php	Wed Nov 12 04:37:50 2014 +0200
+++ b/dbdefs.inc.php	Wed Nov 12 16:31:35 2014 +0200
@@ -1,6 +1,6 @@
 <?
 
-$dbVersion = 20;
+$dbVersion = 21;
 
 //
 // Site settings and defaults we put in
@@ -282,6 +282,7 @@
     array("groups"       , "VARCHAR(".SET_LEN_GROUPS.")"),
     array("oneliner"     , "VARCHAR(".SET_LEN_ONELINER.")"),
     array("email"        , "VARCHAR(".SET_LEN_EMAIL.")"),
+    array("reghost"      , "VARCHAR(".SET_LEN_REGHOST.")", "DEFAULT NULL"),
     array("key_id"       , "INT", "DEFAULT NULL"),
   ),
 
--- a/msite.inc.php	Wed Nov 12 04:37:50 2014 +0200
+++ b/msite.inc.php	Wed Nov 12 16:31:35 2014 +0200
@@ -18,6 +18,7 @@
 define("SET_LEN_GROUPS", 64);
 define("SET_LEN_ONELINER", 64);
 define("SET_LEN_EMAIL", 80);
+define("SET_LEN_REGHOST", 128);
 
 define("SET_LEN_NEWS_TITLE", 128);
 define("SET_LEN_NEWS_TEXT", 4096);
@@ -226,7 +227,8 @@
   if ($full)
   {
     echo
-      stGetTDFormTextInput($edit, 20, SET_LEN_EMAIL, "email", $id, $prefix, $item["email"], "autocomplete=\"off\"");
+      stGetTDFormTextInput($edit, 15, SET_LEN_EMAIL, "email", $id, $prefix, $item["email"], "autocomplete=\"off\"").
+      stGetTDFormTextInput($edit, 15, SET_LEN_REGHOST, "reghost", $id, $prefix, $item["reghost"], "autocomplete=\"off\"");
 
     if ($edit)
     {
@@ -630,6 +632,14 @@
 }
 
 
+function stGetAttendeeRegistrationSQL()
+{
+  return stPrepareSQL(
+    "INSERT INTO attendees (regtime,name,groups,oneliner,email,reghost) VALUES (%d,%S,%S,%S,%S,%s)",
+    time(), "name", "groups", "oneliner", "email", $_SERVER["REMOTE_ADDR"]);
+}
+
+
 // Get link helper function
 function stGetMainPageLink($id, $name, $show = TRUE)
 {
--- a/pages/register.inc.php	Wed Nov 12 04:37:50 2014 +0200
+++ b/pages/register.inc.php	Wed Nov 12 16:31:35 2014 +0200
@@ -181,10 +181,7 @@
   else
   if ($mode == "register")
   {
-    $sql = stPrepareSQL(
-      "INSERT INTO attendees (regtime,name,groups,oneliner,email) VALUES (%d,%S,%S,%S,%S)",
-      time(), "name", "groups", "oneliner", "email");
-
+    $sql = stGetAttendeeRegistrationSQL();
     if (stExecSQL($sql) !== FALSE)
     {
       echo stGetSetting("registerPostText");