Ejemplo n.º 1
0
 /**
  * @throws SystemLogIDMissingException
  */
 public static function ip_info()
 {
     if ($_GET['id']) {
         $ip = $_GET['id'];
         $successful_logins = SystemLog::count_ip_successful_logins($ip);
         $failed_logins = SystemLog::count_ip_failed_logins($ip);
         $template = new HTMLTemplate("base/admin/system_log/ip_info.html");
         $template->set_var("ip", $ip);
         if ($successful_logins) {
             $template->set_var("successful_logins", $successful_logins);
         } else {
             $template->set_var("successful_logins", 0);
         }
         if ($failed_logins) {
             $template->set_var("failed_logins", $failed_logins);
         } else {
             $template->set_var("failed_logins", 0);
         }
         $user_array = SystemLog::list_ip_users($ip);
         $user_content_array = array();
         $counter = 0;
         if (is_array($user_array) and count($user_array) >= 1) {
             foreach ($user_array as $key => $value) {
                 $user = new User($value);
                 $user_content_array[$counter]['username'] = $user->get_username();
                 $user_content_array[$counter]['fullname'] = $user->get_full_name(false);
                 $counter++;
             }
             $template->set_var("no_user", false);
         } else {
             $template->set_var("no_user", true);
         }
         $template->set_var("user", $user_content_array);
         $template->output();
     } else {
         throw new SystemLogIDMissingException();
     }
 }