Skip to content

Commit 7015cad

Browse files
committed
Added automatic database creation
1 parent 8d41e96 commit 7015cad

File tree

1 file changed

+176
-0
lines changed

1 file changed

+176
-0
lines changed

createDB.php

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
<?php
2+
3+
include "baseInfo.php";
4+
$connection = new mysqli('localhost',$dbUserName,$dbPassword,$dbName);
5+
if($connection->connect_error){
6+
exit("error " . $connection->connect_error);
7+
}
8+
$connection->set_charset("utf8mb4");
9+
10+
$connection->query("CREATE TABLE `chats` (
11+
`id` int(255) NOT NULL AUTO_INCREMENT,
12+
`user_id` bigint(10) NOT NULL,
13+
`create_date` int(255) NOT NULL,
14+
`title` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
15+
`category` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
16+
`state` int(5) NOT NULL,
17+
`rate` int(5) NOT NULL,
18+
PRIMARY KEY (`id`)
19+
)");
20+
21+
22+
$connection->query("CREATE TABLE `chats_info` (
23+
`id` int(255) NOT NULL AUTO_INCREMENT,
24+
`chat_id` int(255) NOT NULL,
25+
`sent_date` int(255) NOT NULL,
26+
`msg_type` varchar(50) DEFAULT NULL,
27+
`text` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
28+
PRIMARY KEY (`id`)
29+
)");
30+
31+
$connection->query("CREATE TABLE `needed_sofwares` (
32+
`id` int(11) NOT NULL AUTO_INCREMENT,
33+
`title` varchar(100) NOT NULL,
34+
`link` varchar(250) NOT NULL,
35+
`status` int(11) NOT NULL DEFAULT 1,
36+
PRIMARY KEY (`id`)
37+
)");
38+
39+
$connection->query("INSERT INTO `needed_sofwares` (`id`, `title`, `link`, `status`) VALUES
40+
(1, 'ios fair-vpn', 'https://apps.apple.com/us/app/fair-vpn/id1533873488', 1),
41+
(2, 'ios napsternetv', 'https://apps.apple.com/us/app/napsternetv/id1629465476', 1),
42+
(3, 'ios oneclick', 'https://apps.apple.com/us/app/id1545555197', 1),
43+
(4, 'android v2rayng', 'https://play.google.com/store/apps/details?id=com.v2ray.ang&hl=en&gl=US', 1),
44+
(5, 'android sagernet', 'https://play.google.com/store/apps/details?id=io.nekohasekai.sagernet&hl=de&gl=US', 1),
45+
(6, 'android onclick', 'https://play.google.com/store/apps/details?id=earth.oneclick', 1),
46+
(7, 'windows v2rayng', 'https://holoo.pro/v2ray-windows/', 1),
47+
(8, 'mac fair', 'https://apps.apple.com/us/app/fair-vpn/id1533873488', 1);
48+
");
49+
50+
51+
$connection->query("CREATE TABLE `orders_list` (
52+
`id` int(11) NOT NULL AUTO_INCREMENT,
53+
`userid` varchar(30) NOT NULL,
54+
`transid` varchar(150) NOT NULL,
55+
`fileid` int(11) NOT NULL,
56+
`server_id` int(11) NOT NULL,
57+
`inbound_id` int(11) NOT NULL DEFAULT 0,
58+
`remark` varchar(100) NOT NULL,
59+
`protocol` varchar(20) NOT NULL,
60+
`expire_date` int(11) NOT NULL,
61+
`link` text NOT NULL,
62+
`amount` int(11) NOT NULL,
63+
`status` int(11) NOT NULL,
64+
`date` varchar(50) NOT NULL,
65+
`notif` int(11) NOT NULL DEFAULT 0,
66+
PRIMARY KEY (`id`)
67+
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_persian_ci");
68+
69+
70+
$connection->query("CREATE TABLE IF NOT EXISTS `pays` (
71+
`id` int(255) NOT NULL AUTO_INCREMENT,
72+
`hash_id` varchar(1000) NOT NULL,
73+
`payid` bigint(10) NOT NULL DEFAULT 0,
74+
`user_id` bigint(10) NOT NULL,
75+
`type` varchar(100),
76+
`plan_id` int(255),
77+
`volume` int(255),
78+
`day` int(255),
79+
`price` int(255) NOT NULL,
80+
`request_date` int(255) NOT NULL,
81+
`state` varchar(255) NOT NULL,
82+
PRIMARY KEY (`id`)
83+
);");
84+
85+
86+
$connection->query("CREATE TABLE `server_categories` (
87+
`id` int(11) NOT NULL AUTO_INCREMENT,
88+
`server_id` varchar(20) NOT NULL,
89+
`title` varchar(50) NOT NULL,
90+
`parent` int(11) NOT NULL DEFAULT 0,
91+
`step` int(11) NOT NULL,
92+
`active` int(11) NOT NULL DEFAULT 0,
93+
PRIMARY KEY (`id`)
94+
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_persian_ci");
95+
96+
97+
$connection->query("CREATE TABLE `server_config` (
98+
`id` int(11) NOT NULL AUTO_INCREMENT,
99+
`panel_url` varchar(254) NOT NULL,
100+
`ip` text NOT NULL,
101+
`sni` varchar(254) NOT NULL,
102+
`header_type` enum('none','http') NOT NULL,
103+
`request_header` text NOT NULL,
104+
`response_header` text NOT NULL,
105+
`security` enum('xtls', 'tls','none') NOT NULL,
106+
`tlsSettings` text NOT NULL,
107+
`cookie` text NOT NULL,
108+
`type` varchar(100) DEFAULT NULL,
109+
`username` varchar(100) NOT NULL,
110+
`password` varchar(100) NOT NULL,
111+
`port_type` varchar(10) DEFAULT 'auto',
112+
PRIMARY KEY (`id`)
113+
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci");
114+
115+
$connection->query("CREATE TABLE `server_info` (
116+
`id` int(11) NOT NULL AUTO_INCREMENT,
117+
`title` varchar(200) CHARACTER SET utf8 COLLATE utf8_persian_ci NOT NULL,
118+
`ucount` varchar(20) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
119+
`remark` varchar(100) NOT NULL,
120+
`flag` varchar(100) NOT NULL,
121+
`active` int(11) NOT NULL DEFAULT 0,
122+
PRIMARY KEY (`id`)
123+
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_persian_ci");
124+
125+
126+
127+
$connection->query("CREATE TABLE `server_plans` (
128+
`id` int(11) NOT NULL AUTO_INCREMENT,
129+
`fileid` varchar(250) NOT NULL,
130+
`catid` int(11) NOT NULL,
131+
`server_id` int(11) NOT NULL,
132+
`inbound_id` int(11) NOT NULL DEFAULT 0,
133+
`acount` bigint(20) NOT NULL,
134+
`limitip` int(11) NOT NULL DEFAULT 1,
135+
`title` varchar(150) NOT NULL,
136+
`protocol` varchar(100) NOT NULL,
137+
`days` float NOT NULL,
138+
`volume` float NOT NULL,
139+
`type` varchar(50) NOT NULL,
140+
`price` int(11) NOT NULL,
141+
`descr` text NOT NULL,
142+
`pic` varchar(100) NOT NULL,
143+
`active` int(11) NOT NULL DEFAULT 0,
144+
`step` int(11) NOT NULL,
145+
`date` varchar(50) NOT NULL,
146+
PRIMARY KEY (`id`)
147+
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_persian_ci");
148+
149+
150+
$connection->query("CREATE TABLE `setting` (
151+
`id` int(255) NOT NULL AUTO_INCREMENT,
152+
`type` varchar(500) NOT NULL,
153+
`value` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
154+
PRIMARY KEY (`id`)
155+
)");
156+
157+
$connection->query("INSERT INTO `setting` (`id`, `type`, `value`) VALUES
158+
(1, 'TICKETS_CATEGORY', 'شکایت');
159+
");
160+
161+
162+
$connection->query("CREATE TABLE `users` (
163+
`id` int(11) NOT NULL AUTO_INCREMENT,
164+
`userid` varchar(40) NOT NULL,
165+
`name` varchar(100) NOT NULL,
166+
`username` varchar(100) NOT NULL,
167+
`refcode` varchar(50) NOT NULL,
168+
`wallet` int(11) NOT NULL DEFAULT 0,
169+
`date` varchar(50) NOT NULL,
170+
PRIMARY KEY (`id`)
171+
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_persian_ci");
172+
173+
174+
175+
176+
?>

0 commit comments

Comments
 (0)