version 0.1.0
[fms.git] / admin / identitytrust.php
index 51803f0..8e5aa1e 100644 (file)
@@ -9,10 +9,28 @@ function content()
        global $dblocation;\r
        \r
        $db=new PDO('sqlite:'.$dblocation);\r
+       \r
+       if(isset($_REQUEST['formaction']) && $_REQUEST['formaction']=='updatetrust')\r
+       {\r
+               $st=$db->prepare("UPDATE tblIdentity SET LocalMessageTrust=?, LocalTrustListTrust=? WHERE IdentityID=?;");\r
+               for($i=0; $i<count($_REQUEST['identityid']); $i++)\r
+               {\r
+                       if($_REQUEST['oldlocalmessagetrust'][$i]!=$_REQUEST['newlocalmessagetrust'][$i] || $_REQUEST['oldlocaltrustlisttrust']!=$_REQUEST['newlocaltrustlisttrust'])\r
+                       {\r
+                               $st->bindParam(1,$_REQUEST['newlocalmessagetrust'][$i]);\r
+                               $st->bindParam(2,$_REQUEST['newlocaltrustlisttrust'][$i]);\r
+                               $st->bindParam(3,$_REQUEST['identityid'][$i]);\r
+                               $rval=$st->execute();\r
+                       }\r
+               }\r
+       }\r
+       \r
        $st=$db->prepare("SELECT IdentityID,Name,LocalMessageTrust,PeerMessageTrust,LocalTrustListTrust,PeerTrustListTrust FROM tblIdentity ORDER BY Name;");\r
        $st->execute();\r
        ?>\r
        <h2>Identity Trust</h2>\r
+       <form name="frmtrust" method="post">\r
+       <input type="hidden" name="formaction" value="updatetrust">\r
        <table>\r
                <tr>\r
                        <th>Peer</th>\r
@@ -26,16 +44,31 @@ function content()
                {\r
                ?>\r
                <tr>\r
-                       <td><?php print($record[1]) ?></td>\r
-                       <td><?php print($record[2]) ?></td>\r
+                       <td>\r
+                               <?php print($record[1]) ?>\r
+                               <input type="hidden" name="identityid[]" value="<?php print($record[0]) ?>">\r
+                       </td>\r
+                       <td>\r
+                               <input type="hidden" name="oldlocalmessagetrust[]" value="<?php print($record[2]) ?>">\r
+                               <input type="text" name="newlocalmessagetrust[]" size="2" maxlength="3" value="<?php print($record[2]) ?>">\r
+                       </td>\r
                        <td><?php print($record[3]) ?></td>\r
-                       <td><?php print($record[4]) ?></td>\r
+                       <td>\r
+                               <input type="hidden" name="oldlocaltrustlisttrust[]" value="<?php print($record[4]) ?>">\r
+                               <input type="text" name="newlocaltrustlisttrust[]" size="2" maxlength="3" value="<?php print($record[4]) ?>">\r
+                       </td>\r
                        <td><?php print($record[5]) ?></td>\r
                </tr>\r
                <?php   \r
                }\r
                ?>\r
+               <tr>\r
+                       <td colspan="5">\r
+                               <input type="submit" value="Update Trust">\r
+                       </td>\r
+               </tr>\r
        </table>\r
+       </form>\r
        <?php\r
 }\r
        \r