This repository has been archived by the owner on Nov 22, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
add.php
121 lines (111 loc) · 4.86 KB
/
add.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
<?php
require('c.php');
require('f.php');
session_start();
is_banned();
if (isset($_POST['sendKey']) and $_SESSION['security_code'] == $_POST['captcha'])
{
if ($_POST['name'] == "" or $_POST['key'] == "" or $_POST['description'] == "" or $_POST['tag'] == "")
{
die("HUI SOSI");
}
$key = mysql_real_escape_string(htmlspecialchars($_POST['key']));
$name = mysql_real_escape_string(htmlspecialchars($_POST['name']));
$description = mysql_real_escape_string(nl2br(strip_tags($_POST['description'])));
$tag = mysql_real_escape_string(htmlspecialchars($_POST['tag']));
$accessType = intval($_POST['accessType']);
$temp = intval($_POST['24hours']);
$date = time();
$size = mysql_real_escape_string(htmlspecialchars($_POST['size']));
$ip = $_SERVER['REMOTE_ADDR'];
$exists_tags = array();
$tags = explode(', ', $tag);
if (count($tags)>5) die ("Тегов должно быть не более 5");
$send_query = mysql_query("INSERT INTO `keys` VALUES ('', '$key', '$name', '$description', '$accessType', '$temp', '$date', '$tag', '$size', '$ip')") or die (mysql_error());
$key_id = mysql_insert_id();
foreach($tags as $tag) {
if (!empty($tag)) {
if (!in_array($tag, $exists_tags)) {
mysql_query("INSERT INTO `tags` (`tag`,`key_id`) VALUES('".$tag."','".$key_id."')") or die(mysql_error());
$exists_tags[]=$tag;
}
}
}
Header ("Location: /key/" . $key_id);
}
elseif (isset($_POST['sendKey']) and $_SESSION['security_code'] != $_POST['captcha'])
{
die("Wrong captcha!");
}
?>
<!doctype html>
<html>
<head>
<title><?= $settings['title']; ?> — Добавить ключ</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="css/bootstrap-responsive.css">
<link rel="stylesheet" href="css/custom.css">
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="/"><?= $settings['siteName']; ?></a>
<div class="navbar-content">
<ul class="nav ">
<li>
<a href="/">Ключи</a>
</li>
<li class="active">
<a href="/add">Добавить</a>
</li>
<li>
<a href="/faq.php">FAQ</a>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="container">
<div class="row main-features"></div>
<div class="container">
<div class="description"></div>
</div>
<br><br>
<div class="container">
<form method="post">
<center><b>Внимание!</b> Все раздачи на версии <a href="http://syncapp.bittorrent.com/1.1.27/">1.1.27</a>.</center><hr>
<input type="text" class="input-block-level" name="name" placeholder="Заголовок"
id="name" required>
<input type="text" pattern=".{11,}" class="input-block-level" name="key" placeholder="Ключ"
id="key" required>
<textarea class="input-block-level" rows="5" name="description" placeholder="Описание"
id="description" required></textarea>
<input type="text" class="input-block-level" name="tag" placeholder="Теги (разделяются запятыми, после запятой нужен пробел!)"
id="tag" required>
<input type="text" class="input-block-level" name="size" placeholder="Вес (размер), указывать в MB/GB"
id="size" required>
<select name="accessType" id="accessType">
<option value="0">Только чтение</option>
<option value="1">Полный доступ</option>
</select>
<label class="checkbox" for="checkbox">
<input type="checkbox" id="checkbox" name="checkbox">
<span>Ключ действует в течение 24 часов</span>
<span></span>
</label>
<hr>
<p class="form-captcha"><a href="#" onclick="javascript:document.getElementById('captchaimg').src = '/captcha/?' + Math.random();return false;"><img alt src="/captcha/" id="captchaimg" width="100" height="40"></a> <input type="text" name="captcha" id="captcha" required></p><hr>
<div class="form-actions">
<button type="submit" name="sendKey" class="btn btn-block btn-success">Добавить</button>
</div>
</form>
</div>
</div>
</body>
</html>