+ // get localidentityid from querystring or load one from the database\r
+ if(queryvars.find("localidentityid")!=queryvars.end())\r
+ {\r
+ localidentityidstr=(*queryvars.find("localidentityid")).second;\r
+ StringFunctions::Convert(localidentityidstr,localidentityid);\r
+ // insert the ID into the temporary table so we remember the identity if we load the page later\r
+ m_db->Execute("DELETE FROM tmpLocalIdentityPeerTrustPage;");\r
+ SQLite3DB::Statement st=m_db->Prepare("INSERT INTO tmpLocalIdentityPeerTrustPage(LocalIdentityID) VALUES(?);");\r
+ st.Bind(0,localidentityid);\r
+ st.Step();\r
+ }\r
+ else\r
+ {\r
+ // try to get the localidentityid if it exists in the temp table, otherwise load the first identity in the database\r
+ SQLite3DB::Statement st=m_db->Prepare("SELECT LocalIdentityID FROM tmpLocalIdentityPeerTrustPage;");\r
+ st.Step();\r
+ if(st.RowReturned())\r
+ {\r
+ st.ResultInt(0,localidentityid);\r
+ StringFunctions::Convert(localidentityid,localidentityidstr);\r
+ }\r
+ else\r
+ {\r
+ st=m_db->Prepare("SELECT LocalIdentityID FROM tblLocalIdentity;");\r
+ st.Step();\r
+ if(st.RowReturned())\r
+ {\r
+ st.ResultInt(0,localidentityid);\r
+ StringFunctions::Convert(localidentityid,localidentityidstr);\r
+ }\r
+ st.Finalize();\r
+ }\r
+ }\r
+\r
+ if(localidentityid!=-1 && queryvars.find("formaction")!=queryvars.end() && (*queryvars.find("formaction")).second=="update")\r