@@ -2259,7 +2259,6 @@ function editInboundTraffic($server_id, $remark, $volume, $days, $editType = nul
2259
2259
else $ total = ($ leftGB > 0 ) ? $ total + $ extend_volume : $ extend_volume ;
2260
2260
}
2261
2261
2262
-
2263
2262
$ dataArr = array ('up ' => $ up ,'down ' => $ down ,'total ' => is_null ($ total ) ? $ row ->total : $ total ,'remark ' => $ row ->remark ,'enable ' => 'true ' ,
2264
2263
'expiryTime ' => is_null ($ expire_microdate ) ? $ row ->expiryTime : $ expire_microdate , 'listen ' => '' ,'port ' => $ row ->port ,'protocol ' => $ row ->protocol ,'settings ' => $ row ->settings ,
2265
2264
'streamSettings ' => $ row ->streamSettings , 'sniffing ' => $ row ->sniffing );
@@ -2310,6 +2309,9 @@ function editInboundTraffic($server_id, $remark, $volume, $days, $editType = nul
2310
2309
2311
2310
$ response = curl_exec ($ curl );
2312
2311
curl_close ($ curl );
2312
+
2313
+ resetIpLog ($ server_id , $ email );
2314
+
2313
2315
unlink ("tempCookie.txt " );
2314
2316
return $ response = json_decode ($ response );
2315
2317
@@ -2712,7 +2714,7 @@ function editClientTraffic($server_id, $inbound_id, $remark, $volume, $days, $ed
2712
2714
$ settings ['clients ' ][$ client_key ]['totalGB ' ] = $ volume ;
2713
2715
if (!isset ($ settings ['clients ' ][$ client_key ]['subId ' ]) && ($ serverType == "sanaei " || $ serverType == "alireza " )) $ settings ['clients ' ][$ client_key ]['subId ' ] = RandomString (16 );
2714
2716
}
2715
-
2717
+
2716
2718
if ($ days != 0 ){
2717
2719
$ expiryTime = $ settings ['clients ' ][$ client_key ]['expiryTime ' ];
2718
2720
$ now_microdate = floor (microtime (true ) * 1000 );
@@ -2804,6 +2806,9 @@ function editClientTraffic($server_id, $inbound_id, $remark, $volume, $days, $ed
2804
2806
unlink ("tempCookie.txt " );
2805
2807
2806
2808
curl_close ($ curl );
2809
+
2810
+ resetIpLog ($ server_id , $ remark );
2811
+
2807
2812
return $ response = json_decode ($ response );
2808
2813
2809
2814
}
@@ -2892,6 +2897,67 @@ function deleteInbound($server_id, $remark, $delete = 0){
2892
2897
}
2893
2898
return $ oldData ;
2894
2899
2900
+ }
2901
+ function resetIpLog ($ server_id , $ remark ){
2902
+ global $ connection ;
2903
+ $ stmt = $ connection ->prepare ("SELECT * FROM server_config WHERE id=? " );
2904
+ $ stmt ->bind_param ("i " , $ server_id );
2905
+ $ stmt ->execute ();
2906
+ $ server_info = $ stmt ->get_result ()->fetch_assoc ();
2907
+ $ stmt ->close ();
2908
+ $ panel_url = $ server_info ['panel_url ' ];
2909
+ $ cookie = 'Cookie: session= ' .$ server_info ['cookie ' ];
2910
+ $ serverType = $ server_info ['type ' ];
2911
+
2912
+
2913
+ $ serverName = $ server_info ['username ' ];
2914
+ $ serverPass = $ server_info ['password ' ];
2915
+
2916
+ $ loginUrl = $ panel_url . '/login ' ;
2917
+
2918
+ $ postFields = array (
2919
+ "username " => $ serverName ,
2920
+ "password " => $ serverPass
2921
+ );
2922
+
2923
+ $ curl = curl_init ();
2924
+ curl_setopt ($ curl , CURLOPT_URL , $ loginUrl );
2925
+ curl_setopt ($ curl , CURLOPT_FOLLOWLOCATION , 1 );
2926
+ curl_setopt ($ curl , CURLOPT_RETURNTRANSFER , 1 );
2927
+ curl_setopt ($ curl , CURLOPT_POST , 1 );
2928
+ curl_setopt ($ curl , CURLOPT_CONNECTTIMEOUT , 3 );
2929
+ curl_setopt ($ curl , CURLOPT_TIMEOUT , 3 );
2930
+ curl_setopt ($ curl , CURLOPT_POSTFIELDS , http_build_query ($ postFields ));
2931
+ curl_setopt ($ curl , CURLOPT_COOKIEJAR , dirname (__FILE__ ) . '/tempCookie.txt ' );
2932
+ $ loginResponse = json_decode (curl_exec ($ curl ),true );
2933
+ if (!$ loginResponse ['success ' ]){
2934
+ curl_close ($ curl );
2935
+ return $ loginResponse ;
2936
+ }
2937
+ $ phost = str_ireplace ('https:// ' ,'' ,str_ireplace ('http:// ' ,'' ,$ panel_url ));
2938
+
2939
+ if ($ serverType == "sanaei " ) $ url = $ panel_url . "/panel/inbound/clearClientIps/ " . urlencode ($ remark );
2940
+ else $ url = $ panel_url . "/xui/inbound/clearClientIps/ " . urlencode ($ remark );
2941
+
2942
+ curl_setopt_array ($ curl , array (
2943
+ CURLOPT_URL => $ url ,
2944
+ CURLOPT_RETURNTRANSFER => true ,
2945
+ CURLOPT_ENCODING => '' ,
2946
+ CURLOPT_MAXREDIRS => 10 ,
2947
+ CURLOPT_CONNECTTIMEOUT => 15 ,
2948
+ CURLOPT_TIMEOUT => 15 ,
2949
+ CURLOPT_FOLLOWLOCATION => true ,
2950
+ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1 ,
2951
+ CURLOPT_CUSTOMREQUEST => 'POST ' ,
2952
+ CURLOPT_COOKIEJAR => dirname (__FILE__ ) . '/tempCookie.txt ' ,
2953
+ ));
2954
+
2955
+ $ response = curl_exec ($ curl );
2956
+ unlink ("tempCookie.txt " );
2957
+
2958
+ curl_close ($ curl );
2959
+ return $ response = json_decode ($ response );
2960
+
2895
2961
}
2896
2962
function resetClientTraffic ($ server_id , $ remark , $ inboundId = null ){
2897
2963
global $ connection ;
0 commit comments