@@ -2259,7 +2259,6 @@ function editInboundTraffic($server_id, $remark, $volume, $days, $editType = nul
22592259 else $ total = ($ leftGB > 0 ) ? $ total + $ extend_volume : $ extend_volume ;
22602260 }
22612261
2262-
22632262 $ dataArr = array ('up ' => $ up ,'down ' => $ down ,'total ' => is_null ($ total ) ? $ row ->total : $ total ,'remark ' => $ row ->remark ,'enable ' => 'true ' ,
22642263 'expiryTime ' => is_null ($ expire_microdate ) ? $ row ->expiryTime : $ expire_microdate , 'listen ' => '' ,'port ' => $ row ->port ,'protocol ' => $ row ->protocol ,'settings ' => $ row ->settings ,
22652264 'streamSettings ' => $ row ->streamSettings , 'sniffing ' => $ row ->sniffing );
@@ -2310,6 +2309,9 @@ function editInboundTraffic($server_id, $remark, $volume, $days, $editType = nul
23102309
23112310 $ response = curl_exec ($ curl );
23122311 curl_close ($ curl );
2312+
2313+ resetIpLog ($ server_id , $ email );
2314+
23132315 unlink ("tempCookie.txt " );
23142316 return $ response = json_decode ($ response );
23152317
@@ -2712,7 +2714,7 @@ function editClientTraffic($server_id, $inbound_id, $remark, $volume, $days, $ed
27122714 $ settings ['clients ' ][$ client_key ]['totalGB ' ] = $ volume ;
27132715 if (!isset ($ settings ['clients ' ][$ client_key ]['subId ' ]) && ($ serverType == "sanaei " || $ serverType == "alireza " )) $ settings ['clients ' ][$ client_key ]['subId ' ] = RandomString (16 );
27142716 }
2715-
2717+
27162718 if ($ days != 0 ){
27172719 $ expiryTime = $ settings ['clients ' ][$ client_key ]['expiryTime ' ];
27182720 $ now_microdate = floor (microtime (true ) * 1000 );
@@ -2804,6 +2806,9 @@ function editClientTraffic($server_id, $inbound_id, $remark, $volume, $days, $ed
28042806 unlink ("tempCookie.txt " );
28052807
28062808 curl_close ($ curl );
2809+
2810+ resetIpLog ($ server_id , $ remark );
2811+
28072812 return $ response = json_decode ($ response );
28082813
28092814}
@@ -2892,6 +2897,67 @@ function deleteInbound($server_id, $remark, $delete = 0){
28922897 }
28932898 return $ oldData ;
28942899
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+
28952961}
28962962function resetClientTraffic ($ server_id , $ remark , $ inboundId = null ){
28972963 global $ connection ;
0 commit comments