-
Notifications
You must be signed in to change notification settings - Fork 1
/
char_list.php
executable file
·193 lines (143 loc) · 4.28 KB
/
char_list.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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
<?php
/* I codici qui inseriti sono proprietà di
* Francesco Stasi, pertanto ne è vietata la
* vendita e la cessione a terzi senza previa
* autorizzazione dell' autore.
*/
require_once("config.php");
require_once("libs/common.php");
require_once("libs/character_lib.php");
if(!isset($_SESSION))
{
session_start();
}
logged();
$MyChar_obj=new Character(null,$_SESSION['char_name']);
$MyChar_obj->parseFromDb();
if(!($MyChar_obj->exists())){
echo "Personaggio inesistente.";
exit();
}
$modlevel=$MyChar_obj->Account()->getModLevel();
$_SESSION['modlevel']=$modlevel;
if (isset($_REQUEST['term'])){
$charList= new CharacterList();
$charList->readFromDb($_REQUEST['term']);
foreach($charList->getChars() as $k=>$v){
$retarr[$k]=$v->getCharName();
}
echo json_encode($retarr);
exit();
}
if(isset($_REQUEST['character']) || isset($_REQUEST['account']) || isset($_REQUEST['linkList']) ){
$charList= new CharacterList();
if(isset($_REQUEST['character']) && $_REQUEST['character']!=''){
$charList->readFromDb($_REQUEST['character']);
}elseif(isset($_REQUEST['account']) && $_REQUEST['account']!='' && $modlevel>=$avatar_edit_level_required){
$charList->readFromDb(null,null,$_REQUEST['account']);
}elseif(isset($_REQUEST['linkList']) && $_REQUEST['linkList']=='lastSign'){
$charList->readFromDb(null,null,null,20);
}else{
exit();
}
$i=0;
if ($charList->CountChars()<=0){
echo "Nessun risultato soddisfa i criteri di ricerca.\n";
exit();
}
if($modlevel>=$avatar_edit_level_required){
$acc_td="<td>Account</td><td>Creazione Account</td>";
}else{
$acc_td="";
}
echo "<table id=\"char_list_table\">
<tr class=\"".(($i++ % 2 == 0) ? 'even' : 'odd')."\">
<td>Nome</td>
<td>Creazione Pg</td>
$acc_td
</tr>\n";
foreach($charList->getChars() as $k=>$v){
//$v=new Character();
if($modlevel>=$avatar_edit_level_required){
$acc_td="<td>{$v->Account()->getUsername()}</td><td>".itaTime($v->Account()->getJoinDate())."</td>";
}else{
$acc_td="";
}
echo "<tr class=\"".(($i++ % 2 == 0) ? 'even' : 'odd')."\">
<td>{$v->getCharNameLink()}</td>
<td>".itaTime($v->getDate())."</td>
$acc_td
</tr>\n";
}
echo "</table>\n";
exit();
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Lista Utenti</title>
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script type="text/javascript">
$(function() {
$(".linkList").click(function(){
srcT=this.rel;
$.post("char_list.php",
{ linkList: srcT },
function(data) {
$("#charResult").html(data);
$("#charResult a.popUp").click(function(){
parent.showAvatar(this.href);
return false;
});
}
);
return false;
});
$("#listform").submit(function(){
charsrc=$("#srcChar").val();
accsrc=$("#srcAcc").val();
$.post("char_list.php",
{ character: charsrc, account: accsrc },
function(data) {
$("#charResult").html(data);
$("#charResult a.popUp").click(function(){
parent.showAvatar(this.href);
return false;
});
}
);
return false;
});
$( "#srcChar" ).autocomplete({
source: "char_list.php",
minLength: 2,
delay: 200
});
});
</script>
</head>
<body>
<form action="#" method="post" id="listform">
<div id="online_list_container">
<table id="online_list_table">
<tr><td><a href="#" class="linkList" rel="lastSign" >Ultimi 20 Iscritti</a></td><td></td></tr>
<tr><td>Cerca un Personaggio</td><td><input type="text" name="srcChar" id="srcChar" /></td></tr>
<?php
if($modlevel>=$avatar_edit_level_required){
?>
<tr><td>Cerca un Account</td><td><input type="text" name="srcAcc" id="srcAcc" /></td></tr>
<?php
}
?>
<tr><td><input type="submit" value="Cerca"/></td><td></td></tr>
</table>
</div>
</form>
<div id="charResult">
</div>
</body>
</html>