-
Notifications
You must be signed in to change notification settings - Fork 27
/
invite.php
38 lines (28 loc) · 959 Bytes
/
invite.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
<?php
require('config.php');
header('Content-type: text/html; charset=utf-8');
if (isset($_POST['p']) && isset($_POST['u'])) {
if (INVITE == 0) {
exit('目前为开放模式,无需邀请');
}
if ($_POST['p'] == INVITE_CODE) {
$user = strtolower($_POST['u'])."\n";
if (is_writable('invited')) {
if (!$handle = fopen('invited', 'a')) {
exit('不能打开受邀用户列表');
}
if (fwrite($handle, $user) == FALSE) {
echo '不能写入到受邀用户列表';
} else {
echo '已将 '.trim($user).' 加入到受邀用户列表';
}
fclose($handle);
} else {
echo '受邀用户列表不可写';
}
exit;
} else {
exit('邀请密码错误');
}
}
?><!doctype html><meta charset="utf-8" /><title>添加受邀用户 - 奶瓶腿!</title><form action="invite.php" method="POST"><label>用户名 <input name="u" /></label> <label>邀请码 <input name="p" /></label> <input type="submit" /></form>