-
Notifications
You must be signed in to change notification settings - Fork 10
/
gift.php
155 lines (155 loc) · 9.29 KB
/
gift.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
<?php
/**
* ------- U-232 Codename Trinity ----------*
* ---------------------------------------------*
* -------- @authors U-232 Team --------------*
* ---------------------------------------------*
* ----- @site https://u-232.duckdns.org/ ----*
* ---------------------------------------------*
* ----- @copyright 2020 U-232 Team ----------*
* ---------------------------------------------*
* ------------ @version V6 ------------------*
*/
require_once(__DIR__.DIRECTORY_SEPARATOR.'include'.DIRECTORY_SEPARATOR.'bittorrent.php');
require_once(INCL_DIR.'user_functions.php');
dbconn();
loggedinorreturn();
$lang = array_merge(load_language('global'));
$xmasday = mktime(0, 0, 0, 12, 25, date("Y"));
$today = mktime(date("G"), date("i"), date("s"), date("m"), date("d"), date("Y"));
$gifts = [
"upload",
"bonus",
"invites",
"bonus2",
];
$randgift = array_rand($gifts);
$gift = $gifts[$randgift];
$userid = 0 + $CURUSER["id"];
if (!is_valid_id($userid)) {
stderr("Error", "Invalid ID");
}
$open = (isset($_GET['open']) ? (int)$_GET['open'] : 0);
if ($open != 1) {
stderr("Error", "Invalid url");
}
($sql = sql_query('SELECT seedbonus, invites, freeslots, uploaded '.'FROM users '.'WHERE id = '.sqlesc($userid))) || sqlerr(__FILE__, __LINE__);
$User = $sql->fetch_assoc();
if (isset($open) && $open == 1) {
if ($today >= $xmasday) {
//if (!($CURUSER["opt1"] & user_options::GOTGIFT)) {
if ($CURUSER["gotgift"] == 'no') {
if ($gift == "upload") {
sql_query("UPDATE users SET invites=invites+1, uploaded=uploaded+1024*1024*1024*10, freeslots=freeslots+1, gotgift='yes' WHERE id=".sqlesc($userid)) || sqlerr(__FILE__,
__LINE__);
$update['invites'] = ($User['invites'] + 1);
$update['uploaded'] = ($User['uploaded'] + 1024 * 1024 * 1024 * 10);
$update['freeslots'] = ($User['freeslots'] + 1);
$cache->update_row($cache_keys['user_stats'].$userid, [
'uploaded' => $update['uploaded'],
], $TRINITY20['expires']['u_stats']);
$cache->update_row($cache_keys['user_statss'].$userid, [
'uploaded' => $update['uploaded'],
], $TRINITY20['expires']['user_stats']);
$cache->update_row($cache_keys['user'].$userid, [
'invites' => $update['invites'],
'freeslots' => $update['freeslots'],
'gotgift' => 'yes',
], $TRINITY20['expires']['user_cache']);
$cache->update_row($cache_keys['my_userid'].$userid, [
'invites' => $update['invites'],
'freeslots' => $update['freeslots'],
'gotgift' => 'yes',
], $TRINITY20['expires']['curuser']);
header('Refresh: 5; url='.$TRINITY20['baseurl'].'/index.php');
stderr("Congratulations!", "<img src=\"{$TRINITY20['pic_base_url']}gift.png\" style=\"float: left; padding-right:10px;\" alt=\"Xmas Gift\" title=\"Xmas Gift\"> <h2> You just got 1 invite 10 GB upload and bonus 1 freeslot !</h2>
Thanks for your support and sharing through year ".date('Y')." ! <br> Merry Christmas and a happy New Year from {$TRINITY20['site_name']} Crew ! Redirecting in 5..4..3..2..1");
}
if ($gift == "bonus") {
sql_query("UPDATE users SET invites=invites+3, seedbonus = seedbonus + 1750, gotgift='yes' WHERE id=".sqlesc($userid)) || sqlerr(__FILE__,
__LINE__);
$update['invites'] = ($User['invites'] + 3);
$update['seedbonus'] = ($User['seedbonus'] + 1750);
$cache->update_row($cache_keys['user_stats'].$userid, [
'seedbonus' => $update['seedbonus'],
], $TRINITY20['expires']['u_stats']);
$cache->update_row($cache_keys['user_statss'].$userid, [
'seedbonus' => $update['seedbonus'],
], $TRINITY20['expires']['user_stats']);
$cache->update_row($cache_keys['user'].$userid, [
'invites' => $update['invites'],
'gotgift' => 'yes',
], $TRINITY20['expires']['user_cache']);
$cache->update_row($cache_keys['my_userid'].$userid, [
'invites' => $update['invites'],
'gotgift' => 'yes',
], $TRINITY20['expires']['curuser']);
header('Refresh: 5; url='.$TRINITY20['baseurl'].'/index.php');
stderr("Congratulations!", "<img src=\"{$TRINITY20['pic_base_url']}gift.png\" style=\"float: left; padding-right:10px;\" alt=\"Xmas Gift\" title=\"Xmas Gift\"> <h2> You just got 3 invites 1750 karma bonus points !</h2>
Thanks for your support and sharing through year ".date('Y')." ! <br> Merry Christmas and a happy New Year from {$TRINITY20['site_name']} Crew ! Redirecting in 5..4..3..2..1");
}
if ($gift == "invites") {
sql_query("UPDATE users SET invites=invites+2, seedbonus = seedbonus + 2000, freeslots=freeslots+3, gotgift='yes' WHERE id=".sqlesc($userid)) || sqlerr(__FILE__,
__LINE__);
$update['invites'] = ($User['invites'] + 2);
$update['seedbonus'] = ($User['seedbonus'] + 2000);
$update['freeslots'] = ($User['freeslots'] + 3);
$cache->update_row($cache_keys['user_stats'].$userid, [
'seedbonus' => $update['seedbonus'],
], $TRINITY20['expires']['u_stats']);
$cache->update_row($cache_keys['user_statss'].$userid, [
'seedbonus' => $update['seedbonus'],
], $TRINITY20['expires']['user_stats']);
$cache->update_row($cache_keys['user'].$userid, [
'invites' => $update['invites'],
'freeslots' => $update['freeslots'],
'gotgift' => 'yes',
], $TRINITY20['expires']['user_cache']);
$cache->update_row($cache_keys['my_userid'].$userid, [
'invites' => $update['invites'],
'freeslots' => $update['freeslots'],
'gotgift' => 'yes',
], $TRINITY20['expires']['curuser']);
header('Refresh: 5; url='.$TRINITY20['baseurl'].'/index.php');
stderr("Congratulations!", "<img src=\"{$TRINITY20['pic_base_url']}gift.png\" style=\"float: left; padding-right:10px;\" alt=\"Xmas Gift\" title=\"Xmas Gift\"> <h2> You just got 2 invites and 2000 bonus points and a bonus 3 freeslots !</h2>
Thanks for your support and sharing through year ".date('Y')." ! <br> Merry Christmas and a happy New Year from {$TRINITY20['site_name']} Crew ! Redirecting in 5..4..3..2..1");
}
if ($gift == "bonus2") {
sql_query("UPDATE users SET invites=invites+3, uploaded=uploaded+1024*1024*1024*20, seedbonus = seedbonus + 2500, freeslots=freeslots+5, gotgift='yes' WHERE id=".sqlesc($userid)) || sqlerr(__FILE__,
__LINE__);
$update['invites'] = ($User['invites'] + 3);
$update['seedbonus'] = ($User['seedbonus'] + 2500);
$update['freeslots'] = ($User['freeslots'] + 5);
$update['uploaded'] = ($User['uploaded'] + 1024 * 1024 * 1024 * 20);
$cache->update_row($cache_keys['user_stats'].$userid, [
'seedbonus' => $update['seedbonus'],
'uploaded' => $update['uploaded'],
], $TRINITY20['expires']['u_stats']);
$cache->update_row($cache_keys['user_statss'].$userid, [
'seedbonus' => $update['seedbonus'],
'uploaded' => $update['uploaded'],
], $TRINITY20['expires']['user_stats']);
$cache->update_row($cache_keys['user'].$userid, [
'invites' => $update['invites'],
'freeslots' => $update['freeslots'],
'gotgift' => 'yes',
], $TRINITY20['expires']['user_cache']);
$cache->update_row($cache_keys['my_userid'].$userid, [
'invites' => $update['invites'],
'freeslots' => $update['freeslots'],
'gotgift' => 'yes',
], $TRINITY20['expires']['curuser']);
header('Refresh: 5; url='.$TRINITY20['baseurl'].'/index.php');
stderr("Congratulations!", "<img src=\"{$TRINITY20['pic_base_url']}gift.png\" style=\"float: left; padding-right:10px;\" alt=\"Xmas Gift\" title=\"Xmas Gift\"> <h2> You just got 3 invites 1750 karma bonus points !</h2>
Thanks for your support and sharing through year ".date('Y')." ! <br> Merry Christmas and a happy New Year from {$TRINITY20['site_name']} Crew ! Redirecting in 5..4..3..2..1");
}
} else {
stderr("Sorry...", "You already got your gift !");
}
} else {
stderr("Doh...", "Be patient! You can't open your present until Christmas day ! <b>".date("z",
($xmasday - $today))."</b> day(s) to go. <br> Today : <b><span style='color:red'>".date('l dS \of F Y h:i:s A',
$today)."</span></b><br>Christmas day : <b><span style='color:green'>".date('l dS \of F Y h:i:s A', $xmasday)."</span></b>");
}
}
?>