-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathretitle.php
50 lines (47 loc) · 1.84 KB
/
retitle.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
<?
require_once "common.php";
isnewday(3);
page_header("Retitler");
addnav("G?Zurück zur Grotte","superuser.php");
addnav("W?Zurück zum Weltlichen","village.php");
addnav("Titel neu zuweisen","retitle.php?op=rebuild");
if ($_GET['op']=="rebuild"){
//output("<pre>".htmlentities($titles)."</pre>",true);
//output("<pre>".htmlentities(output_array($titles))."</pre>",true);
// $sql = "SELECT name,title,dragonkills,acctid,sex,ctitle FROM accounts WHERE dragonkills>0";
$sql = "SELECT name,title,dragonkills,acctid,sex,ctitle FROM accounts WHERE 1";
$result = db_query($sql);
for ($i=0;$i<db_num_rows($result);$i++){
$row = db_fetch_assoc($result);
//if ($i==0) echo "x".nl2br(output_array($titles));
$newtitle = $titles[(int)$row['dragonkills']][(int)$row['sex']];
if ($row['ctitle'] == "") {
$oname = $row['name'];
if ($row['title']!=""){
$n = $row['name'];
$x = strpos($n,$row['title']);
if ($x!==false){
$regname=substr($n,$x+strlen($row['title']));
$row['name'] = substr($n,0,$x).$newtitle.$regname;
}else{
$row['name'] = $newtitle." ".$row['name'];
}
}else{
$row[name] = $newtitle." ".$row['name'];
}
}
output("`@Ändere `^$oname`@ auf `^{$row['name']} `@($newtitle-{$row['dragonkills']}[{$row['sex']}]({$row['ctitle']}`@))`n");
if ($session['user']['acctid']==$row['acctid']){
$session['user']['title']=$newtitle;
$session['user']['name']=$row['name'];
}else{
$sql = "UPDATE accounts SET name='".addslashes($row['name'])."', title='".addslashes($newtitle)."' WHERE acctid='{$row['acctid']}'";
//output("`0$sql`n");
(db_query($sql));
}
}
}else{
output("Diese Seite lässt dich alle Usertitel anpassen, wenn die im Drachenscript verändert wurden.");
}
page_footer();
?>