@@ -660,7 +660,8 @@ function getServerConfigKeys($serverId,$offset = 0){
660660 ['text ' =>$ ucount ,'callback_data ' =>"editServerMax $ id " ],
661661 ['text ' =>"ظرفیت سرور " ,'callback_data ' =>"wizwizch " ]
662662 ]
663- ],($ serverConfig ['type ' ] != "marzban " ?[
663+ ],
664+ ($ serverConfig ['type ' ] != "marzban " ?[
664665 [
665666 ['text ' =>$ portType ,'callback_data ' =>"changePortType $ id " ],
666667 ['text ' =>"نوعیت پورت " ,'callback_data ' =>"wizwizch " ]
@@ -1360,6 +1361,7 @@ function getPlanDetailsKeys($planId){
13601361 [['text ' =>"✏️ ویرایش توضیحات " ,'callback_data ' =>"wizwizplaneditdes $ id " ]],
13611362 [['text ' =>number_format ($ price ) . " تومان " ,'callback_data ' =>"wizwizplanrial $ id " ],['text ' =>"💰 قیمت پلن " ,'callback_data ' =>"wizwizch " ]],
13621363 [['text ' =>"♻️ دریافت لیست اکانت ها " ,'callback_data ' =>"wizwizplanacclist $ id " ]],
1364+ ($ server_info ['type ' ] == "marzban " ?[['text ' =>"انتخاب Host " ,'callback_data ' =>"marzbanHostSettings " . $ id ]]:[]),
13631365 [['text ' =>"✂️ حذف " ,'callback_data ' =>"wizwizplandelete $ id " ]],
13641366 [['text ' => $ buttonValues ['back_button ' ], 'callback_data ' =>"plansList $ srvid " ]]
13651367 ];
@@ -5216,6 +5218,36 @@ function getMarzbanUser($server_id, $remark, $token = null){
52165218 curl_close ($ curl );
52175219 return $ response ;
52185220}
5221+ function getMarzbanHosts ($ server_id ){
5222+ global $ connection ;
5223+
5224+ $ stmt = $ connection ->prepare ("SELECT * FROM server_config WHERE id=? " );
5225+ $ stmt ->bind_param ("i " , $ server_id );
5226+ $ stmt ->execute ();
5227+ $ server_info = $ stmt ->get_result ()->fetch_assoc ();
5228+ $ stmt ->close ();
5229+
5230+ $ panel_url = $ server_info ['panel_url ' ];
5231+
5232+ $ token = getMarzbanToken ($ server_id );
5233+ if (isset ($ token ->detail )){return (object ) ['success ' =>false , 'msg ' =>$ token ->detail ];}
5234+
5235+ $ panel_url .= '/api/core/config ' ;
5236+
5237+ $ curl = curl_init ();
5238+ curl_setopt ($ curl , CURLOPT_URL , $ panel_url );
5239+ curl_setopt ($ curl , CURLOPT_HTTPGET , true );
5240+ curl_setopt ($ curl , CURLOPT_RETURNTRANSFER , true );
5241+ curl_setopt ($ curl , CURLOPT_HTTPHEADER , array (
5242+ 'Accept: application/json ' ,
5243+ 'Authorization: Bearer ' . $ token ->access_token
5244+ ));
5245+
5246+ $ response = json_decode (curl_exec ($ curl ));
5247+
5248+ curl_close ($ curl );
5249+ return $ response ;
5250+ }
52195251function addMarzbanUser ($ server_id , $ remark , $ volume , $ days , $ plan_id ){
52205252 global $ connection ;
52215253
0 commit comments