walkor 11 năm trước cách đây
mục cha
commit
4c4fd00612

+ 10 - 8
applications/Statistics/Modules/admin.php

@@ -5,6 +5,7 @@ use Statistics\Lib\Cache;
 function admin()
 {
     $act = isset($_GET['act'])? $_GET['act'] : 'home';
+    $ip_list_str = '';
     switch($act)
     {
         case 'detect_server':
@@ -30,17 +31,18 @@ function admin()
                     $ip_list[$host] = $host;
                 }
             }
+            // 过滤掉已经保存的ip
+            foreach($ip_list as $ip)
+            {
+                if(!isset(Cache::$ServerIpList[$ip]))
+                {
+                    $ip_list_str .= $ip."\r\n";
+                }
+            }
+            
             break;
     }
     
-    $ip_list_str = '';
-    foreach($ip_list as $ip)
-    {
-        if(!isset(Cache::$ServerIpList[$ip]))
-        {
-            $ip_list_str .= $ip."\r\n"; 
-        }
-    }
     
     include ST_ROOT . '/Views/header.tpl.php';
     include ST_ROOT . '/Views/admin.tpl.php';

+ 5 - 0
applications/Statistics/Views/admin.tpl.php

@@ -31,6 +31,11 @@
 			<textarea rows="100" cols="30">
 			<?php echo $ip_list_str;?>
 			</textarea>
+			<div class="form-group">
+				<div class="col-sm-offset-2 col-sm-10">
+					 <button type="submit" class="btn btn-default">保存</button>
+				</div>
+			</div>
 			</form>
 		</div>
 	</div>