-
Notifications
You must be signed in to change notification settings - Fork 9
/
referral.php
72 lines (67 loc) · 2.77 KB
/
referral.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
<?php
// translator ready
// addnews ready
// mail ready
define("ALLOW_ANONYMOUS",true);
require_once("common.php");
require_once("lib/http.php");
tlschema("referral");
if ($session['user']['loggedin']){
page_header("Referral Page");
if (file_exists("lodge.php")) {
addnav("L?Return to the Lodge","lodge.php");
} else {
require_once("lib/villagenav.php");
villagenav();
}
output("You will automatically receive %s points for each person that you refer to this website who makes it to level %s.`n`n", getsetting("refereraward", 25), getsetting("referminlevel", 4));
$url = getsetting("serverurl",
"http://".$_SERVER['SERVER_NAME'] .
($_SERVER['SERVER_PORT']==80?"":":".$_SERVER['SERVER_PORT']) .
dirname($_SERVER['REQUEST_URI']));
if (!preg_match("/\/$/", $url)) {
$url = $url . "/";
savesetting("serverurl", $url);
}
output("How does the site know that I referred a person?`n");
output("Easy! When you tell your friends about this site, give out the following link:`n`n");
output_notl("%sreferral.php?r=%s`n`n",$url,rawurlencode($session['user']['login']));
output("If you do, the site will know that you were the one who sent them here.");
output("When they reach level %s for the first time, you'll get your points!", getsetting("referminlevel", 4));
$sql = "SELECT name,level,refererawarded FROM " . db_prefix("accounts") . " WHERE referer={$session['user']['acctid']} ORDER BY dragonkills,level";
$result = db_query($sql);
$name=translate_inline("Name");
$level=translate_inline("Level");
$awarded=translate_inline("Awarded?");
$yes=translate_inline("`@Yes!`0");
$no=translate_inline("`\$No!`0");
$none=translate_inline("`iNone`i");
output("`n`nAccounts which you referred:`n");
rawoutput("<table border='0' cellpadding='3' cellspacing='0'><tr><td>$name</td><td>$level</td><td>$awarded</td></tr>");
$number=db_num_rows($result);
for ($i=0;$i<$number;$i++){
$row = db_fetch_assoc($result);
rawoutput("<tr class='".($i%2?"trlight":"trdark")."'><td>");
output_notl($row['name']);
rawoutput("</td><td>");
output_notl($row['level']);
rawoutput("</td><td>");
output_notl($row['refererawarded']?$yes:$no);
rawoutput("</td></tr>");
}
if (db_num_rows($result)==0){
rawoutput("<tr><td colspan='3' align='center'>");
output_notl($none);
rawoutput("</td></tr>");
}
rawoutput("</table>",true);
page_footer();
}else{
page_header("Welcome to Legend of the Green Dragon");
output("`@Legend of the Green Dragon is a remake of the classic BBS Door Game Legend of the Red Dragon.");
output("Adventure into the classic realm that was one of the world's very first multiplayer roleplaying games!");
addnav("Create a character","create.php?r=".HTMLEntities(httpget('r'), ENT_COMPAT, getsetting("charset", "ISO-8859-1")));
addnav("Login Page","index.php");
page_footer();
}
?>