From afddecb2830f6afa73f869e120002d12803b3266 Mon Sep 17 00:00:00 2001 From: onefang Date: Wed, 7 Aug 2019 22:12:46 +1000 Subject: More account manager. Select with more parameters. Tables, with member accounts. Print the query values. --- OpenSim/Data/MySQL/MySQLRaw.cs | 8 ++- .../Server/Handlers/Web/WebServerInConnector.cs | 65 +++++++++++++++++++--- 2 files changed, 62 insertions(+), 11 deletions(-) diff --git a/OpenSim/Data/MySQL/MySQLRaw.cs b/OpenSim/Data/MySQL/MySQLRaw.cs index 4be6d90..e8f80aa 100644 --- a/OpenSim/Data/MySQL/MySQLRaw.cs +++ b/OpenSim/Data/MySQL/MySQLRaw.cs @@ -40,11 +40,15 @@ namespace OpenSim.Data.MySQL return result; } - public List< Hashtable > Select(string table, string wher) + public List< Hashtable > Select(string table, string select, string wher, string order) { - string query = "SELECT * FROM " + table; + if ("" == select) + select = "*"; + string query = "SELECT " + select + " FROM " + table; if ("" != wher) query = query + " WHERE " + wher; + if ("" != order) + query = query + " ORDER BY " + order; using (MySqlConnection dbcon = new MySqlConnection(m_connectString)) { diff --git a/OpenSim/Server/Handlers/Web/WebServerInConnector.cs b/OpenSim/Server/Handlers/Web/WebServerInConnector.cs index 568b7d6..1dedfa3 100644 --- a/OpenSim/Server/Handlers/Web/WebServerInConnector.cs +++ b/OpenSim/Server/Handlers/Web/WebServerInConnector.cs @@ -143,7 +143,7 @@ namespace OpenSim.Server.Handlers.Web foreach (DictionaryEntry h in headers) m_log.InfoFormat("[WEB SERVICE]: {0} method path {1} header {2} = {3}", method, reqpath, (string) h.Key, (string) h.Value); foreach (String q in query) - m_log.InfoFormat("[WEB SERVICE]: {0} method path {1} query {2}", method, reqpath, q); + m_log.InfoFormat("[WEB SERVICE]: {0} method path {1} query {2} value {3}", method, reqpath, q, (string) request[q]); reply["int_response_code"] = 200; if ("GET" == method) @@ -214,14 +214,12 @@ namespace OpenSim.Server.Handlers.Web } else if ("list" == fields["doit"].ToString()) { - List< Hashtable > rows = m_database.Select("GridUser", "Login > UNIX_TIMESTAMP(FROM_UNIXTIME(UNIX_TIMESTAMP(now()) - 2419200))"); - foreach (Hashtable row in rows) - { - string line = ""; - foreach (DictionaryEntry c in row) - line = line + " | " + (string) c.Value; - m_log.Info("[MariaDB RAW]: " + line); - } + List< Hashtable > rows = m_database.Select("UserAccounts", + "CONCAT(FirstName,' ',LastName) as Name,UserTitle as Title,UserLevel as Level,UserFlags as Flags,PrincipalID as UUID", + "", "Name"); + reply["str_response_string"] = "
" + button("my account") + "
"; } else { @@ -281,8 +279,10 @@ namespace OpenSim.Server.Handlers.Web + form("account.html", fields["token"].ToString(), hidden("firstName", fields["firstName"].ToString()) + hidden("lastName", fields["lastName"].ToString()) +// + hidden("UUID", fields["UUID"].ToString()) + text("email", "email", "email", fields["email"].ToString(), 0, false) + text("password", "password", "password", "", 14, false) +// + text("title", "text", "title", fields["title"].ToString(), 0, false) + select("type", "type", option("", false) + option("approved", true) @@ -303,6 +303,53 @@ namespace OpenSim.Server.Handlers.Web { return "\n \n" + s + " | "; + tbl = tbl + line + "|
---|---|
" + address + row[s] + addrend + " | "; + else + line = line + "" + row[s] + " | "; + } + tbl = tbl + line + "