|
6 | 6 | sendMessage($mainValues['banned']); |
7 | 7 | exit(); |
8 | 8 | } |
| 9 | +$checkSpam = checkSpam(); |
| 10 | +if(is_numeric($checkSpam)){ |
| 11 | + $time = jdate("Y-m-d H:i:s", $checkSpam); |
| 12 | + sendMessage("اکانت شما به دلیل اسپم مسدود شده است\nزمان آزادسازی اکانت شما: \n$time"); |
| 13 | + exit(); |
| 14 | +} |
| 15 | + |
9 | 16 | if(preg_match("/^haveJoined(.*)/",$data,$match)){ |
10 | 17 | if ($joniedState== "kicked" || $joniedState== "left"){ |
11 | 18 | alert($mainValues['not_joine_yet']); |
|
64 | 71 | $text = "/start"; |
65 | 72 | } |
66 | 73 | if($data == "agentsList" && ($from_id == $admin || $userInfo['isAdmin'] == true)){ |
67 | | - editText($message_id,$mainValues['agents_list'], getAgentsList()); |
| 74 | + $keys = getAgentsList(); |
| 75 | + if($keys != null) editText($message_id,$mainValues['agents_list'], $keys); |
| 76 | + else alert("نماینده ای یافت نشد"); |
68 | 77 | } |
69 | 78 | if(preg_match('/^agentDetails(\d+)/',$data,$match) && ($from_id == $admin || $userInfo['isAdmin'] == true)){ |
70 | 79 | $userDetail = bot('getChat',['chat_id'=>$match[1]])->result; |
|
80 | 89 | $stmt->close(); |
81 | 90 |
|
82 | 91 | alert($mainValues['agent_deleted_successfuly']); |
83 | | - editKeys(getAgentsList()); |
| 92 | + $keys = getAgentsList(); |
| 93 | + if($keys != null) editKeys($keys); |
| 94 | + else editKeys(json_encode(['inline_keyboard'=>[[['text'=>$buttonValues['back_button'],'callback_data'=>"managePanel"]]]])); |
84 | 95 | } |
85 | 96 | if(preg_match('/^editAgentDiscount(\d+)/',$data,$match) && ($from_id == $admin || $userInfo['isAdmin'] == true)){ |
86 | 97 | delMessage(); |
|
226 | 237 | } |
227 | 238 | editText($message_id,$mainValues['change_bot_settings_message'],getBotSettingKeys()); |
228 | 239 | } |
| 240 | +if($data=="changeUpdateConfigLinkState" && ($from_id == $admin || $userInfo['isAdmin'] == true)){ |
| 241 | + $newValue = $botState['updateConnectionState']=="robot"?"site":"robot"; |
| 242 | + $botState['updateConnectionState']= $newValue; |
| 243 | + |
| 244 | + $stmt = $connection->prepare("SELECT * FROM `setting` WHERE `type` = 'BOT_STATES'"); |
| 245 | + $stmt->execute(); |
| 246 | + $isExists = $stmt->get_result(); |
| 247 | + $stmt->close(); |
| 248 | + if($isExists->num_rows>0) $query = "UPDATE `setting` SET `value` = ? WHERE `type` = 'BOT_STATES'"; |
| 249 | + else $query = "INSERT INTO `setting` (`type`, `value`) VALUES ('BOT_STATES', ?)"; |
| 250 | + $newData = json_encode($botState); |
| 251 | + |
| 252 | + $stmt = $connection->prepare($query); |
| 253 | + $stmt->bind_param("s", $newData); |
| 254 | + $stmt->execute(); |
| 255 | + $stmt->close(); |
| 256 | + |
| 257 | + editText($message_id,$mainValues['change_bot_settings_message'],getBotSettingKeys()); |
| 258 | +} |
229 | 259 | if(($data=="gateWays_Channels" or preg_match("/^changeGateWays(\w+)/",$data,$match)) && ($from_id == $admin || $userInfo['isAdmin'] == true)){ |
230 | 260 | if($data!="gateWays_Channels"){ |
231 | 261 | $newValue = $botState[$match[1]]=="on"?"off":"on"; |
|
499 | 529 | $stmt->execute(); |
500 | 530 | $inviteText = $stmt->get_result()->fetch_assoc()['value']; |
501 | 531 | if($inviteText != null){ |
| 532 | + delMessage(); |
502 | 533 | $inviteText = json_decode($inviteText,true); |
503 | 534 |
|
504 | 535 | $stmt = $connection->prepare("SELECT * FROM `setting` WHERE `type` = 'INVITE_BANNER_AMOUNT'"); |
|
519 | 550 | $res = sendPhoto($inviteText['file_id'],$txt,null,"HTML"); |
520 | 551 | } |
521 | 552 | $msgId = $res->result->message_id; |
522 | | - sendMessage("با لینک بالا دوستاتو به ربات دعوت کن و با هر خرید $inviteAmount بدست بیار",null,null,null,$msgId); |
| 553 | + sendMessage("با لینک بالا دوستاتو به ربات دعوت کن و با هر خرید $inviteAmount بدست بیار",json_encode(['inline_keyboard'=>[[['text'=>$buttonValues['back_to_main'],'callback_data'=>"mainMenu"]]]]),null,null,$msgId); |
523 | 554 | } |
524 | 555 | else alert("این قسمت غیر فعال است"); |
525 | 556 | } |
|
1501 | 1532 | ]]); |
1502 | 1533 |
|
1503 | 1534 | $msg = str_replace(['TYPE', 'USER-ID', 'USERNAME', 'NAME', 'PRICE', 'REMARK', 'VOLUME', 'DAYS'], |
1504 | | - ['ارزی ریالی', $from_id, $username, $first_name, $price, $remark,$volume, $days], $mainValues['buy_custom_account_request']); |
| 1535 | + ['ارزی ریالی', $from_id, $username, $first_name, $price, $remark,$volume, $days], $mainValues['buy_new_account_request']); |
1505 | 1536 |
|
1506 | 1537 | sendMessage($msg,$keys,"html", $admin); |
1507 | 1538 | } |
|
1539 | 1570 | exit; |
1540 | 1571 | } |
1541 | 1572 | $stmt = $connection->prepare("UPDATE `orders_list` SET `expire_date` = ?, `notif` = 0 WHERE `id` = ?"); |
1542 | | - $newExpire = $expire_date + $days * 86400; |
| 1573 | + $newExpire = $time + $days * 86400; |
1543 | 1574 | $stmt->bind_param("ii", $newExpire, $oid); |
1544 | 1575 | $stmt->execute(); |
1545 | 1576 | $stmt->close(); |
|
1815 | 1846 |
|
1816 | 1847 | editText($message_id,'⏳ کم کم برا همه ارسال میشه ... ',getMainKeys()); |
1817 | 1848 | } |
| 1849 | +if($data=="forwardToAll" && ($from_id == $admin || $userInfo['isAdmin'] == true)){ |
| 1850 | + $sendInfo = json_decode(file_get_contents("settings/messagewizwiz.json"),true); |
| 1851 | + $offset = $sendInfo['offset']; |
| 1852 | + |
| 1853 | + if($offset != -1) { |
| 1854 | + $stmt = $connection->prepare("SELECT * FROM `users`"); |
| 1855 | + $stmt->execute(); |
| 1856 | + $usersCount = $stmt->get_result()->num_rows; |
| 1857 | + $stmt->close(); |
| 1858 | + |
| 1859 | + $leftMessages = $offset == 0 ? $usersCount - $offset : $usersCount - $offset; |
| 1860 | + $offset = $offset == 0 ? $offset : $offset; |
| 1861 | + sendMessage(" |
| 1862 | +❗️ یک فروارد همگانی در صف انتشار می باشد لطفا صبور باشید ... |
| 1863 | +
|
| 1864 | +🔰 تعداد کاربران : $usersCount |
| 1865 | +☑️ فروارد شده : $offset |
| 1866 | +📣 باقیمانده : $leftMessages |
| 1867 | + |
| 1868 | +");exit; |
| 1869 | + } |
| 1870 | + |
| 1871 | + delMessage(); |
| 1872 | + sendMessage($mainValues['forward_your_message'], $cancelKey); |
| 1873 | + setUser($data); |
| 1874 | +} |
| 1875 | +if($userInfo['step'] == "forwardToAll" && ($from_id == $admin || $userInfo['isAdmin'] == true) && $text != $buttonValues['cancel']){ |
| 1876 | + $messageValue = json_encode(['type'=>'forwardall','message_id'=> $message_id, 'chat_id'=>$chat_id]); |
| 1877 | + |
| 1878 | + $sendInfo = json_decode(file_get_contents("settings/messagewizwiz.json"),true); |
| 1879 | + $sendInfo['text'] = $messageValue; |
| 1880 | + file_put_contents("settings/messagewizwiz.json",json_encode($sendInfo)); |
| 1881 | + |
| 1882 | + setUser(); |
| 1883 | + sendMessage('⏳ مرسی از پیامت ... ',$removeKeyboard); |
| 1884 | + sendMessage("برای همه فروارد کنم؟",json_encode(['inline_keyboard'=>[ |
| 1885 | + [['text'=>"بفرست",'callback_data'=>"yesSend2All"],['text'=>"نه نفرست",'callback_data'=>"noDontSend2all"]] |
| 1886 | + ]])); |
| 1887 | +} |
1818 | 1888 | if(preg_match('/selectServer(\d+)/',$data, $match) && ($botState['sellState']=="on" || ($from_id == $admin || $userInfo['isAdmin'] == true)) ) { |
1819 | 1889 | $sid = $match[1]; |
1820 | 1890 |
|
|
1911 | 1981 | sendMessage("😡|لطفا فقط عدد ارسال کن"); |
1912 | 1982 | exit(); |
1913 | 1983 | } |
1914 | | - elseif($text <=0){ |
| 1984 | + elseif($text <1){ |
1915 | 1985 | sendMessage("لطفا عددی بزرگتر از 0 وارد کن"); |
1916 | 1986 | exit(); |
1917 | 1987 | } |
| 1988 | + elseif(strpos($text,".")!==FALSE){ |
| 1989 | + sendMessage(" عدد اعشاری مجاز نیست"); |
| 1990 | + exit(); |
| 1991 | + } |
1918 | 1992 | $id = $match[1]; |
1919 | 1993 | $price = $botState['dayPrice']; |
1920 | 1994 | if($userInfo['temp'] == "agentBuy" && $userInfo['is_agent'] == true) $price -= ($price * $userInfo['discount_percent'] / 100); |
|
1927 | 2001 | sendMessage("😡|لطفا فقط عدد ارسال کن"); |
1928 | 2002 | exit(); |
1929 | 2003 | } |
1930 | | - elseif($text <=0){ |
| 2004 | + elseif($text <1){ |
1931 | 2005 | sendMessage("لطفا عددی بزرگتر از 0 وارد کن"); |
1932 | 2006 | exit(); |
1933 | 2007 | } |
1934 | | - |
| 2008 | + elseif(strpos($text,".")!==FALSE){ |
| 2009 | + sendMessage("عدد اعشاری مجاز نیست"); |
| 2010 | + exit(); |
| 2011 | + } |
1935 | 2012 | sendMessage($mainValues['customer_custome_plan_name']); |
1936 | 2013 | setUser("enterCustomPlanName" . $match[1] . "_" . $match[2] . "_" . $match[3] . "_" . $text); |
1937 | 2014 | } |
|
2216 | 2293 | }else{ |
2217 | 2294 | if($userInfo['temp'] == "agentMuchBuy"){ |
2218 | 2295 | setUser($data); |
2219 | | - sendMessage($mainValues['enter_account_amount']); |
| 2296 | + sendMessage($mainValues['enter_account_amount'], $cancelKey); |
2220 | 2297 | exit(); |
2221 | 2298 | } |
2222 | 2299 | } |
|
3100 | 3177 | if($payInfo['type'] == "RENEW_SCONFIG"){$msg = str_replace(['TYPE', 'USER-ID', 'USERNAME', 'NAME', 'PRICE', 'REMARK', 'VOLUME', 'DAYS'], |
3101 | 3178 | ['کیف پول', $from_id, $username, $first_name, $price, $remark,$volume, $days], $mainValues['renew_account_request_message']);} |
3102 | 3179 | else{$msg = str_replace(['TYPE', 'USER-ID', 'USERNAME', 'NAME', 'PRICE', 'REMARK', 'VOLUME', 'DAYS'], |
3103 | | - ['کیف پول', $from_id, $username, $first_name, $price, $remark,$volume, $days], $mainValues['buy_custom_account_request']);} |
| 3180 | + ['کیف پول', $from_id, $username, $first_name, $price, $remark,$volume, $days], $mainValues['buy_new_account_request']);} |
3104 | 3181 |
|
3105 | 3182 | sendMessage($msg,$keys,"html", $admin); |
3106 | 3183 | } |
|
4708 | 4785 | if(preg_match('/freeTrial(\d+)/',$data,$match)) { |
4709 | 4786 | $id = $match[1]; |
4710 | 4787 |
|
4711 | | - if($userInfo['freetrial'] == 'used' and !($from_id == $admin)){ |
| 4788 | + if($userInfo['freetrial'] == 'used' and !($from_id == $admin) && $userInfo['discount_percent'] != "100"){ |
4712 | 4789 | alert('⚠️شما قبلا هدیه رایگان خود را دریافت کردید'); |
4713 | 4790 | exit; |
4714 | 4791 | } |
|
4737 | 4814 | $customPort = $file_detail['custom_port']; |
4738 | 4815 | $customSni = $file_detail['custom_sni']; |
4739 | 4816 |
|
| 4817 | + $agentBought = false; |
| 4818 | + if($userInfo['temp'] == "agentBuy" || $userInfo['temp'] == "agentMuchBuy"){ |
| 4819 | + $agentBought = true; |
| 4820 | + $price -= ($price * $userInfo['discount_percent'] / 100); |
| 4821 | + } |
| 4822 | + |
4740 | 4823 | if($acount == 0 and $inbound_id != 0){ |
4741 | 4824 | alert($mainValues['out_of_connection_capacity']); |
4742 | 4825 | exit; |
|
4852 | 4935 |
|
4853 | 4936 | $vray_link = json_encode($vraylink); |
4854 | 4937 | $stmt = $connection->prepare("INSERT INTO `orders_list` |
4855 | | - (`userid`, `token`, `transid`, `fileid`, `server_id`, `inbound_id`, `remark`, `protocol`, `expire_date`, `link`, `amount`, `status`, `date`, `notif`, `rahgozar`) |
4856 | | - VALUES (?, ?, '', ?, ?, ?, ?, ?, ?, ?, ?,1, ?, 0, ?);"); |
| 4938 | + (`userid`, `token`, `transid`, `fileid`, `server_id`, `inbound_id`, `remark`, `protocol`, `expire_date`, `link`, `amount`, `status`, `date`, `notif`, `rahgozar`, `agent_bought`) |
| 4939 | + VALUES (?, ?, '', ?, ?, ?, ?, ?, ?, ?, ?,1, ?, 0, ?, ?);"); |
4857 | 4940 |
|
4858 | | - $stmt->bind_param("isiiissisiii", $from_id, $token, $id, $server_id, $inbound_id, $remark, $protocol, $expire_date, $vray_link, $price, $date, $rahgozar); |
| 4941 | + $stmt->bind_param("isiiissisiiii", $from_id, $token, $id, $server_id, $inbound_id, $remark, $protocol, $expire_date, $vray_link, $price, $date, $rahgozar, $agentBought); |
4859 | 4942 | $stmt->execute(); |
4860 | 4943 | $order = $stmt->get_result(); |
4861 | 4944 | $stmt->close(); |
|
5515 | 5598 | exit(); |
5516 | 5599 | } |
5517 | 5600 |
|
5518 | | - $stmt = $connection->prepare("UPDATE `server_plans` SET `inbound_id`=?,`step`=64 WHERE `active`=0"); |
5519 | | - $stmt->bind_param("i", $text); |
| 5601 | + $stmt = $connection->prepare("SELECT * FROM `server_plans` WHERE `active` = 0"); |
| 5602 | + $stmt->execute(); |
| 5603 | + $res = $stmt->get_result()->fetch_assoc(); |
| 5604 | + $stmt->close(); |
| 5605 | + |
| 5606 | + |
| 5607 | + $response = getJson($res['server_id'])->obj; |
| 5608 | + foreach($response as $row){ |
| 5609 | + if($row->id == $text) { |
| 5610 | + $netType = json_decode($row->streamSettings)->network; |
| 5611 | + } |
| 5612 | + } |
| 5613 | + if(is_null($netType)){ |
| 5614 | + sendMessage("کانفیگی با این سطر آیدی یافت نشد"); |
| 5615 | + exit(); |
| 5616 | + } |
| 5617 | + |
| 5618 | + $stmt = $connection->prepare("UPDATE `server_plans` SET `type` = ?, `inbound_id`=?,`step`=64 WHERE `active`=0"); |
| 5619 | + $stmt->bind_param("si", $netType, $text); |
5520 | 5620 | $stmt->execute(); |
5521 | 5621 | $stmt->close(); |
5522 | 5622 |
|
|
6242 | 6342 | if($inboundId == 0){ |
6243 | 6343 | foreach($response as $row){ |
6244 | 6344 | if($row->remark == $remark) { |
| 6345 | + $inboundRemark = $row->remark; |
| 6346 | + $iId = $row->id; |
6245 | 6347 | $port = $row->port; |
6246 | 6348 | $protocol = $row->protocol; |
6247 | 6349 | $netType = json_decode($row->streamSettings)->network; |
|
6254 | 6356 | }else{ |
6255 | 6357 | foreach($response as $row){ |
6256 | 6358 | if($row->id == $inboundId) { |
| 6359 | + $iId = $row->id; |
| 6360 | + $inboundRemark = $row->remark; |
6257 | 6361 | $port = $row->port; |
6258 | 6362 | $protocol = $row->protocol; |
6259 | 6363 | $netType = json_decode($row->streamSettings)->network; |
|
6270 | 6374 | } |
6271 | 6375 | } |
6272 | 6376 |
|
6273 | | - |
| 6377 | + if($botState['updateConnectionState'] == "robot"){ |
| 6378 | + $stmt = $connection->prepare("SELECT * FROM `server_config` WHERE `id`=?"); |
| 6379 | + $stmt->bind_param("i", $file_id); |
| 6380 | + $stmt->execute(); |
| 6381 | + $server_config = $stmt->get_result()->fetch_assoc(); |
| 6382 | + |
| 6383 | + $netType = $file_detail['type']; |
| 6384 | + $protocol = $file_detail['protocol']; |
| 6385 | + $security = $server_config['security']; |
| 6386 | + |
| 6387 | + // editInbound($server_id, $uuid, $inboundRemark, $protocol, $netType, $security, $rahgozar); |
| 6388 | + updateConfig($server_id, $iId, $protocol, $netType, $security, $rahgozar); |
| 6389 | + } |
6274 | 6390 | $vraylink = getConnectionLink($server_id, $uuid, $protocol, $remark, $port, $netType, $inboundId, $rahgozar, $customPath, $customPort, $customSni); |
6275 | 6391 |
|
6276 | 6392 | $vray_link = json_encode($vraylink); |
|
6346 | 6462 | $keys = getOrderDetailKeys($from_id, $oid); |
6347 | 6463 | editText($message_id, $keys['msg'], $keys['keyboard'],"HTML"); |
6348 | 6464 | } |
| 6465 | + |
6349 | 6466 | if(preg_match('/changeAccProtocol(\d+)_(\d+)_(.*)/', $data,$match)){ |
6350 | 6467 | $fid = $match[1]; |
6351 | 6468 | $oid = $match[2]; |
|
6680 | 6797 | exit; |
6681 | 6798 | } |
6682 | 6799 | $stmt = $connection->prepare("UPDATE `orders_list` SET `expire_date` = ?, `notif` = 0 WHERE `id` = ?"); |
6683 | | - $newExpire = $expire_date + $days * 86400; |
| 6800 | + $newExpire = $time + $days * 86400; |
6684 | 6801 | $stmt->bind_param("ii", $newExpire, $oid); |
6685 | 6802 | $stmt->execute(); |
6686 | 6803 | $stmt->close(); |
|
6782 | 6899 | exit; |
6783 | 6900 | } |
6784 | 6901 | $stmt = $connection->prepare("UPDATE `orders_list` SET `expire_date` = ?, `notif` = 0 WHERE `id` = ?"); |
6785 | | - $newExpire = $expire_date + $days * 86400; |
| 6902 | + $newExpire = $time + $days * 86400; |
6786 | 6903 | $stmt->bind_param("ii", $newExpire, $oid); |
6787 | 6904 | $stmt->execute(); |
6788 | 6905 | $stmt->close(); |
|
8169 | 8286 | if(preg_match('/^addServerPanePassword(.*)/',$userInfo['step'],$match) and $text != $buttonValues['cancel']){ |
8170 | 8287 | sendMessage("⏳ در حال ورود به اکانت ..."); |
8171 | 8288 | $data = json_decode($match[1],true); |
8172 | | - |
8173 | 8289 | $title = $data['title']; |
8174 | 8290 | $ucount = $data['ucount']; |
8175 | 8291 | $remark = $data['remark']; |
|
8190 | 8306 | "username" => $serverName, |
8191 | 8307 | "password" => $serverPass |
8192 | 8308 | ); |
8193 | | - |
8194 | 8309 | $ch = curl_init(); |
8195 | 8310 | curl_setopt($ch, CURLOPT_URL, $loginUrl); |
8196 | 8311 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); |
|
8224 | 8339 | $rowId = $stmt->insert_id; |
8225 | 8340 | $stmt->close(); |
8226 | 8341 |
|
8227 | | - |
8228 | 8342 | $stmt = $connection->prepare("INSERT INTO `server_config` (`id`, `panel_url`, `ip`, `sni`, `header_type`, `request_header`, `response_header`, `security`, `tlsSettings`, `username`, `password`) |
8229 | 8343 | VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); |
8230 | 8344 | $stmt->bind_param("issssssssss", $rowId, $panel_url, $ip, $sni, $header_type, $request_header, $response_header, $security, $tlsSettings, $serverName, $serverPass); |
|
0 commit comments