Skip to content

Commit c6be6e0

Browse files
authored
Update install.php
1 parent 5059f84 commit c6be6e0

File tree

1 file changed

+11
-284
lines changed

1 file changed

+11
-284
lines changed

install/install.php

Lines changed: 11 additions & 284 deletions
Original file line numberDiff line numberDiff line change
@@ -1,288 +1,15 @@
11
<?php
2-
if(!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on'){
3-
form("ربات باید روی دامنه ی دارای ssl فعال نصب بشه!");
4-
exit();
5-
}
6-
if(!file_exists("../createDB.php") || !file_exists("../baseInfo.php") || !file_exists("../bot.php") || !file_exists("../config.php")){
7-
form("فایل های مورد نیاز ربات یافت نشد");
8-
exit();
9-
}
10-
11-
$fileAddress = str_replace(["install.php","?webhook", "?install", "?updateBot", "?update", "/install"],"", "https://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
12-
$botUrl = $fileAddress . "bot.php";
13-
14-
if(isset($_REQUEST['webhook'])){
15-
$botToken = $_POST['bottoken'];
16-
$adminId = $_POST['adminid'];
17-
$dbName = $_POST['dbname'];
18-
$dbUser = $_POST['dbuser'];
19-
$dbPassword = $_POST['dbpassword'];
20-
21-
22-
$connection = new mysqli('localhost',$dbUser,$dbPassword,$dbName);
23-
if($connection->connect_error){
24-
form("خطای دیتابیس: " . $connection->connect_error);
25-
exit();
26-
}
27-
$checkBot = json_decode(file_get_contents("https://api.telegram.org/bot" . $botToken . "/getwebhookinfo"));
28-
if($checkBot->ok){
29-
if($checkBot->result->url != ""){
30-
form("این ربات قبلاً نصب شده");
31-
exit();
32-
}
33-
}else{
34-
form("رباتی با این توکن یافت نشد");
35-
exit();
36-
}
37-
38-
$baseInfo = file_get_contents("../baseInfo.php");
39-
$baseInfo = str_replace(['[BOTTOKEN]','[DBUSERNAME]','[DBPASSWORD]','[DBNAME]','[ADMIN]','[BOTURL]'],
40-
[$botToken, $dbUser, $dbPassword, $dbName, $adminId, $fileAddress],
41-
$baseInfo);
42-
file_put_contents("../baseInfo.php", $baseInfo);
43-
file_get_contents($fileAddress. "createDB.php");
44-
$response = json_decode(file_get_contents("https://api.telegram.org/bot" . $botToken . "/setWebhook?url=" . $botUrl));
45-
if($response->ok){
46-
file_get_contents("https://api.telegram.org/bot" . $botToken . "/sendMessage?chat_id=" . $adminId . "&text=✅| ربات ویزیز با موفقیت نصب شد");
47-
form("ربات با موفقیت نصب شد", false);
48-
}
49-
}elseif(isset($_REQUEST['install'])){
50-
$baseInfo = file_get_contents("../baseInfo.php");
51-
if(!strstr($baseInfo, '[BOTTOKEN]') || !strstr($baseInfo, '[DBUSERNAME]')
52-
|| !strstr($baseInfo, '[DBPASSWORD]') || !strstr($baseInfo, '[DBNAME]')
53-
|| !strstr($baseInfo, '[ADMIN]')){
54-
form('روی این سورس قبلاً رباتی نصب شده!');
55-
exit();
56-
}
57-
showForm("install");
58-
}elseif(isset($_REQUEST['update'])){
59-
showForm("update");
60-
}
61-
elseif(isset($_REQUEST['updateBot'])){
62-
if (!file_exists("update.php")){
63-
echo '<script type="text/javascript">alert("فایل آپدیت یافت نشد");history.go(-1)</script>';
64-
exit();
65-
}
66-
require "update.php";
67-
require "../baseInfo.php";
68-
69-
70-
$connection = new mysqli('localhost',$dbUserName,$dbPassword,$dbName);
71-
72-
if($connection->connect_error){
73-
form("خطای دیتابیس: " . $connection->connect_error);
74-
exit();
75-
}
76-
77-
updateBot();
78-
79-
80-
form("ربات با موفقیت آپدیت شد نسخه 7.5.3 می باشد",false);
81-
}
82-
else{
83-
showForm("unknown");
84-
}
85-
?>
86-
<?php
87-
function showForm($type){
88-
?>
89-
<html lang="en">
90-
<head>
91-
<script>
92-
(function(w,d,s,l,i){w[l]=w[l]||[];
93-
w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js', });
94-
var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';
95-
j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl+'&gtm_auth=&gtm_preview=&gtm_cookies_win=x';
96-
f.parentNode.insertBefore(j,f);
97-
})(window,document,'script','dataLayer','GTM-MSN6P6G');</script>
98-
<meta charset="utf-8"><meta name="viewport" content="width=device-width">
99-
<title><?php if($type=="unknown") echo "نصب و آپدیت خودکار ویزویز";
100-
elseif ($type=="install") echo "نصب ربات";
101-
elseif ($type=="update") echo "آپدیت ربات";
102-
?></title>
103-
<meta charset="utf-8">
104-
<meta http-equiv="X-UA-Compatible" content="IE=edge">
105-
<meta name="viewport" content="width=device-width, initial-scale=1">
106-
<link type="text/css" href="../assets/style.css" rel="stylesheet" />
107-
<style>
108-
body{
109-
direction: rtl;
110-
padding-top: 15px;
111-
text-align: center;
112-
background: #345987;
113-
}
114-
115-
button{
116-
cursor: pointer;
117-
font-size: 18px;
118-
width: 90%;
119-
margin-bottom: 10px;
120-
border-radius: 10px;
121-
padding: 10px;
122-
border: 1px #eae1e1 solid;
123-
font-family: iransans !important;
124-
}
125-
type[input]{
126-
direction: rtl;
127-
}
128-
</style>
129-
</head>
130-
<body>
131-
<?php if ($type=="unknown"){?>
132-
133-
<div>
134-
<img src="../assets/logo.png" width="200px">
135-
</div>
136-
<br>
137-
<div>
138-
<a href="./install.php?install">
139-
<button style="background-color: #e0eeee;
140-
border: none;font-weight: 600;color: #000509" type="button">
141-
<span>نصب ربات</span>
142-
</button>
143-
</a>
144-
<a href="./install.php?update">
145-
<button style="margin: 5px;background-color: #eccfde;
146-
border: none;font-weight: 600;color: #620738">
147-
<span>آپدیت ربات</span>
148-
</button>
149-
</a>
150-
</div>
151-
<div style="margin-top: 5px">
152-
<span>
153-
<a target="_blank" href="https://t.me/wizwizch">
154-
<button style="width: 150px;margin: 5px;padding: 3px;font-size: 16px">
155-
<span>کانال تلگرام</span>
156-
</button>
157-
</a>
158-
</span>
159-
<span>
160-
<a target="_blank" href="https://t.me/wizwizdev">
161-
<button style="width: 150px;margin: 5px;padding: 3px;font-size: 16px">
162-
<span>گروه تلگرام</span>
163-
</button>
164-
</a>
165-
</span>
166-
</div>
167-
<?php }elseif($type=="update"){
168-
?>
169-
<h1 style="font-size: 25px">لطفا جهت آپدیت روی دکمه زیر رو بزنید</h1>
170-
<a href="./install.php?updateBot">
171-
<button type="button" class="ant-btn ant-btn-primary ant-btn-block ant-btn-rtl PayPing-button always-white">
172-
<span>آپدیت ربات</span>
173-
</button>
174-
</a>
175-
<?php
176-
}
177-
elseif($type=="install"){ ?>
178-
179-
<h1>نصب ربات ویزویز</h1>
180-
<div class="container">
181-
<form id="contact" action="install.php?webhook" method="post">
182-
<h3>لطفا اطلاعات خواسته شده را وارد کنید</h3>
183-
<h4>نظرات و پیشنهادات خود را در گروه تلگرامی wizwizdev ارسال کنید</h4>
184-
<fieldset>
185-
<input placeholder="توکن ربات" type="text" name="bottoken" autocomplete="off" required >
186-
</fieldset>
187-
<fieldset>
188-
<input placeholder="آیدی عددی ادمین" type="text" name="adminid" autocomplete="off" required>
189-
</fieldset>
190-
<fieldset>
191-
<input placeholder="اسم دیتابیس" type="text" name="dbname" autocomplete="off" required>
192-
</fieldset>
193-
<fieldset>
194-
<input placeholder="یوزرنیم دیتابیس" type="text" name="dbuser" autocomplete="off" required>
195-
</fieldset>
196-
<fieldset>
197-
<input placeholder="پسورد دیتابیس" type="text" name="dbpassword" autocomplete="off" required>
198-
</fieldset>
199-
<fieldset>
200-
<button class="btninstall" type="submit">نصب ربات</button>
201-
</fieldset>
202-
<p style="font-size:13px">Made with 🖤 in <a target="_blank" href="https://github.com/wizwizdev/wizwizxui-timebot">wizwiz</a></p>
203-
</form>
204-
</div>
205-
<br>
206-
<br>
207-
208-
<?php } ?>
209-
</body>
210-
</html>
211-
<?php
212-
}
213-
function form($msg, $error = true){
214-
?>
215-
216-
<html dir="rtl">
217-
<head>
218-
<script>
219-
(function(w,d,s,l,i){w[l]=w[l]||[];
220-
w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js', });
221-
var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';
222-
j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl+'&gtm_auth=&gtm_preview=&gtm_cookies_win=x';
223-
f.parentNode.insertBefore(j,f);
224-
})(window,document,'script','dataLayer','GTM-MSN6P6G');
225-
</script>
226-
<meta charset="utf-8"><meta name="viewport" content="width=device-width">
227-
<title>نصب ربات ویزویز</title>
228-
<meta name="next-head-count" content="4">
229-
</head>
230-
<style>
231-
.ant-layout1 {
232-
background: #f0f2f5;
233-
display: flex;
234-
flex: auto;
235-
flex-direction: column;
236-
min-height: 0;
237-
}
238-
.PayPing-layout1 {
239-
background-color: #fff;
240-
}
241-
body, html {
242-
padding: 0;
243-
margin: 0;
244-
font-family: iransans !important;
245-
}
246-
a {
247-
color: inherit;
248-
text-decoration: none;
249-
}
250-
* {
251-
box-sizing: border-box;
252-
}
253-
.w-100 {
254-
width: 100%
255-
}
256-
.align-center {
257-
align-items: center!important;display: flex;
258-
}
259-
.justify-center {
260-
display: flex;justify-content: center!important;
261-
}
262-
</style>
263-
<body>
264-
<div id="__next">
265-
<section class="ant-layout1 PayPing-layout1 " style="min-height:100vh;display: flex;justify-content: center!important;background-color: #172b4d;direction: rtl;">
266-
<main class="" style="display: flex;flex-direction: column!important;align-items: center!important;display: flex;display: flex;justify-content: center!important;">
267-
<div class="justify-center align-center w-100">
268-
<div style="background-color: #fff;border-radius: 5px;padding: 20px;position: relative;display: block;flex: 0 0 50.83333333%;max-width: 50.83333333%;right: auto;left: auto;align-items: center;display: flex;justify-content: center!important;" class="">
269-
<div style="padding-bottom: 2rem!important;padding-top: 2rem!important;align-items: center!important;display: flex;color: #e31b23;display: flex;flex-direction: column!important;" class="">
270-
<?php if ($error == true){ ?> <svg fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24" class="PayPing-icon" stroke-width="1" width="100">
271-
<circle cx="12" cy="12" r="11"></circle>
272-
<path d="M15.3 8.7l-6.6 6.6M8.7 8.7l6.6 6.6"></path>
273-
</svg>
274-
<?php }?>
275-
<div class="" style="padding: 40px 30px" > <?php echo $msg ?></div>
276-
</div>
277-
</div>
278-
</div>
279-
</main>
280-
</section>
281-
</div>
282-
</body>
283-
</html>
284-
2+
if(isset($_REQUEST['updateBot'])){
3+
require "update.php";
4+
require "../baseInfo.php";
5+
6+
$connection = new mysqli('localhost',$dbUserName,$dbPassword,$dbName);
7+
8+
if($connection->connect_error){
9+
form("خطای دیتابیس: " . $connection->connect_error);
10+
exit();
11+
}
28512

286-
<?php
13+
updateBot();
28714
}
28815
?>

0 commit comments

Comments
 (0)