5 Admin area for NP_SecurityEnforcer
\r
9 // if your 'plugin' directory is not in the default location,
\r
10 // edit this variable to point to your site directory
\r
11 // (where config.php is)
\r
12 $strRel = '../../../';
\r
14 include($strRel . 'config.php');
\r
15 if (!$member->isAdmin())
\r
16 doError('Insufficient Permissions.');
\r
19 include($DIR_LIBS . 'PLUGINADMIN.php');
\r
22 function SE_unlockLogin($login) {
\r
23 sql_query("DELETE FROM ".sql_table('plug_securityenforcer')." WHERE login='".addslashes($login)."'");
\r
31 // create the admin area page
\r
32 $oPluginAdmin = new PluginAdmin('SecurityEnforcer');
\r
33 // add styles to the <HEAD>
\r
34 $oPluginAdmin->start('');
\r
36 // if form to unlock is posted
\r
37 if(postVar('action') == 'unlock') {
\r
38 if (!$manager->checkTicket())
\r
39 doError('Invalid Ticket');
\r
40 $logins = postVar('unlock');
\r
42 if(is_array($logins)) {
\r
43 foreach ($logins as $entity) {
\r
44 SE_unlockLogin($entity);
\r
45 $message .= '<br />' . $entity . _SECURITYENFORCER_ADMIN_UNLOCKED;
\r
49 $plug =& $oPluginAdmin->plugin;
\r
52 echo '<h2>Security Enforcer Administration</h2>';
\r
55 if($message) { echo "<p><strong>"; echo $message; echo "</strong></p>"; }
\r
57 // generate table from all entries in the database
\r
58 echo '<h3>'._SECURITYENFORCER_LOCKED_ENTITIES.'</h3>';
\r
59 echo '<form action="' . $oPluginAdmin->plugin->getAdminURL() . '" method="POST">';
\r
60 echo '<input type="hidden" name="action" value="unlock" />';
\r
61 $manager->addTicketHidden();
\r
63 echo '<tr><th>'._SECURITYENFORCER_ENTITY.'</th><th>Unlock?</th></tr>';
\r
64 echo '<tr><td colspan="2" class="submit"><input type="submit" value="'._SECURITYENFORCER_UNLOCK.'" /></td></tr>';
\r
65 // do query to get all entries, loop
\r
66 $result = sql_query("SELECT * FROM ".sql_table("plug_securityenforcer")." WHERE fails >= ".$plug->max_failed_login);
\r
67 if(mysql_num_rows($result)) {
\r
68 while($row = mysql_fetch_assoc($result)) {
\r
70 echo '<td>'.htmlspecialchars($row['login']).'</td>';
\r
71 echo '<td><input type="checkbox" name="unlock[]" value="'.htmlspecialchars($row['login']).'" />'._SECURITYENFORCER_UNLOCK.'</td>';
\r
76 echo '<tr><td colspan="2"><strong>'._SECURITYENFORCER_ADMIN_NONE_LOCKED.'</strong></td></tr>';
\r
78 echo '<tr><td colspan="2" class="submit"><input type="submit" value="'._SECURITYENFORCER_UNLOCK.'" /></td></tr>';
\r
82 $oPluginAdmin->end();
\r