X-Git-Url: https://git.pterodactylus.net/?p=fms.git;a=blobdiff_plain;f=src%2Fhttp%2Fpages%2Fexecquerypage.cpp;h=97b402b60a586699f475e78c43e557b3fc462c1b;hp=f86579a45f62a19c3ef4582f45ab4bd4a33e4572;hb=HEAD;hpb=52c0819bfc1d083c6e0738f75f0d7eeba521295a diff --git a/src/http/pages/execquerypage.cpp b/src/http/pages/execquerypage.cpp index f86579a..97b402b 100644 --- a/src/http/pages/execquerypage.cpp +++ b/src/http/pages/execquerypage.cpp @@ -8,12 +8,34 @@ const std::string ExecQueryPage::GeneratePage(const std::string &method, const std::map &queryvars) { std::string content=""; + std::string query=""; - if(queryvars.find("formaction")!=queryvars.end() && (*queryvars.find("formaction")).second=="execute" && queryvars.find("query")!=queryvars.end() && (*queryvars.find("query")).second!="") + if(queryvars.find("formaction")!=queryvars.end() && (*queryvars.find("formaction")).second=="execute" && queryvars.find("query")!=queryvars.end() && (*queryvars.find("query")).second!="" && ValidateFormPassword(queryvars)) { - SQLite3DB::Recordset rs=m_db->Query((*queryvars.find("query")).second); + query=(*queryvars.find("query")).second; + SQLite3DB::Recordset rs=m_db->Query(query); content+=""; + if(rs.Count()>0) + { + content+=""; + for(int i=0; iGetLastResult()!=SQLITE_OK) + { + std::string error=""; + m_db->GetLastError(error); + content+=""; + } while(!rs.AtEnd()) { content+=""; @@ -22,7 +44,7 @@ const std::string ExecQueryPage::GeneratePage(const std::string &method, const s content+=""; } @@ -34,12 +56,13 @@ const std::string ExecQueryPage::GeneratePage(const std::string &method, const s content+="

Execute Query

"; content+=""; + content+=CreateFormPassword(); content+=""; - content+=""; + content+=""; content+=""; content+=""; - return "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n"+StringFunctions::Replace(m_template,"[CONTENT]",content); + return StringFunctions::Replace(m_template,"[CONTENT]",content); } const bool ExecQueryPage::WillHandleURI(const std::string &uri)
"+error+"
"; if(rs.GetField(i)) { - content+=rs.GetField(i); + content+=SanitizeOutput(std::string(rs.GetField(i))); } content+="