Skip to content

Commit 3e1c1a7

Browse files
authored
Update bot.php
1 parent c524de2 commit 3e1c1a7

File tree

1 file changed

+36
-42
lines changed

1 file changed

+36
-42
lines changed

bot.php

Lines changed: 36 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -114,17 +114,7 @@
114114
}
115115
if(preg_match('/^\/([Ss]tart)/', $text) or $text == $buttonValues['back_to_main'] or $data == 'mainMenu') {
116116
setUser();
117-
setUser("", "temp");
118-
if ($uinfo->num_rows == 0) {
119-
$first_name = !empty($first_name)?$first_name:" ";
120-
$username = !empty($username)?$username:" ";
121-
$refcode = time();
122-
$sql = "INSERT INTO `users` VALUES (NULL,?,?,?,?, 0,?)";
123-
$stmt = $connection->prepare($sql);
124-
$stmt->bind_param("issii", $from_id, $first_name, $username, $refcode, $time);
125-
$stmt->execute();
126-
$stmt->close();
127-
}
117+
setUser("", "temp");
128118
if(isset($data) and $data == "mainMenu"){
129119
$res = editText($message_id, $mainValues['start_message'], getMainKeys());
130120
if(!$res->ok){
@@ -690,7 +680,7 @@
690680
👤 اسم: <code> $first_name </code>
691681
💰 موجودی: <code> $myWallet </code>
692682
693-
👈🏻 کل سرویس ها : <code> $totalBuys </code> عدد
683+
☑️ کل سرویس ها : <code> $totalBuys </code> عدد
694684
   
695685
",
696686
$keys,"html");
@@ -9194,29 +9184,26 @@
91949184
if(preg_match('/^editServer(\D+)(\d+)/',$userInfo['step'],$match) && $text != $buttonValues['cancel'] && ($from_id == $admin || $userInfo['isAdmin'] == true)){
91959185
switch($match[1]){
91969186
case "Name":
9197-
$txt ="title";
9187+
$sql = "UPDATE `server_info` SET `title`";
91989188
break;
9199-
case "Max":
9200-
$txt = "ucount";
9189+
case "Flag":
9190+
$sql = "UPDATE `server_info` SET `flag`";
92019191
break;
92029192
case "Remark":
9203-
$txt ="remark";
9204-
break;
9205-
case "Flag":
9206-
$txt = "flag";
9193+
$sql = "UPDATE `server_info` SET `remark`";
92079194
break;
9208-
default:
9209-
$txt = $match[1];
9195+
case "Max":
9196+
$sql = "UPDATE `server_info` SET `ucount`";
92109197
break;
92119198
}
92129199

92139200
if($text == "/empty"){
9214-
$stmt = $connection->prepare("UPDATE `server_info` SET `$txt` IS NULL WHERE `id`=?");
9201+
$stmt = $connection->prepare("$sql IS NULL WHERE `id`=?");
92159202
$stmt->bind_param("i", $match[2]);
92169203
$stmt->execute();
92179204
$stmt->close();
92189205
}else{
9219-
$stmt = $connection->prepare("UPDATE `server_info` SET `$txt`=? WHERE `id`=?");
9206+
$stmt = $connection->prepare("$sql=? WHERE `id`=?");
92209207
$stmt->bind_param("si",$text, $match[2]);
92219208
$stmt->execute();
92229209
$stmt->close();
@@ -9238,23 +9225,31 @@
92389225
}
92399226
if(preg_match('/^editsServer(\D+)(\d+)/',$userInfo['step'],$match) && $text != $buttonValues['cancel'] && ($from_id == $admin || $userInfo['isAdmin'] == true)){
92409227
if($text == "/empty"){
9241-
if($match[1] == "header_type" || $match[1] == "security"){
9242-
$stmt = $connection->prepare("UPDATE `server_config` SET `{$match[1]}` = 'none' WHERE `id`=?");
9243-
$stmt->bind_param("i", $match[2]);
9244-
}else{
9245-
$stmt = $connection->prepare("UPDATE `server_config` SET `{$match[1]}` = '' WHERE `id`=?");
9246-
$stmt->bind_param("i", $match[2]);
9247-
}
9228+
if($match[1] == "sni") $stmt = $connection->prepare("UPDATE `server_config` SET `sni` = '' WHERE `id`=?");
9229+
elseif($match[1] == "header_type") $stmt = $connection->prepare("UPDATE `server_config` SET `header_type` = 'none' WHERE `id`=?");
9230+
elseif($match[1] == "request_header") $stmt = $connection->prepare("UPDATE `server_config` SET `request_header` = '' WHERE `id`=?");
9231+
elseif($match[1] == "response_header") $stmt = $connection->prepare("UPDATE `server_config` SET `response_header` = '' WHERE `id`=?");
9232+
elseif($match[1] == "security") $stmt = $connection->prepare("UPDATE `server_config` SET `security` = 'none' WHERE `id`=?");
9233+
elseif($match[1] == "tlsSettings") $stmt = $connection->prepare("UPDATE `server_config` SET `tlsSettings` = '' WHERE `id`=?");
9234+
9235+
$stmt->bind_param("i", $match[2]);
92489236
}else{
9249-
if($match[1] == "header_type" && $text != "http" && $text != "none"){
9250-
sendMessage("برای نوع header type فقط none و یا http مجاز است");
9251-
exit();
9237+
if($match[1] == "sni") $stmt = $connection->prepare("UPDATE `server_config` SET `sni`=? WHERE `id`=?");
9238+
elseif($match[1] == "header_type"){
9239+
if($text != "http" && $text != "none"){
9240+
sendMessage("برای نوع header type فقط none و یا http مجاز است");
9241+
exit();
9242+
}else $stmt = $connection->prepare("UPDATE `server_config` SET `header_type`=? WHERE `id`=?");
92529243
}
9253-
elseif($match[1] == "security" && $text != "tls" && $text != "none" && $text != "xtls"){
9254-
sendMessage("برای نوع security فقط tls یا xtls و یا هم none مجاز است");
9255-
exit();
9244+
elseif($match[1] == "request_header") $stmt = $connection->prepare("UPDATE `server_config` SET `request_header`=? WHERE `id`=?");
9245+
elseif($match[1] == "response_header") $stmt = $connection->prepare("UPDATE `server_config` SET `response_header`=? WHERE `id`=?");
9246+
elseif($match[1] == "security"){
9247+
if($text != "tls" && $text != "none" && $text != "xtls"){
9248+
sendMessage("برای نوع security فقط tls یا xtls و یا هم none مجاز است");
9249+
exit();
9250+
}else $stmt = $connection->prepare("UPDATE `server_config` SET `security`=? WHERE `id`=?");
92569251
}
9257-
$stmt = $connection->prepare("UPDATE `server_config` SET `{$match[1]}`=? WHERE `id`=?");
9252+
elseif($match[1] == "tlsSettings") $stmt = $connection->prepare("UPDATE `server_config` SET `tlsSettings`=? WHERE `id`=?");
92589253
$stmt->bind_param("si",$text, $match[2]);
92599254
}
92609255
$stmt->execute();
@@ -9289,20 +9284,19 @@
92899284
if(preg_match('/^editServer(\D+)(\d+)/',$userInfo['step'],$match) && $text != $buttonValues['cancel'] && ($from_id == $admin || $userInfo['isAdmin'] == true)){
92909285
switch($match[1]){
92919286
case "Name":
9292-
$txt ="title";
9287+
$stmt = $connection->prepare("UPDATE `server_info` SET `title`=? WHERE `id`=?");
92939288
break;
92949289
case "Max":
9295-
$txt = "ucount";
9290+
$stmt = $connection->prepare("UPDATE `server_info` SET `ucount`=? WHERE `id`=?");
92969291
break;
92979292
case "Remark":
9298-
$txt ="remark";
9293+
$stmt = $connection->prepare("UPDATE `server_info` SET `remark`=? WHERE `id`=?");
92999294
break;
93009295
case "Flag":
9301-
$txt = "flag";
9296+
$stmt = $connection->prepare("UPDATE `server_info` SET `flag`=? WHERE `id`=?");
93029297
break;
93039298
}
93049299

9305-
$stmt = $connection->prepare("UPDATE `server_info` SET `$txt`=? WHERE `id`=?");
93069300
$stmt->bind_param("si",$text, $match[2]);
93079301
$stmt->execute();
93089302
$stmt->close();

0 commit comments

Comments
 (0)