-
Notifications
You must be signed in to change notification settings - Fork 29
/
polloverview.php
147 lines (111 loc) · 5.89 KB
/
polloverview.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
<?php
/*
// +--------------------------------------------------------------------------+
// | Project: TBDevYSE - TBDev Yuna Scatari Edition |
// +--------------------------------------------------------------------------+
// | This file is part of TBDevYSE. TBDevYSE is based on TBDev, |
// | originally by RedBeard of TorrentBits, extensively modified by |
// | Gartenzwerg. |
// | |
// | TBDevYSE is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
// | the Free Software Foundation; either version 2 of the License, or |
// | (at your option) any later version. |
// | |
// | TBDevYSE is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// | GNU General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with TBDevYSE; if not, write to the Free Software Foundation, |
// | Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +--------------------------------------------------------------------------+
// | Do not remove above lines! |
// +--------------------------------------------------------------------------+
*/
require "include/bittorrent.php";
dbconn(false);
loggedinorreturn();
function cleanit($array, $index, $maxlength)
{
if (isset($array["{$index}"]))
{
$input = substr($array["{$index}"], 0, $maxlength);
$input = mysql_real_escape_string($input);
return ($input);
}
return NULL;
}
//$action = $_GET["action"];
$pollid = cleanit($_GET, "id", 2);
//$returnto = $_GET["returnto"];
if (get_user_class() < UC_MODERATOR)
stderr($tracker_lang['error'], "Íåò äîñòóïà.");
stdhead("Îáçîð îïðîñîâ");
if (!(isset($_GET['id']))) {
$sql = sql_query("SELECT id, added, question FROM polls ORDER BY id DESC") or sqlerr(__FILE__, __LINE__);
//$sql = db_query("SELECT id, added, question FROM polls ORDER BY id DESC");
print("<h1>Îáçîð îïðîñîâ</h1>\n");
print("<p><table width=750 border=1 cellspacing=0 cellpadding=5><tr>\n" .
"<td class=colhead align=center>ID</td><td class=colhead>Äîáàâëåí</td><td class=colhead>Âîïðîñ</td></tr>\n");
if (mysql_num_rows($sql) == 0) {
print("<tr><td colspan=3>Èçâèíèòå...Íåò ãîëîñîâàâøèõ ïîëüçîâàòåëåé!</td></tr></table>");
stdfoot();
exit;
}
while ($poll = mysql_fetch_assoc($sql))
{
$added = date("Y-m-d h-i-s",strtotime($poll['added'])) . " GMT (" . (get_elapsed_time(sql_timestamp_to_unix_timestamp($poll["added"]))) . " íàçàä)";
print("<tr><td align=center><a href=\"polloverview.php?id={$poll['id']}\">{$poll['id']}</a></td><td>{$added}</td><td><a href=\"polloverview.php?id={$poll['id']}\">{$poll['question']}</a></td></tr>\n");
}
print("</table>\n");
} else {
if (isset($_GET['id'])) {
$sql = sql_query("SELECT * FROM polls WHERE id = {$pollid} ORDER BY id DESC") or sqlerr(__FILE__, __LINE__);
print("<h1>Îáçîð îïðîñà</h1>\n");
print("<p><table width=750 border=1 cellspacing=0 cellpadding=5><tr>\n" .
"<td class=colhead align=center>ID</td><td class=colhead>Äîáàâëåí</td><td class=colhead>Âîïðîñ</td></tr>\n");
if (mysql_num_rows($sql) == 0) {
print("<tr><td colspan=2>Èçâèíèòå...Íåò îïðîñà ñ òàêèì ID!</td></tr></table>");
stdfoot();
exit;
}
while ($poll = mysql_fetch_assoc($sql))
{
$o = array($poll["option0"], $poll["option1"], $poll["option2"], $poll["option3"], $poll["option4"],
$poll["option5"], $poll["option6"], $poll["option7"], $poll["option8"], $poll["option9"],
$poll["option10"], $poll["option11"], $poll["option12"], $poll["option13"], $poll["option14"],
$poll["option15"], $poll["option16"], $poll["option17"], $poll["option18"], $poll["option19"]);
$added = date("Y-m-d h-i-s",strtotime($poll['added'])) . " GMT (" . (get_elapsed_time(sql_timestamp_to_unix_timestamp($poll["added"]))) . " ago)";
print("<tr><td align=center><a href=\"polloverview.php?id={$poll['id']}\">{$poll['id']}</a></td><td>{$added}</td><td><a href=\"polloverview.php?id={$poll['id']}\">{$poll['question']}</a></td></tr>\n");
}
print("</table><br />\n");
print("<h1>Îáçîð îòâåòîâ</h1><br />\n");
print("<table width=750 border=1 cellspacing=0 cellpadding=5><tr><td class=colhead>Îïöèÿ ¹</td><td class=colhead>Îòâåò</td></tr>\n");
foreach($o as $key=>$value) {
if($value != "")
print("<tr><td>{$key}</td><td>{$value}</td></tr>\n");
}
print("</table>\n");
//print_r($o);
$sql2 = sql_query("SELECT pollanswers. * , users.username FROM pollanswers LEFT JOIN users ON users.id = pollanswers.userid WHERE pollid = {$pollid} AND selection < 20 ORDER BY users.id DESC ") or sqlerr(__FILE__, __LINE__);
print("<h1>Îáçîð ãîëîñîâàâøèõ ïîëüçîâàòåëåé</h1>\n");
print("<p><table width=750 border=1 cellspacing=0 cellpadding=5><tr>\n" .
"<td class=colhead align=center>Ïîëüçîâàòåëü</td><td class=colhead>Âûáîð</td></tr>\n");
if (mysql_num_rows($sql2) == 0) {
print("<tr><td colspan=2>Èçâèíèòå...Íåò ãîëîñîâàâøèõ ïîëüçîâàòåëåé!</td></tr></table>");
stdfoot();
exit;
}
while ($useras = mysql_fetch_assoc($sql2))
{
$username = ($useras['username'] ? $useras['username'] : "Íåèçâåñòíî");
//$useras['selection']--;
print("<tr><td>{$username}</td><td>{$o[$useras['selection']]}</td></tr>\n");
}
print("</table>\n");
}
}
stdfoot();
?>