--- /dev/null
+<?php\r
+\r
+/*\r
+\r
+Admin area for NP_SecurityEnforcer\r
+\r
+*/\r
+\r
+ // if your 'plugin' directory is not in the default location,\r
+ // edit this variable to point to your site directory\r
+ // (where config.php is)\r
+ $strRel = '../../../';\r
+\r
+ include($strRel . 'config.php');\r
+ if (!$member->isAdmin())\r
+ doError('Insufficient Permissions.');\r
+ \r
+\r
+ include($DIR_LIBS . 'PLUGINADMIN.php');\r
+ // some functions\r
+ \r
+ function SE_unlockLogin($login) {\r
+ sql_query("DELETE FROM ".sql_table('plug_securityenforcer')." WHERE login='".addslashes($login)."'");\r
+ }\r
+ \r
+ \r
+ // checks\r
+ \r
+\r
+ \r
+ // create the admin area page\r
+ $oPluginAdmin = new PluginAdmin('SecurityEnforcer');\r
+ // add styles to the <HEAD>\r
+ $oPluginAdmin->start('');\r
+ \r
+ // if form to unlock is posted\r
+ if(postVar('action') == 'unlock') {\r
+ if (!$manager->checkTicket()) \r
+ doError('Invalid Ticket');\r
+ $logins = postVar('unlock');\r
+ $message = '';\r
+ if(is_array($logins)) {\r
+ foreach ($logins as $entity) {\r
+ SE_unlockLogin($entity);\r
+ $message .= '<br />' . $entity . _SECURITYENFORCER_ADMIN_UNLOCKED;\r
+ }\r
+ }\r
+ } \r
+ $plug =& $oPluginAdmin->plugin;\r
+\r
+ // page title\r
+ echo '<h2>Security Enforcer Administration</h2>';\r
+ \r
+ // error output\r
+ if($message) { echo "<p><strong>"; echo $message; echo "</strong></p>"; }\r
+ \r
+ // generate table from all entries in the database\r
+ echo '<h3>'._SECURITYENFORCER_LOCKED_ENTITIES.'</h3>';\r
+ echo '<form action="' . $oPluginAdmin->plugin->getAdminURL() . '" method="POST">';\r
+ echo '<input type="hidden" name="action" value="unlock" />';\r
+ $manager->addTicketHidden();\r
+ echo '<table>';\r
+ echo '<tr><th>'._SECURITYENFORCER_ENTITY.'</th><th>Unlock?</th></tr>';\r
+ echo '<tr><td colspan="2" class="submit"><input type="submit" value="'._SECURITYENFORCER_UNLOCK.'" /></td></tr>';\r
+ // do query to get all entries, loop\r
+ $result = sql_query("SELECT * FROM ".sql_table("plug_securityenforcer")." WHERE fails >= ".$plug->max_failed_login);\r
+ if(mysql_num_rows($result)) {\r
+ while($row = mysql_fetch_assoc($result)) {\r
+ echo '<tr>';\r
+ echo '<td>'.htmlspecialchars($row['login']).'</td>';\r
+ echo '<td><input type="checkbox" name="unlock[]" value="'.htmlspecialchars($row['login']).'" />'._SECURITYENFORCER_UNLOCK.'</td>';\r
+ echo '</tr>';\r
+ }\r
+ }\r
+ else {\r
+ echo '<tr><td colspan="2"><strong>'._SECURITYENFORCER_ADMIN_NONE_LOCKED.'</strong></td></tr>';\r
+ }\r
+ echo '<tr><td colspan="2" class="submit"><input type="submit" value="'._SECURITYENFORCER_UNLOCK.'" /></td></tr>';\r
+ echo '</table>';\r
+ echo '</form>';\r
+ \r
+ $oPluginAdmin->end();\r
+\r
+?>
\ No newline at end of file