Skip to content

Commit dbb91ae

Browse files
authored
Update update.php
1 parent 0338e3a commit dbb91ae

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

install/update.php

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
11
<?php
2-
32
require "../baseInfo.php";
43
$connection = new mysqli('localhost',$dbUserName,$dbPassword,$dbName);
5-
64
$arrays = [
5+
"CREATE TABLE `send_list` (
6+
`id` int(255) NOT NULL AUTO_INCREMENT,
7+
`offset` int(255) NOT NULL DEFAULT 0,
8+
`type` varchar(20) NOT NULL,
9+
`text` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin,
10+
`chat_id` bigint(10),
11+
`message_id` int(255),
12+
`file_id` varchar(500),
13+
`state` int(1) NOT NULL DEFAULT 0,
14+
PRIMARY KEY (`id`)
15+
);",
716
"DROP TABLE `refered_users`;",
817
"DROP TABLE `server_accounts`;",
918
"ALTER TABLE `server_config` DROP `cookie`;",
10-
"CREATE TABLE `discounts` (
19+
"CREATE TABLE `discounts` (
1120
`id` int(255) NOT NULL AUTO_INCREMENT,
1221
`hash_id` varchar(100) NOT NULL,
1322
`type` varchar(10) NOT NULL,
@@ -17,7 +26,7 @@
1726
`used_by` text DEFAULT NULL,
1827
PRIMARY KEY (`id`)
1928
);",
20-
"CREATE TABLE `admins` (
29+
"CREATE TABLE `admins` (
2130
`id` int(10) NOT NULL AUTO_INCREMENT,
2231
`username` varchar(200) NOT NULL,
2332
`password` varchar(200) NOT NULL,
@@ -27,7 +36,7 @@
2736
);",
2837
"INSERT INTO `admins` (`id`, `username`, `password`, `backupchannel`, `lang`) VALUES
2938
(1, 'admin', 'admin', '-1002545458541', 'en');",
30-
"CREATE TABLE `servers` (
39+
"CREATE TABLE `servers` (
3140
`id` int(11) NOT NULL AUTO_INCREMENT,
3241
`ip` varchar(200) NOT NULL,
3342
`port` int(10) NOT NULL,
@@ -38,13 +47,13 @@
3847
`status` int(11) NOT NULL,
3948
PRIMARY KEY (`id`)
4049
);",
41-
"CREATE TABLE `increase_day` (
50+
"CREATE TABLE `increase_day` (
4251
`id` int(11) NOT NULL AUTO_INCREMENT,
4352
`volume` float NOT NULL,
4453
`price` int(11) NOT NULL,
4554
PRIMARY KEY (`id`)
4655
);",
47-
"CREATE TABLE `increase_order` (
56+
"CREATE TABLE `increase_order`(
4857
`id` int(11) NOT NULL AUTO_INCREMENT,
4958
`userid` varchar(30) NOT NULL,
5059
`server_id` int(11) NOT NULL,
@@ -54,7 +63,7 @@
5463
`date` varchar(30) NOT NULL,
5564
PRIMARY KEY (`id`)
5665
);",
57-
"CREATE TABLE `increase_plan` (
66+
"CREATE TABLE `increase_plan` (
5867
`id` int(255) NOT NULL AUTO_INCREMENT,
5968
`volume` float NOT NULL,
6069
`price` int(255) NOT NULL,
@@ -78,7 +87,7 @@
7887
"ALTER TABLE `discounts` ADD `can_use` INT(255) NOT NULL DEFAULT '1' AFTER `used_by`;",
7988
"ALTER TABLE `server_plans` ADD `custom_port` INT(255) NOT NULL DEFAULT '0' AFTER `custom_path`;",
8089
"ALTER TABLE `server_plans` ADD `custom_sni` VARCHAR(500) NULL AFTER `custom_port`;",
81-
"CREATE TABLE `gift_list` (
90+
"CREATE TABLE `gift_list` (
8291
`id` int(255) NOT NULL AUTO_INCREMENT,
8392
`server_id` int(255) NOT NULL,
8493
`volume` int(255) NOT NULL,
@@ -102,16 +111,14 @@
102111
"ALTER TABLE `users` CHANGE `discount_percent` `discount_percent` VARCHAR(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL;",
103112
"UPDATE `users` SET discount_percent = IF(discount_percent = 0, NULL, CONCAT('{\"normal\": ', discount_percent, '}')) WHERE discount_percent REGEXP '^[0-9]+$';"
104113
];
105-
106-
107114
function updateBot(){
108115
global $arrays, $connection, $walletwizwiz, $nowPaymentKey, $zarinpalId;
109116

110117
foreach($arrays as $query){
111118
try{
112119
$connection->query($query);
113120
}catch (exception $error){
114-
121+
echo json_encode($error);
115122
}
116123
}
117124

@@ -204,6 +211,7 @@ function updateBot(){
204211
}
205212

206213

207-
214+
if(file_exists('../tempCookie.txt')) unlink('../tempCookie.txt');
215+
if(file_exists('../settings/messagewizwiz.json')) unlink('../settings/messagewizwiz.json');
208216
}
209217
?>

0 commit comments

Comments
 (0)