-
Notifications
You must be signed in to change notification settings - Fork 28
/
achievementhistory.php
101 lines (101 loc) · 4.68 KB
/
achievementhistory.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
<?php
/**
|--------------------------------------------------------------------------|
| https://github.com/Bigjoos/ |
|--------------------------------------------------------------------------|
| Licence Info: GPL |
|--------------------------------------------------------------------------|
| Copyright (C) 2010 U-232 V4 |
|--------------------------------------------------------------------------|
| A bittorrent tracker source based on TBDev.net/tbsource/bytemonsoon. |
|--------------------------------------------------------------------------|
| Project Leaders: Mindless,putyn. |
|--------------------------------------------------------------------------|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/ \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \
( U | - | 2 | 3 | 2 )-( S | o | u | r | c | e )-( C | o | d | e )
\_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/
*/
// Achievements mod by MelvinMeow
require_once (dirname(__FILE__) . DIRECTORY_SEPARATOR . 'include' . DIRECTORY_SEPARATOR . 'bittorrent.php');
require_once (INCL_DIR . 'user_functions.php');
require_once (INCL_DIR . 'pager_functions.php');
require_once (CLASS_DIR . 'page_verify.php');
dbconn();
loggedinorreturn();
$newpage = new page_verify();
$newpage->create('takecounts');
$lang = array_merge(load_language('global') , load_language('achievement_history'));
$HTMLOUT = "";
$id = (int)$_GET["id"];
if (!is_valid_id($id)) stderr($lang['achievement_history_err'], $lang['achievement_history_err1']);
$res = sql_query("SELECT users.id, users.username, usersachiev.achpoints, usersachiev.spentpoints FROM users LEFT JOIN usersachiev ON users.id = usersachiev.id WHERE users.id = " . sqlesc($id)) or sqlerr(__FILE__, __LINE__);
$arr = mysqli_fetch_assoc($res);
if (!$arr) stderr($lang['achievement_history_err'], $lang['achievement_history_err1']);
$achpoints = (int)$arr['achpoints'];
$spentpoints = (int)$arr['spentpoints'];
$res = sql_query("SELECT COUNT(*) FROM achievements WHERE userid =" . sqlesc($id)) or sqlerr(__FILE__, __LINE__);
$row = mysqli_fetch_row($res);
$count = $row[0];
$perpage = 15;
if (!$count) stderr($lang['achievement_history_no'], "{$lang['achievement_history_err2']}<a class='altlink' href='userdetails.php?id=" . (int)$arr['id'] . "'>" . htmlsafechars($arr['username']) . "</a>{$lang['achievement_history_err3']}");
$pager = pager($perpage, $count, "?id=$id&");
if ($id == $CURUSER['id']) {
$HTMLOUT.= "
<div class='row-fluid' align='center'>
<span class='btn btn-small'>
<a href='/achievementlist.php'>{$lang['achievement_history_al']}</a></span>
<span class='btn btn-small'>
<a href='/postcounter.php'>{$lang['achievement_history_fpc']}</a></span>
<span class='btn btn-small'>
<a href='/topiccounter.php'>{$lang['achievement_history_ftc']}</a></span>
<span class='btn btn-small'>
<a href='/invitecounter.php'>{$lang['achievement_history_ic']}</a></span>
</div>
";
}
$HTMLOUT.= "
<div class='row-fluid' align='center'>
<fieldset>
<legend>
{$lang['achievement_history_afu']}
<a class='altlink' href='{$INSTALLER09['baseurl']}/userdetails.php?id=" . (int)$arr['id'] . "'>" . htmlsafechars($arr['username']) . "</a><br />
{$lang['achievement_history_c']}" . htmlsafechars($row['0']) . "{$lang['achievement_history_a']}" . ($row[0] == 1 ? "" : "s") . ".";
if ($id == $CURUSER['id']) {
$HTMLOUT.= "
<a class='altlink' href='achievementbonus.php'>" . htmlsafechars($achpoints) . "{$lang['achievement_history_pa']}" . htmlsafechars($spentpoints) . "{$lang['achievement_history_ps']}</a>
</legend>
";
}
if ($count > $perpage) $HTMLOUT.= $pager['pagertop'];
$HTMLOUT.= "
<div class='row-fluid'>
<table class='table table-bordered '>
<thead>
<tr>
<th>{$lang['achievement_history_award']}</th>
<th>{$lang['achievement_history_descr']}</th>
<th>{$lang['achievement_history_date']}</th>
</tr>
</thead>
";
$res = sql_query("SELECT * FROM achievements WHERE userid=" . sqlesc($id) . " ORDER BY date DESC {$pager['limit']}") or sqlerr(__FILE__, __LINE__);
while ($arr = mysqli_fetch_assoc($res)) {
$HTMLOUT.= "
<tr>
<td><img src='pic/achievements/" . htmlsafechars($arr['icon']) . "' alt='" . htmlsafechars($arr['achievement']) . "' title='" . htmlsafechars($arr['achievement']) . "' /></td>
<td>" . htmlsafechars($arr['description']) . "</td>
<td>" . get_date($arr['date'], '') . "</td>
</tr>
";
}
$HTMLOUT.= "
</table>
</div>
</fieldset>
</div>
";
if ($count > $perpage) $HTMLOUT.= $pager['pagerbottom'];
echo stdhead($lang['achievement_history_stdhead']) . $HTMLOUT . stdfoot();
die;
?>