version 0.1.0
[fms.git] / admin / identitytrust.php
1 <?php\r
2 \r
3         include_once('config.php');\r
4         include_once('linkbar.php');\r
5         \r
6 function content()\r
7 {\r
8         \r
9         global $dblocation;\r
10         \r
11         $db=new PDO('sqlite:'.$dblocation);\r
12         \r
13         if(isset($_REQUEST['formaction']) && $_REQUEST['formaction']=='updatetrust')\r
14         {\r
15                 $st=$db->prepare("UPDATE tblIdentity SET LocalMessageTrust=?, LocalTrustListTrust=? WHERE IdentityID=?;");\r
16                 for($i=0; $i<count($_REQUEST['identityid']); $i++)\r
17                 {\r
18                         if($_REQUEST['oldlocalmessagetrust'][$i]!=$_REQUEST['newlocalmessagetrust'][$i] || $_REQUEST['oldlocaltrustlisttrust']!=$_REQUEST['newlocaltrustlisttrust'])\r
19                         {\r
20                                 $st->bindParam(1,$_REQUEST['newlocalmessagetrust'][$i]);\r
21                                 $st->bindParam(2,$_REQUEST['newlocaltrustlisttrust'][$i]);\r
22                                 $st->bindParam(3,$_REQUEST['identityid'][$i]);\r
23                                 $rval=$st->execute();\r
24                         }\r
25                 }\r
26         }\r
27         \r
28         $st=$db->prepare("SELECT IdentityID,Name,LocalMessageTrust,PeerMessageTrust,LocalTrustListTrust,PeerTrustListTrust FROM tblIdentity ORDER BY Name;");\r
29         $st->execute();\r
30         ?>\r
31         <h2>Identity Trust</h2>\r
32         <form name="frmtrust" method="post">\r
33         <input type="hidden" name="formaction" value="updatetrust">\r
34         <table>\r
35                 <tr>\r
36                         <th>Peer</th>\r
37                         <th>Local Message Trust</th>\r
38                         <th>Peer Message Trust</th>\r
39                         <th>Local Trust List Trust</th>\r
40                         <th>Peer Trust List Trust</th>\r
41                 </tr>\r
42                 <?php\r
43                 while($record=$st->fetch())\r
44                 {\r
45                 ?>\r
46                 <tr>\r
47                         <td>\r
48                                 <?php print($record[1]) ?>\r
49                                 <input type="hidden" name="identityid[]" value="<?php print($record[0]) ?>">\r
50                         </td>\r
51                         <td>\r
52                                 <input type="hidden" name="oldlocalmessagetrust[]" value="<?php print($record[2]) ?>">\r
53                                 <input type="text" name="newlocalmessagetrust[]" size="2" maxlength="3" value="<?php print($record[2]) ?>">\r
54                         </td>\r
55                         <td><?php print($record[3]) ?></td>\r
56                         <td>\r
57                                 <input type="hidden" name="oldlocaltrustlisttrust[]" value="<?php print($record[4]) ?>">\r
58                                 <input type="text" name="newlocaltrustlisttrust[]" size="2" maxlength="3" value="<?php print($record[4]) ?>">\r
59                         </td>\r
60                         <td><?php print($record[5]) ?></td>\r
61                 </tr>\r
62                 <?php   \r
63                 }\r
64                 ?>\r
65                 <tr>\r
66                         <td colspan="5">\r
67                                 <input type="submit" value="Update Trust">\r
68                         </td>\r
69                 </tr>\r
70         </table>\r
71         </form>\r
72         <?php\r
73 }\r
74         \r
75         include_once('template.php');\r
76 \r
77 ?>