@@ -164,12 +164,14 @@ public function showusers($req, $res, $args)
164164 {
165165 Container::get ('hooks ' )->fire ('controller.admin.users.showusers ' );
166166
167- if (!@preg_match ('%^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$% ' , $ args ['ip ' ]) && !@preg_match ('%^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$% ' , $ args ['ip ' ])) {
167+ $ search_ip = Input::query ('ip ' );
168+
169+ if (!@preg_match ('%^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$% ' , $ search_ip ) && !@preg_match ('%^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$% ' , $ search_ip )) {
168170 throw new Error (__ ('Bad IP message ' ), 400 );
169171 }
170172
171173 // Fetch user count
172- $ num_users = $ this ->model ->get_num_users_ip ($ args [ ' ip ' ] );
174+ $ num_users = $ this ->model ->get_num_users_ip ($ search_ip );
173175
174176 // Determine the user offset (based on $_GET['p'])
175177 $ num_pages = ceil ($ num_users / 50 );
@@ -181,10 +183,10 @@ public function showusers($req, $res, $args)
181183 'title ' => array (Utils::escape (ForumSettings::get ('o_board_title ' )), __ ('Admin ' ), __ ('Users ' ), __ ('Results head ' )),
182184 'active_page ' => 'admin ' ,
183185 'admin_console ' => true ,
184- 'paging_links ' => '<span class="pages-label"> ' .__ ('Pages ' ).' </span> ' .Url::paginate_old ($ num_pages , $ p , '?ip_stats= ' .$ args [ ' ip ' ] ),
186+ 'paging_links ' => '<span class="pages-label"> ' .__ ('Pages ' ).' </span> ' .Url::paginate_old ($ num_pages , $ p , '?ip_stats= ' .$ search_ip ),
185187 'page ' => $ p ,
186188 'start_from ' => $ start_from ,
187- 'info ' => $ this ->model ->get_info_poster ($ args [ ' ip ' ] , $ start_from ),
189+ 'info ' => $ this ->model ->get_info_poster ($ search_ip , $ start_from ),
188190 )
189191 )->addTemplate ('admin/users/show_users.php ' )->display ();
190192 }
0 commit comments