-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
221 lines (192 loc) · 6.82 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
<?php
include 'includes/database.php';
$messageSent = false;
$error = '';
$noRecords = false;
try {
$stmt = $pdo->query("SELECT bot_name, webhook_link, profile_image FROM webhook_settings ORDER BY id DESC LIMIT 1");
$settings = $stmt->fetch(PDO::FETCH_ASSOC);
if ($settings) {
$botName = $settings['bot_name'];
$webhookLink = $settings['webhook_link'];
$profileImage = $settings['profile_image'];
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['message'])) {
$userMessage = $_POST['message'];
$data = [
"username" => $botName,
"avatar_url" => $profileImage,
"content" => $userMessage
];
$options = [
'http' => [
'method' => 'POST',
'header' => "Content-Type: application/json\r\n",
'content' => json_encode($data),
]
];
$context = stream_context_create($options);
$result = file_get_contents($webhookLink, false, $context);
if ($result === FALSE) {
$error = "Mesaj gönderilirken bir hata oluştu.";
} else {
$messageSent = true;
}
}
} else {
$noRecords = true;
}
} catch (PDOException $e) {
$error = "Hata: " . $e->getMessage();
}
?>
<!DOCTYPE html>
<html lang="tr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title data-tr="arxsoftr | WebHook Projesi" data-en="arxsoftr | Webhook Project">arxsoftr | WebHook Projesi</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
<style>
body {
background-color: #121212;
color: #fff;
font-family: Arial, sans-serif;
text-align: center;
padding: 50px;
margin: 0;
position: relative;
min-height: 100vh;
}
.container {
background-color: #1f1f1f;
padding: 30px;
border-radius: 10px;
width: 400px;
margin: 0 auto;
}
h1 {
color: #e50914;
}
label {
display: block;
margin: 15px 0 5px;
font-weight: bold;
}
textarea {
width: 100%;
padding: 10px;
margin-bottom: 20px;
border: none;
border-radius: 5px;
background-color: #333;
color: #fff;
resize: none;
height: 100px;
}
input[type="submit"], .install-button {
background-color: #e50914;
color: #fff;
padding: 10px 20px;
border: none;
border-radius: 5px;
cursor: pointer;
text-decoration: none;
display: inline-block;
}
input[type="submit"]:hover, .install-button:hover {
background-color: #b20610;
}
.message {
margin-top: 20px;
font-size: 16px;
}
.header {
position: absolute;
top: 10px;
left: 10px;
display: flex;
gap: 10px;
}
.header select {
background-color: #333;
color: #fff;
border: 1px solid #444;
border-radius: 5px;
padding: 5px;
font-family: Arial, sans-serif;
}
footer {
position: fixed;
bottom: 0;
width: 100%;
background-color: #1f1f1f;
padding: 20px;
color: #ddd;
text-align: center;
display: flex;
justify-content: center;
align-items: center;
gap: 15px;
font-family: 'Ubuntu', sans-serif;
font-weight: bold;
}
footer .social-icons a {
color: #ddd;
font-size: 24px;
text-decoration: none;
}
footer .social-icons a:hover {
color: #e50914;
}
</style>
<link href="https://fonts.googleapis.com/css2?family=Ubuntu:wght@700&display=swap" rel="stylesheet">
</head>
<body>
<div class="header">
<label for="language">Dil:</label>
<select id="language" name="language" onchange="changeLanguage(this.value)">
<option value="tr">Türkçe</option>
<option value="en">English</option>
</select>
</div>
<div class="container">
<h1 data-tr="Discord Mesaj Gönderimi" data-en="Discord Message Sending">Discord Mesaj Gönderimi</h1>
<?php if ($messageSent): ?>
<p class="message" data-tr="Mesaj başarıyla gönderildi!" data-en="Message sent successfully!">Mesaj başarıyla gönderildi!</p>
<?php elseif ($error): ?>
<p class="message" data-tr="Mesaj gönderilirken bir hata oluştu." data-en="An error occurred while sending the message."><?php echo htmlspecialchars($error); ?></p>
<?php elseif ($noRecords): ?>
<p class="message" data-tr="Veritabanında kayıt bulunamadı." data-en="No records found in the database.">Veritabanında kayıt bulunamadı.</p>
<a href="install/" class="install-button" data-tr="Kurulum Sayfasına Git" data-en="Go to Installation Page">Kurulum Sayfasına Git</a>
<?php else: ?>
<form action="" method="post">
<label for="message" data-tr="Gönderilecek Mesaj" data-en="Message to Send">Gönderilecek Mesaj</label>
<textarea id="message" name="message" placeholder="Merhaba, ..."></textarea>
<input type="submit" value="Mesajı Gönder" data-en="Send Message" data-tr="Mesajı Gönder">
</form>
<?php endif; ?>
</div>
<footer>
<div class="social-icons">
<a href="https://whatsapp.com/channel/0029VakSPMEF1YlSepEmUJ0c" target="_blank" title="WhatsApp"><i class="fab fa-whatsapp"></i></a>
<a href="https://t.me/arxsoftr" target="_blank" title="Telegram"><i class="fab fa-telegram-plane"></i></a>
<a href="https://discord.gg/b8he38FReG" target="_blank" title="Discord"><i class="fab fa-discord"></i></a>
</div>
<span>arxsoftr®</span>
</footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/js/all.min.js"></script>
<script>
function changeLanguage(lang) {
document.querySelectorAll('[data-tr]').forEach(el => {
el.textContent = el.getAttribute(`data-${lang}`);
});
}
const savedLang = localStorage.getItem('lang') || 'tr';
document.getElementById('language').value = savedLang;
changeLanguage(savedLang);
document.getElementById('language').addEventListener('change', (e) => {
localStorage.setItem('lang', e.target.value);
});
</script>
</body>
</html>