-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathinvitecode.php
More file actions
36 lines (29 loc) · 824 Bytes
/
invitecode.php
File metadata and controls
36 lines (29 loc) · 824 Bytes
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
<?php
require_once('includes/header.php');
$user = user_isonline();
if ($user === false) {
$smarty->assign(array('tip_title' => _('Login Require'),
'tip_msg' => _('You have to login before access this page')
));
$smarty->display('tip.html');
die();
}
/// 为用户生成足够的验证码,并读取之
$res = db_quick_fetch('invite', "WHERE uid={$user['id']} ORDER BY utime ASC");
for ($i = count($res); $i < INVITECODE_MAXINUM; $i++) {
invite_generate($user['id']);
}
if (count($res) < INVITECODE_MAXINUM) {
$res = db_quick_fetch('invite', "WHERE uid={$user['id']} ORDER BY utime ASC");
}
for ($i = 0; $i < count($res); $i++) {
if ($res[$i]['utime'] == null) {
$res[$i]['used'] = 0;
}
else {
$res[$i]['used'] = 1;
}
}
$smarty->assign('codes', $res);
$smarty->display('invitecode.html');
?>