aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authoronefang2019-08-07 22:12:46 +1000
committeronefang2019-08-07 22:12:46 +1000
commitafddecb2830f6afa73f869e120002d12803b3266 (patch)
tree3c3e1a11089fe9ef581a824dc9cc30907ae2a949 /OpenSim
parentTesting MySQLRaw's SELECT. (diff)
downloadopensim-SC_OLD-afddecb2830f6afa73f869e120002d12803b3266.zip
opensim-SC_OLD-afddecb2830f6afa73f869e120002d12803b3266.tar.gz
opensim-SC_OLD-afddecb2830f6afa73f869e120002d12803b3266.tar.bz2
opensim-SC_OLD-afddecb2830f6afa73f869e120002d12803b3266.tar.xz
More account manager.
Select with more parameters. Tables, with member accounts. Print the query values.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Data/MySQL/MySQLRaw.cs8
-rw-r--r--OpenSim/Server/Handlers/Web/WebServerInConnector.cs65
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
40 return result; 40 return result;
41 } 41 }
42 42
43 public List< Hashtable > Select(string table, string wher) 43 public List< Hashtable > Select(string table, string select, string wher, string order)
44 { 44 {
45 string query = "SELECT * FROM " + table; 45 if ("" == select)
46 select = "*";
47 string query = "SELECT " + select + " FROM " + table;
46 if ("" != wher) 48 if ("" != wher)
47 query = query + " WHERE " + wher; 49 query = query + " WHERE " + wher;
50 if ("" != order)
51 query = query + " ORDER BY " + order;
48 52
49 using (MySqlConnection dbcon = new MySqlConnection(m_connectString)) 53 using (MySqlConnection dbcon = new MySqlConnection(m_connectString))
50 { 54 {
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
143 foreach (DictionaryEntry h in headers) 143 foreach (DictionaryEntry h in headers)
144 m_log.InfoFormat("[WEB SERVICE]: {0} method path {1} header {2} = {3}", method, reqpath, (string) h.Key, (string) h.Value); 144 m_log.InfoFormat("[WEB SERVICE]: {0} method path {1} header {2} = {3}", method, reqpath, (string) h.Key, (string) h.Value);
145 foreach (String q in query) 145 foreach (String q in query)
146 m_log.InfoFormat("[WEB SERVICE]: {0} method path {1} query {2}", method, reqpath, q); 146 m_log.InfoFormat("[WEB SERVICE]: {0} method path {1} query {2} value {3}", method, reqpath, q, (string) request[q]);
147 147
148 reply["int_response_code"] = 200; 148 reply["int_response_code"] = 200;
149 if ("GET" == method) 149 if ("GET" == method)
@@ -214,14 +214,12 @@ namespace OpenSim.Server.Handlers.Web
214 } 214 }
215 else if ("list" == fields["doit"].ToString()) 215 else if ("list" == fields["doit"].ToString())
216 { 216 {
217 List< Hashtable > rows = m_database.Select("GridUser", "Login > UNIX_TIMESTAMP(FROM_UNIXTIME(UNIX_TIMESTAMP(now()) - 2419200))"); 217 List< Hashtable > rows = m_database.Select("UserAccounts",
218 foreach (Hashtable row in rows) 218 "CONCAT(FirstName,' ',LastName) as Name,UserTitle as Title,UserLevel as Level,UserFlags as Flags,PrincipalID as UUID",
219 { 219 "", "Name");
220 string line = ""; 220 reply["str_response_string"] = "<html><title>member accounts</title><head></head><body bgcolor=\"black\" text=\"white\" alink=\"red\" link=\"blue\" vlink=\"purple\">" +
221 foreach (DictionaryEntry c in row) 221 table(rows, new string[5] {"Name", "Title", "Level", "Flags", "UUID"}, "member accounts",
222 line = line + " | " + (string) c.Value; 222 "account.html?doit=edit&token=" + fields["token"].ToString(), "UUID") + "<p>" + button("my account") + "</p></body></html>";
223 m_log.Info("[MariaDB RAW]: " + line);
224 }
225 } 223 }
226 else 224 else
227 { 225 {
@@ -281,8 +279,10 @@ namespace OpenSim.Server.Handlers.Web
281 + form("account.html", fields["token"].ToString(), 279 + form("account.html", fields["token"].ToString(),
282 hidden("firstName", fields["firstName"].ToString()) 280 hidden("firstName", fields["firstName"].ToString())
283 + hidden("lastName", fields["lastName"].ToString()) 281 + hidden("lastName", fields["lastName"].ToString())
282// + hidden("UUID", fields["UUID"].ToString())
284 + text("email", "email", "email", fields["email"].ToString(), 0, false) 283 + text("email", "email", "email", fields["email"].ToString(), 0, false)
285 + text("password", "password", "password", "", 14, false) 284 + text("password", "password", "password", "", 14, false)
285// + text("title", "text", "title", fields["title"].ToString(), 0, false)
286 + select("type", "type", 286 + select("type", "type",
287 option("", false) 287 option("", false)
288 + option("approved", true) 288 + option("approved", true)
@@ -303,6 +303,53 @@ namespace OpenSim.Server.Handlers.Web
303 { 303 {
304 return "<html>\n <head>\n <title>" + title + "</title>\n </head>\n <body>\n"; 304 return "<html>\n <head>\n <title>" + title + "</title>\n </head>\n <body>\n";
305 } 305 }
306 // account.html?token=&UUID=....
307 private string table(List< Hashtable > rows, string[] fields, string caption, string URL, string id)
308 {
309 string tbl = "<table border=\"1\"><caption>" + caption + "</caption>";
310 bool head = true;
311 string address = "";
312 string addrend = "";
313 foreach (Hashtable row in rows)
314 {
315 if (0 == fields.Length)
316 {
317 int c = 0;
318 foreach (DictionaryEntry r in row)
319 c++;
320 fields = new string[c];
321 c = 0;
322 foreach (DictionaryEntry r in row)
323 fields[c++] = (string) r.Key;
324 }
325 string line = "<tr>";
326 address = "";
327 if ("" != URL)
328 {
329 address = "<a href=\"" + URL;
330 addrend = "</a>";
331 }
332 if ("" != id)
333 address = address + "&" + id + "=" + row[id] + "\">";
334 if (head)
335 {
336 foreach (string s in fields)
337 line = line + "<th>" + s + "</th>";
338 tbl = tbl + line + "</tr>\n";
339 head = false;
340 }
341 line = "<tr>";
342 foreach (string s in fields)
343 {
344 if (s == id)
345 line = line + "<td>" + address + row[s] + addrend + "</td>";
346 else
347 line = line + "<td>" + row[s] + "</td>";
348 }
349 tbl = tbl + line + "</tr>\n";
350 }
351 return tbl + "</table>";
352 }
306 private string form(string action, string token, string form) 353 private string form(string action, string token, string form)
307 { 354 {
308 return " <form action=\"" + action + "\" method=\"POST\">\n" + hidden("token", token) + form + " </form>\n"; 355 return " <form action=\"" + action + "\" method=\"POST\">\n" + hidden("token", token) + form + " </form>\n";