GM-Panel Architektur überarbeitet

- einzelne Funktionen wurden in Dateien ausgelagert
main
radiskull 13 years ago
parent d2f3f64198
commit 2812c1ad80

File diff suppressed because it is too large Load Diff

@ -0,0 +1,320 @@
<?php
function displayAttackeOptions($action, $attackname, $attackid, $depth, $name, $starke, $verteidigung, $speed, $hp, $mp, $rassen, $level, $geld, $type, $info, $req_atk, $req_lvl, $Frucht, $runden, $maxlvl){
if($action === NULL){
?>
<table>
<tr>
<th>Attacken</th>
</tr>
<tr>
<td>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=attacken&action=create">Attacke erstellen</a>
</td>
</tr>
<tr>
<td>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=attacken&action=edit">Attacke editieren</a>
</td>
</tr>
<tr>
<td>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=attacken&action=delete">Attacke l&ouml;schen</a>
</td>
</tr>
<tr>
<td>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a><br>
</td>
</tr>
</table>
<?php
} else if(($action == 'delete' || $action == 'edit') && $attackname === NULL && $attackid === NULL){
?>
<form action="" method="POST">
<input name="choose" value="attacken" type="hidden"></input>
<input name="action" value="<?php echo $action; ?>" type="hidden"></input>
<table>
<tr>
<th colspan="2">Attacke suchen</th>
</tr>
<tr>
<td>
<input name="attackname">
</td>
<td>
<input type="submit" name="suche">
</td>
</tr>
<tr>
<td>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a><br>
</td>
</tr>
</table>
</form>
<?php
} else if(($action == 'delete' || $action == 'edit') && $attackid === NULL){
$qry = mysql_query('Select name,id from attacken where name like \'%'.$attackname.'%\'');
?>
<form action="" method="POST">
<input name="choose" value="attacken" type="hidden"></input>
<input name="action" value="<?php echo $action; ?>" type="hidden"></input>
<?php if($action == 'delete'){ echo '<input name="depth" value="1" type="hidden"></input>'; }?>
<table>
<tr>
<th colspan="2">Attacke ausw&auml;hlen</th>
</tr>
<tr>
<td>
<select name="attackid">
<?php
while($row = mysql_fetch_assoc($qry)){
echo '<option value="'.$row['id'].'">'.$row['name'].'</option>\n';
}
?>
</select>
</td>
<td>
<input type="submit" name="ausw&auml;hlen">
</td>
</tr>
<tr>
<td>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a><br>
</td>
</tr>
</table>
</form>
<?php
} else if(($action == 'create' || $action == 'edit') && $depth === NULL){
if($action == 'edit'){
$row = mysql_fetch_assoc(mysql_query('Select * from attacken where id ='.$attackid));
}
?>
<form action="" method="POST">
<input name="choose" value="attacken" type="hidden"></input>
<input name="action" value="<?php echo $action; ?>" type="hidden"></input>
<input name="attackid" value="<?php echo $attackid; ?>" type="hidden"></input>
<input name="depth" value="1" type="hidden"></input>
<table>
<tr>
<th colspan="2">Attacke</th>
</tr>
<tr>
<td>
ID:
</td>
<td>
<?php echo $attackid; ?>
</td>
</tr>
<tr>
<td>
Name:
</td>
<td>
<input name='attackname' value='<?php echo $row[name]===NULL?'Attackenname':$row[name]; ?>'></input>
</td>
</tr>
<tr>
<td>
St&auml;rke:
</td>
<td>
<input name='starke' value='<?php echo $row[starke]===NULL?0:$row[starke]; ?>'></input>
</td>
</tr>
<tr>
<td>
Verteidigung:
</td>
<td>
<input name='verteidigung' value='<?php echo $row[verteidigung]===NULL?0:$row[verteidigung]; ?>'></input>
</td>
</tr>
<tr>
<td>
Speed:
</td>
<td>
<input name='speed' value='<?php echo $row[speed]===NULL?0:$row[speed]; ?>'></input>
</td>
</tr>
<tr>
<td>
HP:
</td>
<td>
<input name='hp' value='<?php echo $row[hp]===NULL?0:$row[hp]; ?>'></input>
</td>
</tr>
<tr>
<td>
MP:
</td>
<td>
<input name='mp' value='<?php echo $row[mp]===NULL?0:$row[mp]; ?>'></input>
</td>
</tr>
<tr>
<td>
Rassen:
</td>
<td>
<input name='rassen' value='<?php echo $row[rassen]===NULL?0:$row[rassen]; ?>'></input>
</td>
</tr>
<tr>
<td>
Level:
</td>
<td>
<input name='level' value='<?php echo $row[level]===NULL?0:$row[level]; ?>'></input>
</td>
</tr>
<tr>
<td>
Geld:
</td>
<td>
<input name='geld' value='<?php echo $row[geld]===NULL?0:$row[geld]; ?>'></input>
</td>
</tr>
<tr>
<td>
Type:
</td>
<td>
<input name='type' value='<?php echo $row[type]===NULL?'normal':$row[type]; ?>'></input>
</td>
</tr>
<tr>
<td>
Info:
</td>
<td>
<input name='info' value='<?php echo $row[info]===NULL?'No Info available yet!':$row[info]; ?>'></input>
</td>
</tr>
<tr>
<td>
Required Attacks:
</td>
<td>
<input name='req_atk' value='<?php echo $row[req_atk]===NULL?0:$row[req_atk]; ?>'></input>
</td>
</tr>
<tr>
<td>
Required Level:
</td>
<td>
<input name='req_lvl' value='<?php echo $row[req_lvl]===NULL?0:$row[req_lvl]; ?>'></input>
</td>
</tr>
<tr>
<td>
Frucht:
</td>
<td>
<select name = "Frucht">
<?php
// Fuers dropdown
$f_sql = 'SELECT id, item FROM wochen_markt WHERE type = \'Teufels Frucht\' order by item';
$f_qry = mysql_query($f_sql);
// <input name='Frucht' value='<?php echo $row[Frucht]===NULL?0:$row[Frucht]; '></input>
if($row['Frucht'] === NULL || $row['Frucht'] == 0){
echo '<option value="0" selected="selected">-Keine-</option>';
} else {
echo '<option value="0">-Keine-</option>';
}
while($f_row = mysql_fetch_assoc($f_qry)){
if($f_row['id'] == $row['Frucht']){
echo '<option value="'.$f_row['id'].'" selected="selected">'.$f_row['item'].'</option>';
} else{
echo '<option value="'.$f_row['id'].'">'.$f_row['item'].'</option>';
}
}
?>
</select>
</td>
</tr>
<tr>
<td>
Runden:
</td>
<td>
<input name='runden' value='<?php echo $row[runden]===NULL?0:$row[runden]; ?>'></input>
</td>
</tr>
<tr>
<td>
Maxlvl:
</td>
<td>
<input name='maxlvl' value='<?php echo $row['maxlvl']===NULL?0:$row[maxlvl]; ?>'></input>
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" value='<?php echo $action; ?>'></input>
</td>
</tr>
<tr>
<td>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a><br>
</td>
</tr>
</table>
</form>
<?php
} else if($action == 'create' && $depth == 1){
if($Frucht != 0){
$sql = 'INSERT into attacken set name = \''.$attackname.'\', starke = '.$starke.', verteidigung = '.$verteidigung.', speed = '.$speed.', hp = '.$hp.', mp = '.$mp.', rassen = \''.$rassen.'\', level = '.$level.', geld = '.$geld.', type = \''.$type.'\', info = \''.$info.'\', req_atk = \''.$req_atk.'\', req_lvl = \''.$req_lvl.'\', Frucht = '.$Frucht.', runden = '.$runden.', maxlvl = '.$maxlvl;
} else {
$sql = 'INSERT into attacken set name = \''.$attackname.'\', starke = '.$starke.', verteidigung = '.$verteidigung.', speed = '.$speed.', hp = '.$hp.', mp = '.$mp.', rassen = \''.$rassen.'\', level = '.$level.', geld = '.$geld.', type = \''.$type.'\', info = \''.$info.'\', req_atk = \''.$req_atk.'\', req_lvl = \''.$req_lvl.'\', runden = '.$runden.', maxlvl = '.$maxlvl;
}
echo $sql.'<br>';
mysql_query($sql);
logaction('Attacke '.$attackname.' wurde erstellt!');
?>Attacke sollte nun erstellt sein!!<br><a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a><br><?php
} else if($action == 'delete' && $depth >= 1){
if($depth == 4){
$sql = 'Delete from attacken where id = '.$attackid;
// echo 'Debugnachricht: '.$sql.'<br>';
mysql_query($sql);
mysql_query('Delete from lernen where at_id = '.$attackid);
logaction('Attacke mit id = '.$attackid.' wurde geloescht!');
} else{
for($i=0;$i<$depth;$i++){
$wirklich .= 'wirklich ';
}
?>Sind sie sich <?php echo $wirklich; ?> sicher?? <a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=attacken&action=delete&attackid=<?php echo $attackid; ?>&depth=<?php echo $depth+1; ?>">ja</a><br><?php
}
?><a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a><br><?php
} else if($action == 'edit' && $depth == 1){
$row = mysql_fetch_assoc(mysql_query('Select * from attacken where id ='.$attackid));
if($Frucht != 0){
$sql = 'UPDATE attacken set name = \''.htmlspecialchars(urldecode($attackname)).'\', starke = '.$starke.', verteidigung = '.$verteidigung.', speed = '.$speed.', hp = '.$hp.', mp = '.$mp.', rassen = \''.$rassen.'\', level = '.$level.', geld = '.$geld.', type = \''.$type.'\', info = \''.$info.'\', req_atk = \''.$req_atk.'\', req_lvl = \''.$req_lvl.'\', Frucht = '.$Frucht.', runden = '.$runden.', maxlvl = '.$maxlvl.' where id = '.$attackid;
} else {
$sql = 'UPDATE attacken set name = \''.htmlspecialchars(urldecode($attackname)).'\', starke = '.$starke.', verteidigung = '.$verteidigung.', speed = '.$speed.', hp = '.$hp.', mp = '.$mp.', rassen = \''.$rassen.'\', level = '.$level.', geld = '.$geld.', type = \''.$type.'\', info = \''.$info.'\', req_atk = \''.$req_atk.'\', req_lvl = \''.$req_lvl.'\', Frucht = NULL, runden = '.$runden.', maxlvl = '.$maxlvl.' where id = '.$attackid;
}
if($row['name'] != $attackname){
mysql_query('Update lernen set name = \''.$attackname.'\' WHERE at_id ='.$attackid);
}
// echo 'Debugnachricht: '.$sql.'<br>';
mysql_query($sql);
logaction('Attacke mit dem jetzigen Namen '.$attackname.' wurde editiert!');
?><a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=attacken">Zum Attackenmenü</a>, <a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a><br><?php
}
}
?>

@ -0,0 +1,148 @@
<?php /**
* TODO: 2-3 Ansichten
* Sortiert nach erstelldatum, zufällig
* Erstelldatum: User, Char
* Zufällig: User, Char
* Sortiert nach User 20 User pro Seite (Alphabetisch! mit Buchstabenauswahl ;))
*/
function zeigeBilder($begin, $bildurl, $sure, $view, $letter, $date_from, $date_until){
echo '<table>';
$colspan = '';
if($view === NULL){
echo '<tr><th'.$colspan.'>Auf welche Art und Weise m&ouml;chtest du dir die Avatare anzeigen lassen?</th></tr>';
} else if($view == 'ByDate'){
$colspan = ' colspan=9';
echo '<tr><th'.$colspan.'>Avatar nach Datum</th></tr>';
if($date_from == NULL){
$date_from = 'CURRENT_DATE';
} else{
$date_from = '\''.$date_from.'\'';
}
if($date_until == NULL){
$date_until = 'CURRENT_TIMESTAMP';
} else{
$date_until = '\''.$date_until.'\'';
}
echo '<tr><form action="'.$_SERVER['PHP_SELF'].'" method="GET"><input type="hidden" name="choose" value="bilder" /><input type="hidden" name="view" value="ByDate" /><td>Von:<input name="date_from"></td><td>Bis: <input name="date_until"></td><td><input type="submit" name="aktualisieren"></td></form></tr>';
$test = 'SELECT name, nickname, bild FROM chars inner join user on chars.besitzer = user.id where bild != \'design/bilder/avatare/noavart.gif\' and bild != \'\' and bild_edit is not null and bild_edit between '.$date_from.' and '.$date_until.' group by besitzer, bild order by nickname';
// echo $test.'<br>';
$qry = mysql_query($test);
$actual = '';
$i = 0;
while($result = mysql_fetch_assoc($qry)){
if($actual == '' || $result['nickname'] != $actual){
// Fuelle die Leeren Felder aus
for(;$i<8;$i++){
echo '<td></td>';
}
echo '</tr>';
$actual = $result['nickname'];
echo '<tr><td>'.$result['nickname'].'</td>';
}
echo '<td><a href="gm_seite.php?choose=bilder&view=SinglePic&bildurl='.urlencode($result['bild']).'">'.$result['name'].'<br><img src="'.$result['bild'].'" width="75" height="75"></a></td>';
$i++;
}
echo '</tr>';
} else if($view == 'Random'){
$colspan = ' colspan=5';
$sql = 'SELECT name, nickname, bild FROM chars inner join user on chars.besitzer = user.id where besitzer > 2 and bild != \'design/bilder/avatare/noavart.gif\' and bild != \'\' group by bild order by rand() limit 20';
$qry = mysql_query($sql);
echo '<tr><th'.$colspan.'>Avatar Zufall</th></tr>';
for($i=0;$i<4;$i++){
echo '<tr>';
for($t=0;$t<5;$t++){
$tmp = mysql_fetch_assoc($qry);
if($tmp){
echo '<td><a href="gm_seite.php?choose=bilder&view=SinglePic&bildurl='.urlencode($tmp['bild']).'">'.$tmp['name'].'<br><img src="'.$tmp['bild'].'" width="75" height="75"></a></td>';
} else {
echo '<td>&nbsp;</td>';
}
}
echo '</tr>';
}
echo '<tr><td'.$colspan.'><a href="'.$_SERVER['PHP_SELF'].'?choose=bilder&view=Random">weiter</a></td></tr>';
} else if($view == 'ByUser'){
if($begin == NULL){$begin = 0;}
// Die Bilder werden so dargestellt, dass man meherere auf einer seite sehen kann.
// Dabei werden die Bilder jedoch gebündelt, dass keine doppelten urls angezeigt werden
$colspan = ' colspan=9';
echo '<tr><th'.$colspan.'>Sortiert nach Nutzernamen</th></tr>';
echo '<tr><td'.$colspan.'><table width="100%"><tr>';
echo '<td><a href="'.$_SERVER['PHP_SELF'].'?choose=bilder&view=ByUser">Alle</a></td>';
echo '<td><a href="'.$_SERVER['PHP_SELF'].'?choose=bilder&view=ByUser&letter=Numeric">0-9</a></td>';
for($i=ord('A');$i<=ord('Z');$i++){
if($i == ord($letter)){
echo '<td>'.$letter.'</td>';
} else{
echo '<td><a href="'.$_SERVER['PHP_SELF'].'?choose=bilder&view=ByUser&letter='.chr($i).'">'.chr($i).'</a></td>';
}
}
echo '</tr></table></td></tr>';
if($letter == 'Numeric'){
$auser = mysql_query('SELECT distinct(user.nickname) FROM chars inner join user on chars.besitzer = user.id where SUBSTRING(nickname,1,1) < \'a\' and bild != \'design/bilder/avatare/noavart.gif\' and bild != \'\' group by user.id order by nickname ASC LIMIT '.($begin*10).', 10');
$total = mysql_fetch_assoc(mysql_query('SELECT count(distinct(user.id)) as anzahl FROM chars inner join user on chars.besitzer = user.id where SUBSTRING(nickname,1,1) < \'a\' and bild != \'design/bilder/avatare/noavart.gif\' and bild != \'\''));
} else if($letter == null){
$auser = mysql_query('SELECT * FROM chars inner join user on chars.besitzer = user.id where bild != \'design/bilder/avatare/noavart.gif\' and bild != \'\' group by user.id order by nickname ASC LIMIT '.($begin*10).', 10');
$total = mysql_fetch_assoc(mysql_query('SELECT count(distinct(user.id)) as anzahl FROM chars inner join user on chars.besitzer = user.id where bild != \'design/bilder/avatare/noavart.gif\' and bild != \'\''));
} else{
$auser = mysql_query('SELECT * FROM chars inner join user on chars.besitzer = user.id where nickname like \''.$letter.'%\' and bild != \'design/bilder/avatare/noavart.gif\' and bild != \'\' group by user.id order by nickname ASC LIMIT '.($begin*10).', 10');
$total = mysql_fetch_assoc(mysql_query('SELECT count(distinct(user.id)) as anzahl FROM chars inner join user on chars.besitzer = user.id where nickname like \''.$letter.'%\' and bild != \'design/bilder/avatare/noavart.gif\' and bild != \'\''));
}
$total = $total['anzahl'];
$users = array();
while($row = mysql_fetch_assoc($auser)){
// echo 'User: '.$row['id'].'<br>';
$users[] = $row['id'];
}
echo '<td'.$colspan.'><table>'.displayPagelinksNew(10, $total, $begin, '<a href="'.$_SERVER['PHP_SELF'].'?choose=bilder&view=ByUser&letter='.$letter.'&begin=###PAGE###">###LABEL###</a>').'</td>';
$test = 'SELECT name, nickname, bild FROM chars inner join user on chars.besitzer = user.id where besitzer IN ('.join(',', $users).') and bild != \'design/bilder/avatare/noavart.gif\' and bild != \'\' group by besitzer, bild order by nickname';
$qry = mysql_query($test);
$actual = '';
$i = 0;
while($result = mysql_fetch_assoc($qry)){
if($actual == '' || $result['nickname'] != $actual){
// Fuelle die Leeren Felder aus
for(;$i<8;$i++){
echo '<td></td>';
}
echo '</tr>';
$actual = $result['nickname'];
echo '<tr><td>'.$result['nickname'].'</td>';
}
echo '<td><a href="gm_seite.php?choose=bilder&view=SinglePic&bildurl='.urlencode($result['bild']).'">'.$result['name'].'<br><img src="'.$result['bild'].'" width="75" height="75"></a></td>';
$i++;
}
echo '</tr>';
} else if($view == 'SinglePic'){
if($bildurl !== NULL && $sure == 'yes'){
echo '<tr><td>Bild wurde zur&uuml;ckgesetzt</td>';
echo '<td><a href="javascript:history.go(-2);">Zur&uuml;ck</a></td></tr>';
mysql_query('Update chars SET bild=\'\' where bild = \''.urldecode($bildurl).'\' ');
} else if($bildurl !== NULL){
$colspan = ' colspan=2';
$qry = mysql_query('SELECT name, nickname, bild FROM chars inner join user on chars.besitzer = user.id where bild=\''.urldecode($bildurl).'\'');
echo '<tr><td'.$colspan.' align="center">Wollen sie dieses Bild wirklich l&ouml;schen?</td></tr>';
echo '<tr><td'.$colspan.' align="center"><img src="'.$bildurl.'" width="75" height="75"></td></tr>';
echo '<tr><td>Betroffener User</td><td>Betroffener Char</td></tr>';
while($row = mysql_fetch_assoc($qry)) {
echo '<tr><td>'.$row['nickname'].'</td><td>'.$row['name'].'</td></tr>';
}
echo '<tr><td><a href="gm_seite.php?choose=bilder&view=SinglePic&bildurl='.urlencode($bildurl).'&sure=yes">ja</a></td><td><a href="javascript:history.back();">nein</a></td></tr>';
return;
}
}
echo '<tr><td'.$colspan.'><a href="'.$_SERVER['PHP_SELF'].'?choose=bilder&view=ByDate&date_from='.$date_from.'&date_until='.$date_until.'">Nach URL-Aktualisierungsdatum darstellen</a></td></tr>';
echo '<tr><td'.$colspan.'><a href="'.$_SERVER['PHP_SELF'].'?choose=bilder&view=ByUser&letter='.$letter.'">Sortiert nach Nutzername darstellen</a></td></tr>';
echo '<tr><td'.$colspan.'><a href="'.$_SERVER['PHP_SELF'].'?choose=bilder&view=Random">Zufallsanzeige</a></td></tr>';
echo '<tr><td'.$colspan.'><a href="'.$_SERVER['PHP_SELF'].'">Zurueck zum Hauptmenu</a></td></tr>';
echo '</table>';
}
?>

@ -0,0 +1,170 @@
<?php
function displayClanItems($action, $raumid, $raumname, $staerke, $verteidigung, $glueck, $ausdauer, $geschwindigkeit, $info){
if($action == ''){
$raume_qry = mysql_query('SELECT * FROM clan_item order by tp');
?>
<table>
<tr>
<th align="center" colspan="11">Clanr&auml;ume bearbeiten</th>
</tr>
<tr><td>Name</td><td>St&auml;rke</td><td>Verteidigung</td><td>Gl&uuml;ck</td><td>Ausdauer</td><td>Geschwindigkeit</td><td>Kaufpreis</td><td>Miete</td><td>Nutzungsgeb&uuml;hr</td><td>TP</td><td>bearbeiten</td></tr>
<?php
while($res = mysql_fetch_assoc($raume_qry)){
echo '<tr><td>'.$res['name'].'</td><td>'.$res['staerke'].'</td><td>'.$res['verteidigung'].'</td><td>'.$res['glueck'].'</td><td>'.$res['ausdauer'].'</td><td>'.$res['geschwindigkeit'].'</td><td>'.$res['preis'].'</td><td>'.$res['miete'].'</td><td>'.$res['nutzung'].'</td><td>'.$res['tp'].'</td><td><a href="'.$_SERVER['PHP_SELF'].'?choose=clanitems&action=edit&raumid='.$res['id'].'">edit</a> | <a href="'.$_SERVER['PHP_SELF'].'?choose=clanitems&action=delete&raumid='.$res['id'].'">delete</a></td></tr>';
}
?>
<tr>
<td align="center" colspan="11">
<a href="<?php echo $_SERVER['PHP_SELF'].'?choose=clanitems&action=create'; ?>">Raum erstellen</a>
</td>
</tr>
<tr>
<td align="center" colspan="11">
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a>
</td>
</tr>
</table>
<?php
} else if($action == 'edit' || $action == 'create'){
if($raumname !== NULL){ // Sprich es wurde was geaendert!
// Berechne den TP Verbrauch
$b38 = 1.3; // Parameter aus Exceltabelle
$c38 = 0.3;
$g3 = ($staerke!=0?1:0) + ($verteidigung!=0?1:0) + ($glueck!=0?1:0) + ($ausdauer!=0?1:0) + ($geschwindigkeit!=0?1:0);
$summe_werte = ($staerke+$verteidigung+$glueck+$ausdauer+$geschwindigkeit);
$tp = round($summe_werte * (pow($b38,$g3)-$c38));
// Berechne Kaufpreis
$b33 = 1.1; // Parameter aus Exceltabelle
$c33 = 3000;
$kaufpreis = round(pow($b33,$summe_werte) * $c33);
// Berechne Miete
$b42=0.5; $c42=2; $d42=4; $e42=2; $f42=1; $g42=5; $h42=6; $i42=1.9; $j42=100;
$gewichtete_summe= $ausdauer*$b42+$staerke*$c42+$verteidigung*$d42+$geschwindigkeit*$e42+$glueck*$f42;
$miete = floor(pow($i42,log($gewichtete_summe,$h42)*$g42)*$j42/7); // Durch sieben (weil 7 Chars pro User)
// Berechne Nutzungsgebuehr
$b46 = 100; $c46 = 0.69; $d46 = -1762;
$nutz = floor(($miete*7*0.7)/log($gewichtete_summe, $b46)*$c46+$d46);
// Und jetzt poliere die Preise optisch etwas auf
$stepkp = round(pow(10,floor(max(log10($kaufpreis),2)))/4);
$stepmp = round(pow(10,floor(max(log10($miete),2)))/4);
$stepnp = round(pow(10,floor(max(log10($nutz),2)))/4);
$kaufpreis = round($kaufpreis/$stepkp)*$stepkp;
$miete = ceil($miete/$stepmp)*$stepmp;
$nutz = ceil($nutz/$stepnp)*$stepnp;
// So und nun kann weiter gemacht werden!
if($action == 'edit'){
logaction('Der Raum '.$raumname.' wurde editiert!');
mysql_query('Update clan_item set name = \''.$raumname.'\', staerke = '.$staerke.', verteidigung = '.$verteidigung.', ausdauer = '.$ausdauer.', geschwindigkeit = '.$geschwindigkeit.', glueck = '.$glueck.', preis = '.$kaufpreis.', miete = '.$miete.', nutzung = '.$nutz.', tp = '.$tp.', info = \''.$info.'\' where id = '.$raumid.'');
} else if($action == 'create'){
logaction('Der Raum '.$raumname.' wurde erstellt!');
mysql_query('INSERT INTO clan_item(name, staerke, verteidigung, ausdauer, geschwindigkeit, glueck, preis, miete, nutzung, tp, info) values(\''.$raumname.'\', '.$staerke.', '.$verteidigung.', '.$ausdauer.', '.$geschwindigkeit.', '.$glueck.', '.$kaufpreis.', '.$miete.', '.$nutz.', '.$tp.', \''.$info.'\')');
}
}
if($action == 'edit'){
$raum = mysql_fetch_assoc(mysql_query('SELECT * FROM clan_item WHERE id = '.$raumid));
$aLabel = 'editieren';
} else{
$aLabel = 'erstellen';
}
?>
<form action="" method="POST">
<input name="choose" value="clanitems" type="hidden"></input>
<input name="action" value="<?php echo $action; ?>" type="hidden"></input>
<input name="raumid" value="<?php echo $raumid; ?>" type="hidden"></input>
<table>
<tr>
<th align="center" colspan="2">Clanr&auml;ume <?php echo $aLabel; ?></th>
</tr>
<tr>
<td>Name</td><td><input type="text" class="text" name="raumname" value="<?php echo $raum['name']; ?>" /></td>
</tr>
<tr>
<td>St&auml;rke</td><td><input type="text" class="text" name="staerke" value="<?php echo $raum['staerke']; ?>" /></td>
</tr>
<tr>
<td>Verteidigung</td><td><input type="text" class="text" name="verteidigung" value="<?php echo $raum['verteidigung']; ?>" /></td>
</tr>
<tr>
<td>Gl&uuml;ck</td><td><input type="text" class="text" name="glueck" value="<?php echo $raum['glueck']; ?>" /></td>
</tr>
<tr>
<td>Ausdauer</td><td><input type="text" class="text" name="ausdauer" value="<?php echo $raum['ausdauer']; ?>" /></td>
</tr>
<tr>
<td>Geschwindigkeit</td><td><input type="text" class="text" name="geschwindigkeit" value="<?php echo $raum['geschwindigkeit']; ?>" /></td>
</tr>
<tr>
<td>Kaufpreis</td><td><?php echo $raum['preis']; ?></td>
</tr>
<tr>
<td>Miete</td><td><?php echo $raum['miete']; ?></td>
</tr>
<tr>
<td>Nutzungsgeb&uuml;hr</td><td><?php echo $raum['nutzung']; ?></td>
</tr>
<tr>
<td>Trainingspunkte</td><td><?php echo $raum['tp']; ?></td>
</tr>
<tr>
<td>Info</td><td><textarea name="info" rows="10" cols="50"><?php echo $raum['info']; ?></textarea></td>
</tr>
<tr>
<td align="center" colspan="2"><input type="submit" /></td>
</tr>
<tr>
<td align="center" colspan="2">
<a href="<?php echo $_SERVER['PHP_SELF'].'?choose=clanitems'; ?>">Zur &Uuml;bersicht</a>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a>
</td>
</tr>
</table>
</form>
<?php
} else if($action == 'delete'){
?>
<table>
<?php
if($raumname !== NULL){
mysql_query('DELETE FROM clan_item WHERE id = '.$raumid);
mysql_query('DELETE FROM clan_ware where item_id ='.$raumid);
?>
<tr>
<td align="center" colspan="2">
Der Raum "<?php echo $raumname; ?>" wurde gel&ouml;scht
</td>
</tr>
<?php
} else{
$res = mysql_fetch_assoc(mysql_query('SELECT * FROM clan_item WHERE id = '.$raumid));
?>
<tr>
<td align="center" colspan="2">
Den Raum "<?php echo $res['name']; ?>" wirklich l&ouml;schen? <a href="<?php echo $_SERVER['PHP_SELF'].'?choose=clanitems&action=delete&raumid='.$raumid.'&raumname='.$res['name']; ?>">L&ouml;schen best&auml;tigen!</a>
</td>
</tr>
<?php
}
?>
<tr>
<td align="center" colspan="2">
<a href="<?php echo $_SERVER['PHP_SELF'].'?choose=clanitems'; ?>">Zur &Uuml;bersicht</a>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a>
</td>
</tr>
</table>
<?php
}
}
?>

@ -0,0 +1,485 @@
<?php
function displayFaq($action, $faqentry,$parent,$header,$body, $child){
$themes = getTableOfContents('<option value="###ID###">','</option>');
if($action == 'confirm'){
$header = urldecode($header);
$body = urldecode($body);
updateEntry($faqentry,$parent,$header,$body);
logaction('Faqeintrag '.$faqentry.' angepasst!');
echo '&Auml;nderungen gespeichert!';
displayFaq('edit', $faqentry,$parent,$header,$body,null);
} else if($action == 'insert'){
$header = urldecode($header);
$body = urldecode($body);
insertFaqEntry($parent, $header, $body);
logaction('Faqeintrag bei '.$parent.' hinzugefuegt!');
echo 'Datensatz eingef&uuml;gt!';
displayFaq(null, null,null,null,null,null);
} else if($action == 'moveup'){
moveUp($child);
logaction('Faqeintrag '.$child.' verschoben!');
displayFaq('edit', $faqentry,null,null,null,null);
} else if($action == 'movedown'){
moveDown($child);
logaction('Faqeintrag '.$child.' verschoben!');
displayFaq('edit', $faqentry,null,null,null,null);
} else if($action == 'create'){
?>
<form action="" method="POST">
<input name="choose" value="faq" type="hidden"></input>
<input name="action" value="insert" type="hidden"></input>
<table>
<tr>
<th colspan="2">FAQ Bearbeitung</th>
</tr>
<tr>
<td>
Vaterknoten
</td>
<td>
<select name="parent">
<option value="0"></option>
<?php echo $themes; ?>
</select>
</td>
</tr>
<tr>
<td>
Titel
</td>
<td>
<input name="header" value="" size="50"></input>
</td>
</tr>
<tr>
<td>
Text
</td>
<td>
<textarea name="body" cols="50" rows="10"></textarea>
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" value="einf&uuml;gen"></input>
</td>
</tr>
<tr>
<td colspan="2">
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=faq">Zur &Uuml;bersicht</a><br>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a><br>
</td>
</tr>
</table>
</form>
<?php
} else if($action == 'edit'){
$entry = getEntry($faqentry);
?>
<form action="" method="POST">
<input name="choose" value="faq" type="hidden"></input>
<input name="action" value="confirm" type="hidden"></input>
<input name="faqentry" value="<?php echo $faqentry; ?>" type="hidden"></input>
<table>
<tr>
<th colspan="2">FAQ Bearbeitung</th>
</tr>
<tr>
<td>
Vaterknoten
</td>
<td>
<select name="parent">
<option value="">Keine &Auml;nderung</option>
<option value="0"></option>
<?php echo $themes; ?>
</select>
</td>
</tr>
<tr>
<td>
Titel
</td>
<td>
<input name="header" value="<?php echo debbcode($entry['header']); ?>" size="50"></input>
</td>
</tr>
<tr>
<td>
Text
</td>
<td>
<textarea name="body" cols="50" rows="10"><?php echo debbcode($entry['body']); ?></textarea>
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" value="speichern"></input>
</td>
</tr>
<tr>
<td>
<?php
$results = getChildren($faqentry);
for($i=0;$i<count($results);$i++){
$urlhoch = $_SERVER['PHP_SELF'].'?choose=faq&faqentry='.$faqentry.'&action=moveup&child='.$results[$i]['id'];
$urldown = $_SERVER['PHP_SELF'].'?choose=faq&faqentry='.$faqentry.'&action=movedown&child='.$results[$i]['id'];
echo $results[$i]['header'].' <a href="'.$urlhoch.'">hoch</a> <a href="'.$urldown.'">down</a><br>';
}
?>
</td>
</tr>
<tr>
<td colspan="2">
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=faq">Zur &Uuml;bersicht</a><br>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a><br>
</td>
</tr>
</table>
</form>
<?php
} else{
?>
<form action="" method="POST">
<input name="choose" value="faq" type="hidden"></input>
<input name="action" value="edit" type="hidden"></input>
<table>
<tr>
<th>FAQ Bearbeitung</th>
</tr>
<tr>
<td>
<select name="faqentry">
<option value="0">Vaterknoten</option>
<?php echo $themes; ?>
</select>
</td>
</tr>
<tr>
<td>
<input type="submit" value="bearbeiten"></input>
</td>
</tr>
<tr>
<td>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=faq&action=create">Neuen Eintrag erstellen</a><br>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a><br>
</td>
</tr>
</table>
</form>
<?php
}
}
function displayNews($action, $username, $newsid, $header, $value){
if($action == 'create' && $header !== NULL){
if($header !== null && $value !== null){
$header = addslashes($header);
$value = urldecode($value);
$value = encodeNoHTMLWithBB($value);
mysql_query('INSERT INTO ff11_news(name, betreff, text, zeit, datum)' .
' values(\''.$username.'\',\''.$header.'\',\''.$value.'\',CURRENT_TIME, CURRENT_DATE)');
if(mysql_affected_rows() > 0){
logaction('News '.$header.' wurde erstellt!');
echo 'news erfolgreich erstellt!<br>';
} else {
echo 'news erstellen fehlgeschlagen!<br>';
}
}
} else if($action == 'edit' && $header !== NULL){
$header = addslashes($header);
$value = urldecode($value);
$value = encodeNoHTMLWithBB($value);
$sql = 'UPDATE ff11_news set betreff = \''.$header.'\', text = \''.$value.'\' where id ='.$newsid;
echo $sql.'<br>';
mysql_query($sql);
if(mysql_affected_rows() > 0){
logaction('News '.$header.' wurde editiert!');
echo 'news erfolgreich editiert!<br>';
} else {
echo 'news editieren fehlgeschlagen!<br>';
}
}
if($action == 'create' || ($action == 'edit' && $newsid !== NULL)){
if($action == 'create'){
$topic = 'Neuen Newseintrag erstellen';
$buttonval = 'erstellen';
} else{
$topic = 'Newseintrag editieren';
$row = mysql_fetch_assoc(mysql_query('Select * from ff11_news where id = '.$newsid));
$header = debbcode($row['betreff']);
$value = debbcode($row['text']);
$buttonval = 'editieren';
}
?>
<form action="" method="POST">
<input name="choose" value="news" type="hidden"></input>
<input name="action" value="<?php echo $action; ?>" type="hidden"></input>
<input name="newsid" value="<?php echo $newsid; ?>" type="hidden"></input>
<table>
<tr>
<th colspan="2"><?php echo $topic; ?></th>
</tr>
<tr>
<td>
&Uuml;berschrift:
</td>
</tr>
<tr>
<td>
<input name="header" value="<?php echo $header; ?>"></input>
</td>
</tr>
<tr>
<td>
Text:
</td>
</tr>
<tr>
<td>
<textarea name="value" rows="10" cols="50"><?php echo $value; ?></textarea>
</td>
</tr>
<tr>
<td>
<input type="submit" value="<?php echo $buttonval; ?>"></input>
</td>
</tr>
<tr>
<td align="center">
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a>
</td>
</tr>
</table>
</form>
<?php
} else if($action == 'edit'){
$qry = mysql_query('Select * from ff11_news order by id desc');
?>
<table>
<tr>
<th>News bearbeiten (Auswahl)</th>
</tr>
<?php
while($row = mysql_fetch_assoc($qry)){
?>
<tr>
<td>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=news&action=edit&newsid=<?php echo $row['id']; ?>"><?php echo $row['betreff']; ?></a>
</td>
</tr>
<?php
}
?>
<tr>
<td align="center">
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=news">Zum Newsmenu</a>
</td>
</tr>
<tr>
<td align="center">
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a>
</td>
</tr>
</table>
<?php
} else{
?>
<table>
<tr>
<th>News bearbeiten</th>
</tr>
<tr>
<td>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=news&action=create">Newseintrag erstellen</a>
</td>
</tr>
<tr>
<td>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=news&action=edit">Newseintrag editieren</a>
</td>
</tr>
<tr>
<td align="center">
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a>
</td>
</tr>
</table>
<?php
}
}
function displayPolls($action,$openumfrage,$closeumfrage,$thema,$optionen,$text,$pollid){
if($action == NULL){
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<input type="hidden" name="choose" value="poll"></input>
<input type="hidden" name="action" value="display"></input>
<table>
<tr>
<td>
Offene Umfragen
</td>
<td>
<select name="openumfrage">
<option value="-1">---Bitte Ausw&auml;hlen---</option>
<?php
$qry = mysql_query('SELECT * from poll WHERE TIMESTAMPDIFF(Minute, close, now()) <= 0 || close is null');
while($result = mysql_fetch_assoc($qry)){
echo '<option value="'.$result[pollid].'">'.$result[thema].'</option>';
}
?>
</select>
</td>
</tr>
<tr>
<td>
Abgeschlossene Umfragen
</td>
<td>
<select name="closeumfrage">
<option value="-1">---Bitte Ausw&auml;hlen---</option>
<?php
$qry = mysql_query('SELECT * from poll WHERE TIMESTAMPDIFF(Minute, close, now()) > 0');
while($result = mysql_fetch_assoc($qry)){
echo '<option value="'.$result[pollid].'">'.$result[thema].'</option>';
}
?>
</select>
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" value="&Ouml;ffne Umfrage">
</td>
</tr>
<tr>
<td colspan="2">
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=poll&action=create">Erstelle neue Umfrage</a>
</td>
</tr>
<tr>
<td colspan="2">
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a>
</td>
</tr>
</table>
</form>
<?php
} else if($action == 'display'){
if(is_numeric($openumfrage) && $openumfrage != -1){
$pollid = $openumfrage;
}
if(is_numeric($closeumfrage) && $closeumfrage != -1){
$pollid = $closeumfrage;
}
if(is_numeric($pollid) && $pollid >= 0){
$result = mysql_fetch_assoc(mysql_query('SELECT * FROM poll WHERE pollid='.$pollid));
$qry = mysql_query('SELECT * FROM poll_options WHERE pollid='.$pollid);
while($opts = mysql_fetch_assoc($qry)){
$options[$opts[polloptionid]] = $opts[text];
}
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<input type="hidden" name="choose" value="poll"></input>
<input type="hidden" name="action" value="update"></input>
<input type="hidden" name="pollid" value="<?php echo $result[pollid]; ?>"></input>
<table>
<tr>
<td>Thema</td>
<td><input name="thema" value="<?php echo $result[thema]; ?>"></input></td>
</tr>
<?php
for($i=0;$i<5;$i++){
?>
<tr>
<td>Option <?php echo $i+1; ?></td>
<td><input name="optionen[<?php echo $i; ?>]" value="<?php echo $options[$i]; ?>"></input></td>
</tr>
<?php
}
?>
<tr>
<td colspan="2">
<textarea name="text" cols="50" rows="10"><?php echo $result[text]; ?></textarea>
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" value="&Auml;nderungen &uuml;bernehmen!"></input>
</td>
</tr>
<tr>
<td>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=bann">Zur &Uuml;bersicht</a>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a>
</td>
</tr>
</table>
</form>
<?php
}
} else if($action == 'create'){
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<input type="hidden" name="choose" value="poll"></input>
<input type="hidden" name="action" value="save"></input>
<table>
<tr>
<td>Thema</td>
<td><input name="thema"></input></td>
</tr>
<?php
for($i=0;$i<5;$i++){
?>
<tr>
<td>Option <?php echo $i+1; ?></td>
<td><input name="optionen[<?php echo $i; ?>]"></input></td>
</tr>
<?php
}
?>
<tr>
<td colspan="2">
<textarea name="text" cols="50" rows="10">Hier ein Kommentar!</textarea>
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" value="Umfrage erstellen!"></input>
</td>
</tr>
<tr>
<td>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=bann">Zur &Uuml;bersicht</a>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a>
</td>
</tr>
</table>
</form>
<?php
} else if($action == 'save'){
mysql_query('INSERT INTO poll(ersteller, thema, open, close, text) values('.$_SESSION['user'].',\''.$thema.'\',now(),NULL,\''.$text.'\')');
$pollid = mysql_fetch_assoc(mysql_query('SELECT pollid FROM poll WHERE text=\''.$text.'\''));
for($i=0;$i<5;$i++){
if($optionen[$i] != null){
mysql_query('INSERT INTO poll_options(pollid, polloptionid, text) values('.$pollid['pollid'].','.$i.',\''.$optionen[$i].'\')');
}
}
displayPolls('display',NULL, NULL,NULL,NULL,NULL,$pollid[pollid]);
} else if($action == 'update'){
mysql_query('UPDATE poll set thema =\''.$thema.'\', text =\''.$text.'\' WHERE pollid ='.$pollid);
for($i=0;$i<5;$i++){
if($optionen[$i] != null){
$sql = 'UPDATE poll_options SET text =\''.$optionen[$i].'\' WHERE pollid='.$pollid.' AND polloptionid ='.$i;
mysql_query($sql);
echo $sql.'<br>';
}
}
displayPolls('display',NULL, NULL,NULL,NULL,NULL,$pollid);
} else{
echo 'BUG!! Mal wieder!!';
}
}
?>

@ -0,0 +1,351 @@
<?php
function displayItems($action, $task, $itemid, $itemtable, $searchstring, $s_itemtable,$page, $data){
if(!is_numeric($page) || $page < 0){ $page = 0; }
$error = false;
$colspan = 1;
echo '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">'."\n";
echo "\t".'<input type="hidden" name="choose" value="items"></input>'."\n";
echo "\t\t".'<table width="80%">'."\n";
if($action == 'edit'){
// Change or delte
echo "\t".'<input type="hidden" name="action" value="edit"></input>'."\n";
echo "\t".'<input type="hidden" name="searchstring" value="'.$searchstring.'"></input>'."\n";
if(is_null($itemid) || is_null($itemtable) ){
echo "\t".'<input type="hidden" name="page" value="0"></input>'."\n";
// Display overview
if($s_itemtable == 'item'){
$sql = 'SELECT i.id, i.name, \'item\' as tablename FROM item i';
} else if($s_itemtable == 'sp_item'){
$sql = 'SELECT i.id, i.name, \'sp_item\' as tablename FROM sp_item i';
} else if($s_itemtable == 'wochen_markt'){
$sql = 'SELECT i.id, i.item AS name, \'wochen_markt\' as tablename FROM wochen_markt i';
} else{
$sql = 'SELECT i.id, i.name, \'item\' as tablename FROM item i'
. ' union'
. ' SELECT i.id, i.name, \'sp_item\' as tablename FROM sp_item i'
. ' union'
. ' SELECT i.id, i.item AS name, \'wochen_markt\' as tablename FROM wochen_markt i';
}
$qry = mysql_query($sql.' LIMIT '.($page*20).', 20');
// echo $sql.' LIMIT '.($page*30).', 30';
$anzahlSeiten = ceil(mysql_num_rows(mysql_query($sql))/20);
$colspan = 3;
echo "\t\t\t".'<tr><td colspan="'.$colspan.'"><h1 style="text-align:center">Bearbeiten</h1></td></tr>'."\n";;
$o_array = array('-Alle-', 'Markt Items', 'Schatzsuche Items', 'Auktionsitems');
$o_tblarray = array('', 'item', 'sp_item', 'wochen_markt');
echo "\t\t\t".'<tr><td colspan="'.$colspan.'">Suche eingrenzen:<select name="s_itemtable">';
for($i=0;$i<count($o_tblarray);$i++){
if($o_tblarray[$i] == $s_itemtable){
$selected = ' selected="selected"';
} else{
$selected = '';
}
echo '<option value="'.$o_tblarray[$i].'"'.$selected.'>'.$o_array[$i].'</option>';
}
echo "\t\t\t".' <input type="submit" value="filtern"></td></tr>';
echo "\t\t\t".'<tr><td colspan="'.$colspan.'"><hr></td></tr>'."\n";
while($row = mysql_fetch_assoc($qry)){
echo "\t\t\t".'<tr><td>'.$row['name'].'</td><td width="10"><a href="'.$_SERVER['PHP_SELF'].'?choose=items&action=edit&task=change&itemid='.$row['id'].'&itemtable='.$row['tablename'].'&searchstring='.$searchstring.'&s_itemtable='.$s_itemtable.'&page='.$page.'">Edit</a></td>';
echo '<td width="10"><a href="'.$_SERVER['PHP_SELF'].'?choose=items&action=edit&task=delete&itemid='.$row['id'].'&itemtable='.$row['tablename'].'&searchstring='.$searchstring.'&s_itemtable='.$s_itemtable.'&page='.$page.'">Delete</a></td></tr>'."\n";
}
echo "\t\t\t".'<tr><td colspan="'.$colspan.'"><hr></td></tr>'."\n";
echo "\t\t\t".'<tr><td colspan="'.$colspan.'">'.displayPagelinks($page, $anzahlSeiten , '<a href="'.$_SERVER['PHP_SELF'].'?choose=items&action=edit&itemtable='.$itemtable.'&searchstring='.$searchstring.'&s_itemtable='.$s_itemtable.'&page=###PAGE###">###LABEL###</a>').'</td></tr>';
} else if($task == 'change'){
$d_array = array();
echo "\t".'<input type="hidden" name="page" value="'.$page.'"></input>'."\n";
echo "\t".'<input type="hidden" name="task" value="dochange"></input>'."\n";
echo "\t".'<input type="hidden" name="itemid" value="'.$itemid.'"></input>'."\n";
echo "\t".'<input type="hidden" name="itemtable" value="'.$itemtable.'"></input>'."\n";
$colspan = 2;
echo "\t\t\t".'<tr><td colspan="'.$colspan.'"><h1 style="text-align:center">Editieren</h1></td></tr>'."\n";
if($itemtable == 'item'){
$d_array = array('id','name','hp','mp','starke','verteidigung','speed','s_type','preis','anzahl','type','level','info');
$desc_array = array('ID', 'Name', 'HP', 'MP', 'Bonus Stärke', 'Bonus Verteidigung', 'Bonus Geschwindigkeit', 'Art (Item, Helm, ..)', 'Preis im Markt', 'Anzahl', 'Rassen (ALL, Onepiece, Dragonball)', 'Level', 'Infotext');
} else if($itemtable == 'sp_item'){
$d_array = array('id','name','preis','wert','type','slot','info');
$desc_array = array('ID', 'Name', 'Preis', 'Häufigkeit (je höher desto seltener)', '"Teufels Frucht" oder nicht', 'Slot (immer auf 0 setzen)', 'Infotext');
} else if($itemtable == 'wochen_markt'){
$d_array = array('id','item','starke','ver','speed','ausdauer','hp','mp','glueck','type','preis','anzahl','verteilung','aktiv','art','kategorie','info');
$desc_array = array('ID', 'Name', 'Bonus Stärke', 'Bonus Verteidigung', 'Bonus Geschwindigkeit', 'Bonus Ausdauer', 'Bonus HP', 'Bonus MP', 'Bonus Glück', 'Typ ("Teufels Frucht")', 'Preis', 'Anzahl', 'Verteilung (0=Nicht wünschbar, Summe Verteilung sollte 100 ergeben!!)', 'Kann bei Geheimauktion auftreten', 'Art (normal, natur)', 'Kategorie (Logia, Zoan, ...)','Infotext' );
} else{
// Something went completely wrong!!
$error = true;
}
if(!$error){
$sql = 'SELECT '.join(',', $d_array).' FROM '.$itemtable.' where id = '.$itemid;
$qry = mysql_query($sql);
$row = mysql_fetch_assoc($qry);
echo "\t\t".'<tr><td>'.$desc_array[0].'</td><td style="text-align:center">'.$row[$d_array[0]].'</td></tr>'."\n";
for($i = 1;$i<count($d_array)-1;$i++){
echo "\t\t".'<tr><td>'.$desc_array[$i].'</td><td style="text-align:center"><input name="data['.$d_array[$i].']" value="'.debbcode($row[$d_array[$i]]).'"></input></td></tr>'."\n";
}
// Infotext
echo "\t\t\t".'<tr><td>'.$desc_array[$i].'</td><td style="text-align:center"><textarea name="data['.$d_array[$i].']" cols="30" rows="5">'.debbcode($row[$d_array[$i]]).'</textarea></td></tr>'."\n";
echo "\t\t\t".'<td colspan="'.$colspan.'" style="text-align:center"><input type="submit" value="ändern"></td></tr>'."\n";
echo "\t\t\t".'<tr><td align="center" colspan="'.$colspan.'"><a href="'.$_SERVER['PHP_SELF'].'?choose=items&action=edit&s_itemtable='.$s_itemtable.'&searchstring='.$searchstring.'&page='.$page.'">Zurück zur Übersicht</a></td></tr>'."\n";
}
} else if($task == 'delete'){
echo "\t".'<input type="hidden" name="page" value="'.$page.'"></input>'."\n";
$colspan = 1;
echo "\t\t\t".'<tr><td colspan="'.$colspan.'"><h1 style="text-align:center">Löschen</h1></td></tr>'."\n";
if($itemtable == 'item'){
$sql = 'SELECT i.id, i.name, \'item\' as tablename FROM item i WHERE id ='.$itemid;
} else if($itemtable == 'sp_item'){
$sql = 'SELECT i.id, i.name, \'sp_item\' as tablename FROM sp_item i WHERE id ='.$itemid;
}else if($itemtable == 'wochen_markt'){
$sql = 'SELECT i.id, i.item AS name, \'wochen_markt\' as tablename FROM wochen_markt i WHERE id ='.$itemid;
} else{
// Something went completely wrong!!
$error = true;
}
if(!is_numeric($itemid)){
$error = true;
}
if(!$error){
$row = mysql_fetch_assoc(mysql_query($sql));
echo "\t\t\t".'<tr><td colspan="'.$colspan.'" style="text-align:center">Soll Item "'.$row['name'].'" wirklich gelöscht werden?</td></tr>'."\n";
echo "\t\t\t".'<tr><td style="text-align:center"><a href="'.$_SERVER['PHP_SELF'].'?choose=items&action=edit&task=dodelete&itemid='.$itemid.'&itemtable='.$itemtable.'&s_itemtable='.$s_itemtable.'&searchstring='.$searchstring.'&page='.$page.'">ja</a>, <a href="'.$_SERVER['PHP_SELF'].'?choose=items&action=edit&s_itemtable='.$s_itemtable.'&searchstring='.$searchstring.'&page='.$page.'">nein</a>, <a href="'.$_SERVER['PHP_SELF'].'?choose=items&action=edit&task=delete&itemid='.$itemid.'&itemtable='.$itemtable.'&s_itemtable='.$s_itemtable.'&searchstring='.$searchstring.'&page='.$page.'">vielleicht</a></td></tr>'."\n";
}
} else if($task == 'dochange'){
// d_array[0] muss name sein!!
if($itemtable == 'item'){
$d_array = array('name','hp','mp','starke','verteidigung','speed','s_type','preis','anzahl','type','level','info');
} else if($itemtable == 'sp_item'){
$d_array = array('name','preis','wert','type','slot','info');
} else if($itemtable == 'wochen_markt'){
$d_array = array('item','starke','ver','speed','ausdauer','hp','mp','glueck','type','preis','anzahl','verteilung','aktiv','art','kategorie','info');
} else{
// Something went completely wrong!!
$error = true;
}
if(!$error){
$sql = 'UPDATE '.$itemtable.' SET ';
$row = mysql_fetch_assoc(mysql_query('Select '.$d_array[0].' from '.$itemtable.' WHERE id = '.$itemid));
$sql .= $d_array[0].' = \''.encodeNoHTMLWithBB($data[$d_array[0]]).'\'';
for($i=1;$i<count($d_array);$i++){
$sql .= ', '. $d_array[$i].' = \''.encodeNoHTMLWithBB($data[$d_array[$i]]).'\'';
}
$sql .= ' WHERE id=\''.$itemid.'\'';
// echo $sql.'<br>';
$u = mysql_query($sql);
if(mysql_affected_rows() == 0 || $u === FALSE){
echo "\t\t\t".'<tr><td colspan="2" style="color:red">Fehler! Änderungen konnten nicht übernommen werden!</td></tr>';
} else{
logaction('Ein Item wurde geändert (@'.$itemtable.', id = '.$itemid.','.encodeNoHTMLWithBB(join($data,',')).')');
echo "\t\t\t".'<tr><td colspan="2">Änderungen wurden übernommen!</td></tr>';
mysql_query('UPDATE chars set frucht = \''.encodeNoHTMLWithBB($data[$d_array[0]]).'\' where frucht = \''.$row[$d_array[0]].'\'');
if($itemtable == 'wochen_markt'){
$sql = 'Update sp_item set name = \''.encodeNoHTMLWithBB($data[$d_array[0]]).'\' where name = \''.$row[$d_array[0]].'\'';
echo $sql.'<br>';
mysql_query($sql);
} else if($itemtable == 'sp_item'){
$sql = 'Update wochen_markt set item = \''.encodeNoHTMLWithBB($data[$d_array[0]]).'\' where item = \''.$row[$d_array[0]].'\'';
echo $sql.'<br>';
mysql_query($sql);
}
}
}
displayItems($action, 'change', $itemid, $itemtable, $searchstring, $s_itemtable,$page, $data);
return;
} else if($task == 'dodelete'){
if($itemtable == 'item'){
$sql = 'SELECT i.id, i.name, \'item\' as tablename FROM item i WHERE id ='.$itemid;
$d_sql = 'DELETE FROM item WHERE id ='.$itemid;
$d_sql_2 = 'DELETE FROM ware WHERE item_id ='.$itemid;
} else if($itemtable == 'sp_item'){
$sql = 'SELECT i.id, i.name, \'sp_item\' as tablename FROM sp_item i WHERE id ='.$itemid;
$d_sql = 'DELETE FROM sp_item WHERE id ='.$itemid;
$d_sql_2 = 'DELETE FROM sp_ware WHERE item ='.$itemid;
}else if($itemtable == 'wochen_markt'){
$sql = 'SELECT i.id, i.item AS name, \'wochen_markt\' as tablename FROM wochen_markt i WHERE id ='.$itemid;
$d_sql = 'DELETE FROM wochen_markt WHERE id ='.$itemid;
$d_sql_2 = 'DELETE FROM wochen_ware WHERE item ='.$itemid;
} else{
// Something went completely wrong!!
$error = true;
}
if(!$error){
$row = mysql_fetch_assoc(mysql_query($sql));
if(mysql_query($d_sql) === FALSE || mysql_affected_rows() == 0){
echo "\t\t\t".'<tr><td colspan="2">Item "'.$row['name'].'" konnte nicht gelöscht werden!</td></tr>';
} else if(mysql_query($d_sql_2) === FALSE){
logaction('Ein Item wurde gelöscht (@'.$itemtable.', id = '.$itemid.','.$row['name'].')');
echo "\t\t\t".'<tr><td colspan="2">Item "'.$row['name'].'" wurde zwar gelöscht, bei der Warentabelle ist jedoch ein Fehler aufgetreten!</td></tr>';
} else{
logaction('Ein Item wurde gelöscht (@'.$itemtable.', id = '.$itemid.','.$row['name'].')');
echo "\t\t\t".'<tr><td colspan="2">Item "'.$row['name'].'" wurde erfolgreich gelöscht!</td></tr>';
}
displayItems($action, null, null, null, $searchstring, $s_itemtable,$page,$data);
return;
}
}
echo "\t\t\t".'<tr><td align="center" colspan="'.$colspan.'"><a href="'.$_SERVER['PHP_SELF'].'?choose=items">Zum Itemsmenü</a></td></tr>'."\n";
} else if($action == 'create'){
echo "\t".'<input type="hidden" name="action" value="create"></input>'."\n";
echo "\t".'<input type="hidden" name="itemtable" value="'.$itemtable.'"></input>'."\n";
if($task == 'docreate'){
// Do the insert and open the edit-page :)
if($itemtable == 'item'){
$d_array = array('name','hp','mp','starke','verteidigung','speed','s_type','preis','anzahl','type','level','info');
} else if($itemtable == 'sp_item'){
$d_array = array('name','preis','wert','type','slot','info');
} else if($itemtable == 'wochen_markt'){
$d_array = array('item','starke','ver','speed','ausdauer','hp','mp','glueck','type','preis','anzahl','verteilung','aktiv','art','kategorie','info');
} else{
// Something went completely wrong!!
$error = true;
}
if(!$error){
// We create an itemtable-wide unique id!!
$row = mysql_fetch_assoc(mysql_query('select max(max_id) + 1 as id from (select max(s.id) as max_id from sp_item s union select max(i.id) as max_id from item i union select max(w.id) as max_id from wochen_markt w) gno'));
// $row = mysql_fetch_assoc(mysql_query('SELECT max(id) +1 as id FROM '.$itemtable));
$itemid = $row['id'];
$sql = 'INSERT INTO '.$itemtable.' (id, '.join($d_array,', ').') values('.$itemid;
for($i=0;$i<count($d_array);$i++){
$sql .= ', \''.encodeNoHTMLWithBB($data[$d_array[$i]]).'\'';
}
$sql .= ')';
// echo $sql.'<br>';
$u = mysql_query($sql);
if(mysql_affected_rows() == 0 || $u === FALSE){
echo "\t\t\t".'<tr><td colspan="2" style="color:red">Fehler! Konnte Item nicht erstellen!</td></tr>';
displayItems($action, null, null, $itemtable, $searchstring, $s_itemtable,$page, $data);
} else{
logaction('Ein Item wurde erstellt (@'.$itemtable.', id = '.$itemid.','.encodeNoHTMLWithBB(join($data,',')).')');
echo "\t\t\t".'<tr><td colspan="2">Item wurde erstellt!</td></tr>';
displayItems('edit', 'change', $itemid, $itemtable, $searchstring, $s_itemtable, $page, $data);
}
return;
}
} else {
$colspan = 2;
echo "\t\t\t".'<tr><td colspan="'.$colspan.'"><h1 style="text-align:center">Erstellen</h1></td></tr>'."\n";
if($itemtable == 'item'){
$d_array = array('id','name','hp','mp','starke','verteidigung','speed','s_type','preis','anzahl','type','level','info');
$desc_array = array('ID', 'Name', 'HP', 'MP', 'Bonus Stärke', 'Bonus Verteidigung', 'Bonus Geschwindigkeit', 'Art (Item, Helm, ..)', 'Preis im Markt', 'Anzahl', 'Rassen (ALL, Onepiece, Dragonball)', 'Level', 'Infotext');
} else if($itemtable == 'sp_item'){
$d_array = array('id','name','preis','wert','type','slot','info');
$desc_array = array('ID', 'Name', 'Preis', 'Häufigkeit (je höher desto seltener)', '"Teufels Frucht" oder nicht', 'Slot (immer auf 0 setzen)', 'Infotext');
} else if($itemtable == 'wochen_markt'){
$d_array = array('id','item','starke','ver','speed','ausdauer','hp','mp','glueck','type','preis','anzahl','verteilung','aktiv','art','kategorie','info');
$desc_array = array('ID', 'Name', 'Bonus Stärke', 'Bonus Verteidigung', 'Bonus Geschwindigkeit', 'Bonus Ausdauer', 'Bonus HP', 'Bonus MP', 'Bonus Glück', 'Typ ("Teufels Frucht")', 'Preis', 'Anzahl', 'Verteilung (0=Nicht wünschbar, Summe Verteilung sollte 100 ergeben!!)', 'Kann bei Geheimauktion auftreten', 'Art (normal, natur)', 'Kategorie (Logia, Zoan, ...)','Infotext' );
} else{
// Something went completely wrong!!
$o_array = array('Markt Items', 'Schatzsuche Items', 'Auktionsitems');
$o_tblarray = array('item', 'sp_item', 'wochen_markt');
echo "\t\t\t".'<tr><td colspan="'.$colspan.'" style="text-align:center"><select name="itemtable">';
for($i=0;$i<count($o_tblarray);$i++){
if($o_tblarray[$i] == $s_itemtable){
$selected = ' selected="selected"';
} else{
$selected = '';
}
echo '<option value="'.$o_tblarray[$i].'"'.$selected.'>'.$o_array[$i].'</option>';
}
echo "\t\t\t".' <input type="submit" value="auswählen"></td></tr>';
$error = true;
}
if(!$error){
// Erstelle eine Maske (daran denken, dass die eingaben die schon gemacht wurden übernommen werden)!
echo "\t".'<input type="hidden" name="task" value="docreate"></input>'."\n";
echo "\t\t".'<tr><td>'.$desc_array[0].'</td><td style="text-align:center">'.$data[$d_array[0]].'</td></tr>'."\n";
for($i = 1;$i<count($d_array)-1;$i++){
echo "\t\t".'<tr><td>'.$desc_array[$i].'</td><td style="text-align:center"><input name="data['.$d_array[$i].']" value="'.debbcode($data[$d_array[$i]]).'"></input></td></tr>'."\n";
}
// Infotext
echo "\t\t\t".'<tr><td>'.$desc_array[$i].'</td><td style="text-align:center"><textarea name="data['.$d_array[$i].']" cols="30" rows="5">'.debbcode($data[$d_array[$i]]).'</textarea></td></tr>'."\n";
echo "\t\t\t".'<td colspan="'.$colspan.'" style="text-align:center"><input type="submit" value="erstellen"></td></tr>'."\n";
}
}
// Create
echo "\t\t\t".'<tr><td align="center" colspan="'.$colspan.'"><a href="'.$_SERVER['PHP_SELF'].'?choose=items">Zum Itemsmenü</a></td></tr>'."\n";
} else if($action == 'overview'){
echo "\t".'<input type="hidden" name="action" value="overview"></input>'."\n";
if($itemtable == 'sp_item'){
$d_array = array('id','name','preis','wert','type','slot','info');
$desc_array = array('ID', 'Name', 'Preis', 'Häufigkeit', 'Typ', 'Slot', 'Infotext');
} else if($itemtable == 'wochen_markt'){
$d_array = array('id','item','starke','ver','speed','ausdauer','hp','mp','glueck','type','preis','anzahl','verteilung','aktiv','art','kategorie','info');
$desc_array = array('ID', 'Name', 'Bonus Stärke', 'Bonus Verteidigung', 'Bonus Geschwindigkeit', 'Bonus Ausdauer', 'Bonus HP', 'Bonus MP', 'Bonus Glück', 'Typ ("Teufels Frucht")', 'Preis', 'Anzahl', 'Verteilung (0=Nicht wünschbar, Summe Verteilung sollte 100 ergeben!!)', 'Kann bei Geheimauktion auftreten', 'Art (normal, natur)', 'Kategorie (Logia, Zoan, ...)','Infotext' );
} else {
$itemtable = 'item';
$d_array = array('id','name','hp','mp','starke','verteidigung','speed','s_type','preis','anzahl','type','level','info');
$desc_array = array('ID', 'Name', 'HP', 'MP', 'Stärke', 'Verteidigung', 'Geschwindigkeit', 'Art', 'Preis', 'Anzahl', 'Rassen', 'Level', 'Infotext');
}
$colspan = count($d_array);
echo "\t\t\t".'<tr><td colspan="'.$colspan.'"><h1 style="text-align:center">Übersicht</h1></td></tr>'."\n";
$o_array = array('Markt Items', 'Schatzsuche Items', 'Auktionsitems');
$o_tblarray = array('item', 'sp_item', 'wochen_markt');
echo "\t\t\t".'<tr><td colspan="'.$colspan.'"><select name="itemtable">';
for($i=0;$i<count($o_tblarray);$i++){
if($o_tblarray[$i] == $s_itemtable){
$selected = ' selected="selected"';
} else{
$selected = '';
}
echo '<option value="'.$o_tblarray[$i].'"'.$selected.'>'.$o_array[$i].'</option>';
}
echo "\t\t\t".' <input type="submit" value="vergleichen"></td></tr>';
echo "\t\t\t".'<tr><td colspan="'.$colspan.'"><hr></td></tr>'."\n";
// We do not want to display the ID and the Info
echo "\t\t\t".'<tr>';
for($i=1;$i<count($desc_array)-1;$i++){
echo '<td>'.$desc_array[$i].'</td>';
}
echo '<td>Aktion</td>';
echo '</tr>';
$sql = 'SELECT '.join($d_array,',').' FROM '.$itemtable;
$qry = mysql_query($sql);
while($row = mysql_fetch_assoc($qry)){
echo "\t\t\t".'<tr>';
for($i=1;$i<count($d_array)-1;$i++){
echo '<td>'.$row[$d_array[$i]].'</td>';
}
echo '<td>';
echo '<a href="'.$_SERVER['PHP_SELF'].'?choose=items&action=edit&task=change&itemid='.$row['id'].'&itemtable='.$itemtable.'">Edit</a>, ';
echo '<a href="'.$_SERVER['PHP_SELF'].'?choose=items&action=delete&task=change&itemid='.$row['id'].'&itemtable='.$itemtable.'">Delete</a>';
echo '</td>';
echo '</tr>';
}
echo "\t\t\t".'<tr><td align="center" colspan="'.$colspan.'"><a href="'.$_SERVER['PHP_SELF'].'?choose=items">Zum Itemsmenü</a></td></tr>'."\n";
} else {
echo "\t\t\t".'<tr><td align="center" colspan="'.$colspan.'"><a href="'.$_SERVER['PHP_SELF'].'?choose=items&action=overview">Übersicht</a></td></tr>'."\n";
echo "\t\t\t".'<tr><td align="center" colspan="'.$colspan.'"><a href="'.$_SERVER['PHP_SELF'].'?choose=items&action=edit">Bearbeiten</a></td></tr>'."\n";
echo "\t\t\t".'<tr><td align="center" colspan="'.$colspan.'"><a href="'.$_SERVER['PHP_SELF'].'?choose=items&action=create">Erstellen</a></td></tr>'."\n";
}
echo "\t\t\t".'<tr><td align="center" colspan="'.$colspan.'"><a href="'.$_SERVER['PHP_SELF'].'">Zum Hauptmenu</a></td></tr>'."\n";
echo "\t\t".'</table>'."\n";
echo '</form>'."\n";
}
?>

@ -0,0 +1,255 @@
<?php
function displayQuestNPC($action, $name, $starke, $speed, $verteidigung, $ausdauer, $hp, $mp, $level, $orte,$id, $anzahl, $confirm, $glueck){
if($action != 'delete' && $action != 'change' && $action != 'create'){
$sql = 'SELECT id , name FROM `quest_monster` order by name asc';
$result = mysql_query($sql);
?>
<table>
<tr>
<th colspan="2">
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=qnpc&action=create">Neues Monster erstellen!!</a>
</th>
</tr>
<tr>
<th align="center">Name</th>
<th align="center" colspan="2">Aktion</th>
</tr>
<?php
while($res = mysql_fetch_assoc($result)){
?>
<tr>
<td><?php echo $res['name']; ?></td>
<td><a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=qnpc&action=change&id=<?php echo $res[id]; ?>">&auml;ndern</a></td>
<td><a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=qnpc&action=delete&id=<?php echo $res[id]; ?>">l&ouml;schen</a></td>
</tr>
<?php
}
?>
<tr>
<td>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a>
</td>
</tr>
</table>
<?php
} else if($action == 'delete'){
if($confirm == null){
echo 'Das Monster mit der ID '.$id.' soll geloescht werden<br>';
echo '<a href="'.$_SERVER['PHP_SELF'].'?choose=qnpc&action=delete&id='.$id.'&confirm=yes">L&ouml;schen!!</a><br>';
} else{
$sql = 'DELETE FROM `quest_monster` where id = '.$id;
$result = mysql_query($sql);
logaction('Das Monster mit der ID '.$id.' wurde geloescht!!');
echo 'Das Monster mit der ID '.$id.' wurde gel&ouml;scht<br>';
}
?>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=qnpc">Zur &Uuml;bersicht</a><br>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a><br>
<?php
} else if($action == 'change'){
if($name != null){
$sql = 'Update `quest_monster` set name = \''.$name.'\', starke = '.$starke.', speed = '.$speed.', verteidigung = '.$verteidigung.', ausdauer = '.$ausdauer.', hp = '.$hp.', mp = '.$mp.', anzahl = \''.$anzahl.'\', `level` = '.$level.', glueck = '.$glueck.' where id = '.$id;
mysql_query('Delete from quest_monster_orte where monsterid = '.$id);
for($i=0;$i<count($orte);$i++){
mysql_query('Insert into quest_monster_orte(ortid, monsterid) values('.$orte[$i].', '.$id.')');
}
logaction('Das Monster mit dem Namen '.$name.' wurde angepasst!!');
$query = mysql_query($sql);
}
// Erstmal die Orte aufzaehlen, in der das Monster zu finden ist
$sql = 'Select ortid from quest_monster_orte where monsterid = '.$id;
$qry = mysql_query($sql);
while($row = mysql_fetch_assoc($qry)){
$monster_orte[$row['ortid']] = $row;
}
// Jetzt die Orte auslesen die zu Bereisen sind
$sql = 'Select * from quest_ort order by stadt';
$qry = mysql_query($sql);
while($row = mysql_fetch_assoc($qry)){
$orte_array[] = $row;
}
$sql = 'SELECT * FROM `quest_monster` where id = '.$id;
$result = mysql_query($sql);
$res = mysql_fetch_assoc($result);
?>
<form action="" method="POST">
<input name="choose" value="qnpc" type="hidden"></input>
<input name="action" value="change" type="hidden"></input>
<input name="id" value="<?php echo $id ?>" type="hidden"></input>
<table>
<tr>
<th>Name:</th>
<td><input name="npc_name" value="<?php echo $res['name']; ?>"></input></td>
</tr>
<tr>
<th>Starke:</th>
<td><input name="starke" value="<?php echo $res['starke']; ?>"></input></td>
</tr>
<tr>
<th>Speed:</th>
<td><input name="speed" value="<?php echo $res['speed']; ?>"></input></td>
</tr>
<tr>
<th>Verteidigung:</th>
<td><input name="verteidigung" value="<?php echo $res['verteidigung']; ?>"></input></td>
</tr>
<tr>
<th>Ausdauer:</th>
<td><input name="ausdauer" value="<?php echo $res['ausdauer']; ?>"></input></td>
</tr>
<tr>
<th>Gl&uuml;ck:</th>
<td><input name="glueck" value="<?php echo $res['glueck']; ?>"></input></td>
</tr>
<tr>
<th>HP:</th>
<td><input name="hp" value="<?php echo $res['hp']; ?>"></input></td>
</tr>
<tr>
<th>MP:</th>
<td><input name="mp" value="<?php echo $res['mp']; ?>"></input></td>
</tr>
<tr>
<th>Anzahl:</th>
<td><input name="anzahl" value="<?php echo $res['anzahl']; ?>"></input></td>
</tr>
<tr>
<th>Exp:</th>
<?php
$exp = ($res['starke']+$res['speed']+$res['verteidigung']+$res['glueck']+$res['ausdauer'])+$res['hp']/10;
$exp *= 30; // Mal Faktor
?>
<td><input name="exp" disabled="disabled" value="<?php echo $exp; ?>"></input></td>
</tr>
<tr>
<th>Level:</th>
<td><input name="level" value="<?php echo $res['level']; ?>"></input></td>
</tr>
<tr>
<th>Orte:</th>
<td><?php
// Ein Checkboxenfeld, womit die Orte ausgewaehlt werden koennen
for($i=0;$i<count($orte_array);$i++){
if($monster_orte[$orte_array[$i]['id']] != null){
echo $orte_array[$i]['stadt'].': <input type="checkbox" class="input" name="orte[]" value="'.$orte_array[$i]['id'].'" checked="checked" /><br>';
} else {
echo $orte_array[$i]['stadt'].': <input type="checkbox" class="input" name="orte[]" value="'.$orte_array[$i]['id'].'" /><br>';
}
}
?></td>
</tr>
<tr>
<td>
<input type="submit" value="update"></input>
</td>
</tr>
<tr>
<td colspan="2">
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=qnpc">Zur &Uuml;bersicht</a><br>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a><br>
</td>
</tr>
</table>
</form>
<?php
} else if($action == 'create'){
if($name != null){
$sql = 'Insert into `quest_monster`(name, starke, speed, verteidigung, ausdauer, hp, mp, anzahl, `level`) values(\''.$name.'\', '.$starke.', '.$speed.', '.$verteidigung.', '.$ausdauer.', '.$hp.', '.$mp.', \''.$anzahl.'\', '.$level.')';
$query = mysql_query($sql);
$id = mysql_fetch_assoc(mysql_query('Select id from quest_monster where name = \''.$name.'\''));
$monsterid = $id['id'];
for($i=0;$i<count($orte);$i++){
mysql_query('Insert into quest_monster_orte(ortid, monsterid) values('.$orte[$i].', '.$monsterid.')');
}
logaction('Das Monster mit dem Namen '.$name.' wurde erstellt!!');
echo "Monster erstellt<br>";
?>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=qnpc">Zur &Uuml;bersicht</a><br>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a><br>
<?php
return;
}
// Jetzt die Orte auslesen die zu Bereisen sind
$sql = 'Select * from quest_ort order by stadt';
$qry = mysql_query($sql);
while($row = mysql_fetch_assoc($qry)){
$orte_array[] = $row;
}
?>
<form action="" method="POST">
<input name="choose" value="qnpc" type="hidden"></input>
<input name="action" value="create" type="hidden"></input>
<input name="id" value="<?php echo $id ?>" type="hidden"></input>
<table>
<tr>
<th>Name:</th>
<td><input name="npc_name" value=""></input></td>
</tr>
<tr>
<th>Starke:</th>
<td><input name="starke" value=""></input></td>
</tr>
<tr>
<th>Speed:</th>
<td><input name="speed" value=""></input></td>
</tr>
<tr>
<th>Verteidigung:</th>
<td><input name="verteidigung" value=""></input></td>
</tr>
<tr>
<th>Ausdauer:</th>
<td><input name="ausdauer" value=""></input></td>
</tr>
<tr>
<th>HP:</th>
<td><input name="hp" value=""></input></td>
</tr>
<tr>
<th>MP:</th>
<td><input name="mp" value=""></input></td>
</tr>
<tr>
<th>Anzahl:</th>
<td><input name="anzahl" value=""></input></td>
</tr>
<tr>
<th>Level:</th>
<td><input name="level" value=""></input></td>
</tr>
<tr>
<th>Orte:</th>
<td><?php
// Ein Checkboxenfeld, womit die Orte ausgewaehlt werden koennen
for($i=0;$i<count($orte_array);$i++){
echo $orte_array[$i]['stadt'].': <input type="checkbox" class="input" name="orte[]" value="'.$orte_array[$i]['id'].'" /><br>';
}
?></td>
</tr>
<tr>
<td>
<input type="submit" value="insert"></input>
</td>
</tr>
<tr>
<td colspan="2">
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=qnpc">Zur &Uuml;bersicht</a><br>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a><br>
</td>
</tr>
</table>
</form>
<?php
}
}
?>

@ -0,0 +1,92 @@
<?php
function displayNPC($action, $task, $charid, $table, $page, $data){
echo '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">'."\n";
echo "\t".'<input type="hidden" name="choose" value="items"></input>'."\n";
echo "\t".'<table width="80%">'."\n";
if($action == 'edit'){
$d_array = array('charakter', 'name', 'zeit_rec', 'lvlmin', 'lvlmax');
$desc_array = array('ID', 'Name', 'Kampfdauer in Sekunden', 'Min-Level', 'Max-Level');
$sql = 'SELECT * FROM chars c inner join npc_item ni on ni.charakter = c.id inner join kampf_list kl on ni.charakter = kl.charakter WHERE c.id ='.$charid;
$qry = mysql_query($sql);
$row = mysql_fetch_assoc($qry);
$colspan = 2;
echo "\t".'<tr><td colspan="'.$colspan.'"><h1 style="text-align:center">NPC bearbeiten</h1></td></tr>'."\n";
echo "\t\t".'<tr><td>'.$desc_array[0].'</td><td style="text-align:center">'.$row[$d_array[0]].'</td></tr>'."\n";
for($i = 1;$i<count($d_array);$i++){
echo "\t\t".'<tr><td>'.$desc_array[$i].'</td><td style="text-align:center"><input name="data['.$d_array[$i].']" value="'.debbcode($row[$d_array[$i]]).'"></input></td></tr>'."\n";
}
echo "\t".'<tr><td colspan="'.$colspan.'" style="text-align:center"><a href="'.$_SERVER['PHP_SELF'].'?choose=npc">NPC Übersicht</a></td></tr>'."\n";
} else if($action == 'create'){
$colspan = 1;
echo "\t".'<tr><td colspan="'.$colspan.'"><h1 style="text-align:center">NPC erstellen</h1></td></tr>'."\n";;
echo "\t".'<tr><td colspan="'.$colspan.'" style="text-align:center"><a href="'.$_SERVER['PHP_SELF'].'?choose=npc">NPC Übersicht</a></td></tr>'."\n";
} else if($action == 'delete'){
$colspan = 1;
$sql = 'SELECT * FROM chars WHERE id = '.$charid;
$qry = mysql_query($sql);
$row = mysql_fetch_assoc($qry);
echo "\t".'<tr><td colspan="'.$colspan.'"><h1 style="text-align:center">NPC löschen</h1></td></tr>'."\n";;
if(is_null($task)){
echo "\t".'<tr><td colspan="'.$colspan.'" style="text-align:center">Soll der NPC '.$row['name'].' wirklich gelöscht werden</td></tr>'."\n";;
echo "\t".'<tr><td style="text-align:center"><a href="'.$_SERVER['PHP_SELF'].'?choose=npc&action=delete&task=do&charid='.$charid.'">ja</a>, <a href="'.$_SERVER['PHP_SELF'].'?choose=npc&action=">nein</a>, <a href="'.$_SERVER['PHP_SELF'].'?choose=npc&action=delete&charid='.$charid.'">vielleicht</a></td></tr>'."\n";
} else {
$sql = 'DELETE c,ni,kl,l FROM chars c inner join npc_item ni on ni.charakter = c.id inner join kampf_list kl on ni.charakter = kl.charakter inner join lernen l on l.besitzer = c.id where c.id = '.$charid;
// echo $sql.'<br>';
$qry = mysql_query($sql);
if($qry === FALSE || mysql_affected_rows() <= 0){
echo "\t".'<tr><td colspan="'.$colspan.'" style="text-align:center;color:red">Der NPC '.$row['name'].' konnte nicht gelöscht werden!</td></tr>'."\n";;
} else {
echo "\t".'<tr><td colspan="'.$colspan.'" style="text-align:center">Der NPC '.$row['name'].' wurde gelöscht!</td></tr>'."\n";;
}
// SELECT * FROM chars c inner join npc_item ni on ni.charakter = c.id inner join kampf_list kl on ni.charakter = kl.charakter
}
echo "\t".'<tr><td colspan="'.$colspan.'" style="text-align:center"><a href="'.$_SERVER['PHP_SELF'].'?choose=npc">NPC Übersicht</a></td></tr>'."\n";
} else{
$d_array = array('id', 'name', 'level');
$desc_array = array('id', 'Name', 'Level');
$sql = 'SELECT '.join($d_array,',').' from chars where rasse = \'NPC\' ORDER BY level';
$qry = mysql_query($sql.' LIMIT '.($page*20).', 20');
$anzahlSeiten = ceil(mysql_num_rows(mysql_query($sql))/20);
$colspan = count($d_array);
echo "\t".'<tr><td colspan="'.$colspan.'"><h1 style="text-align:center">Übersicht</h1></td></tr>'."\n";;
echo "\t".'<tr>'."\n";
for($i=1;$i<count($d_array);$i++){
echo "\t\t".'<td>'.$desc_array[$i].'</td>'."\n";
}
echo "\t\t".'<td style="text-align:center">Bearbeiten</td>'."\n";
echo "\t".'</tr>'."\n";
echo "\t".'<tr><td colspan="'.$colspan.'"><hr></td></tr>'."\n";
while($row = mysql_fetch_assoc($qry)){
echo "\t".'<tr>'."\n";
for($i=1;$i<count($d_array);$i++){
echo "\t\t".'<td>'.$row[$d_array[$i]].'</td>'."\n";
}
echo "\t\t".'<td style="text-align:center">'."\n";
// Echo the delete and the edit button :)
echo "\t\t\t".'<a href="'.$_SERVER['PHP_SELF'].'?choose=npc&action=edit&charid='.$row[$d_array[0]].'">Edit</a>, '."\n";
echo "\t\t\t".'<a href="'.$_SERVER['PHP_SELF'].'?choose=npc&action=delete&charid='.$row[$d_array[0]].'">Delete</a>'."\n";
echo "\t\t".'</td>'."\n";
echo "\t".'</tr>'."\n";
}
echo "\t".'<tr><td colspan="'.$colspan.'" style="text-align:center"><a href="'.$_SERVER['PHP_SELF'].'?choose=npc&action=create">Create a new NPC</a></td></tr>'."\n";
echo "\t".'<tr><td colspan="'.$colspan.'" style="text-align:center"><hr></td></tr>'."\n";
}
echo "\t".'<tr><td colspan="'.$colspan.'" style="text-align:center"><a href="'.$_SERVER['PHP_SELF'].'">Zum Hauptmenu</a></td></tr>'."\n";
echo "\t".'</table>'."\n";
echo '</form>'."\n";
}
?>

@ -0,0 +1,214 @@
<?php
function displayShop($action, $s_id, $info, $s_name, $s2_name, $s3_name, $s_typ, $preis, $frei, $anzahl){
if($action == ''){
$shop_qry = mysql_query('SELECT * FROM shop order by preis');
?>
<table border="1">
<tr>
<th align="center" colspan="11">Shop Angebote Übersicht<th>
</tr>
<tr>
<td align="center" colspan="11">
<a href="<?php echo $_SERVER['PHP_SELF'].'?choose=shop&action=erstellen'; ?>">Angebot erstellen</a>
</td>
</tr>
<tr><td>Name</td><td>ID</td><td>Art</td>
<td>Preis</td><td>Freischalten</td><td>Anzahl<td>bearbeiten</td></tr>
<?php
while($res = mysql_fetch_assoc($shop_qry)){
echo '<tr><td>'.$res['item'].'</td><td>'.$res['id'].'</td><td>'.$res['datensatz'].'</td>
<td>'.$res['preis'].'</td><td>'.$res['preis_req'].'</td><td>'.$res['mal'].'
</td><td><a href="'.$_SERVER['PHP_SELF'].'?choose=shop&action=edit&s_id='.$res['id'].'">edit</a>|<a href="'.$_SERVER['PHP_SELF'].'?choose=shop&action=delete&s_id='.$res['id'].'">delete</a></td></tr>';
}
?>
<tr>
<td align="center" colspan="11">
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a>
</td>
</tr>
</table>
<?php
} else if($action == 'edit' || $action == 'erstellen'){
if($s_name !== NULL){ // Sprich es wurde was geaendert!
if($action == 'edit'){
if ($s_typ == 'sp_ware'){
$sql = 'Update shop set item = \''.$s_name.'\', datensatz = \''.$s_typ.'\', preis = '.$preis.', preis_req = '.$frei.', mal = '.$anzahl.', com = \''.$info.'\' where id = '.$s_id.'';
logaction('Das Angebot für '.$s_name.' wurde editiert!');
}else if ($s_typ == 'ware'){
$sql = 'Update shop set item = \''.$s2_name.'\', datensatz = \''.$s_typ.'\', preis = '.$preis.', preis_req = '.$frei.', mal = '.$anzahl.', com = \''.$info.'\' where id = '.$s_id.'';
logaction('Das Angebot für '.$s2_name.' wurde editiert!');
}else if ($s_typ == 'wochen_ware'){
$sql = 'Update shop set item = \''.$s3_name.'\', datensatz = \''.$s_typ.'\', preis = '.$preis.', preis_req = '.$frei.', mal = '.$anzahl.', com = \''.$info.'\' where id = '.$s_id.'';
logaction('Das Angebot für '.$s3_name.' wurde editiert!');
}
mysql_query($sql);
echo $sql;
} else if($action == 'erstellen'){
logaction('Das Rezept für '.$s_name.' wurde erstellt!');
if ($s_typ == 'sp_ware'){
$sql = 'INSERT INTO shop(item, datensatz, preis, preis_req, mal, com) values(\''.$s_name.'\', \''.$s_typ.'\', '.$preis.', '.$frei.', '.$anzahl.', \''.$info.'\')';
}else if ($s_typ == 'ware'){
$sql = 'INSERT INTO shop(item, datensatz, preis, preis_req, mal, com) values(\''.$s2_name.'\', \''.$s_typ.'\', '.$preis.', '.$frei.', '.$anzahl.', \''.$info.'\')';
}else if ($s_typ == 'wochen_ware'){
$sql = 'INSERT INTO shop(item, datensatz, preis, preis_req, mal, com) values(\''.$s3_name.'\', \''.$s_typ.'\', '.$preis.', '.$frei.', '.$anzahl.', \''.$info.'\')';
}
mysql_query($sql);
echo $sql;
}
}
if($action == 'edit'){
$angebot = mysql_fetch_assoc(mysql_query('SELECT * FROM shop WHERE id = '.$s_id));
$aLabel = 'editieren';
} else{
$aLabel = 'erstellen';
}
?>
<form action="" method="POST">
<input name="choose" value="shop" type="hidden"></input>
<input name="action" value="<?php echo $action; ?>" type="hidden"></input>
<input name="s_id" value="<?php echo $s_id; ?>" type="hidden"></input>
<table>
<tr>
<th align="center" colspan="2">Angebot <?php echo $s_name; echo $aLabel; ?><th>
</tr>
<tr>
<td>Rezept ID</td><td><?php echo $angebot['id']; ?></td>
</tr>
<tr>
<td>Name</td><td><?php echo $angebot['item']; ?></td>
</tr>
<tr>
<td>Tpy</td>
<td height="25" width="200" valign="top">
<select id="input" name="s_typ">
<option value="sp_ware">SS Item</option>
<option value="ware">Markt Item</option>
<option value="wochen_ware">Teufelsfrüchte</option>
</select>
</td>
</tr>
<tr>
<td>Bei SS Items</td>
<td height="25" width="200" valign="top">
<?php
$item = mysql_query('SELECT * FROM sp_item where type !=\'Teufels Frucht\' ORDER BY name ');
?>
<select id="input" name="s_name">
<option value="">SS Item wählen</option>
<?php
while ($row2 = mysql_fetch_array($item)) {
echo "<option value='$row2[name]'>$row2[name]";
}
?>
</select>
</td>
</tr>
<tr>
<td>Bei Markt Items</td>
<td height="25" width="200" valign="top">
<?php
$item = mysql_query('SELECT * FROM item ORDER BY s_type ');
?>
<select id="input" name="s2_name">
<option value="">Martk Item wählen</option>
<?php
while ($row2 = mysql_fetch_array($item)) {
echo "<option value='$row2[name]'>$row2[name]";
}
?>
</select>
</td>
</tr>
<tr>
<td>Teufelsfrüchte</td>
<td height="25" width="200" valign="top">
<?php
$item = mysql_query('SELECT * FROM wochen_markt ORDER BY item ');
?>
<select id="input" name="s3_name">
<option value="">Teufelsfrucht wählen</option>
<?php
while ($row2 = mysql_fetch_array($item)) {
echo "<option value='$row2[item]'>$row2[item]";
}
?>
</select>
</td>
</tr>
<tr>
<td>Preis</td><td><input size="10" type="text" class="text" name="preis" value="<?php echo $angebot['preis']; ?>" /></td>
</tr>
<tr>
<td>Freischaltgrenze</td><td><input size="10" type="text" class="text" name="frei" value="<?php echo $angebot['preis_req']; ?>" /></td>
</tr>
<tr>
<td>Anzahl</td><td><input size="10" type="text" class="text" name="anzahl" value="<?php echo $angebot['mal']; ?>" /></td>
</tr>
<tr>
<td>Kommentar</td><td><input size="100" type="text" class="text" name="info" value="<?php echo $angebot['com']; ?>" /></td>
</tr>
<tr>
<td align="center" colspan="2"><input type="submit" /></td>
</tr>
<tr>
<td align="center" colspan="2">
<a href="<?php echo $_SERVER['PHP_SELF'].'?choose=shop'; ?>">Zur &Uuml;bersicht</a>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a>
</td>
</tr>
</table>
</form>
<?php
} else if($action == 'delete'){
?>
<table>
<?php
if($s_name !== NULL){
$sql = 'DELETE FROM shop WHERE id='.$s_id.' ';
mysql_query($sql);
echo $sql;
?>
<tr>
<td align="center" colspan="2">
Das Angebot für"<?php echo $s_name; ?>" wurde gel&ouml;scht
</td>
</tr>
<?php
} else{
$res = mysql_fetch_assoc(mysql_query('SELECT * FROM shop WHERE id = '.$s_id));
?>
<tr>
<td align="center" colspan="2">
Das Angebot "<?php echo $res['item']; ?>" wirklich l&ouml;schen? <a href="<?php echo $_SERVER['PHP_SELF'].'?choose=shop&action=delete&s_id='.$s_id.'&s_name='.$res['item']; ?>">L&ouml;schen best&auml;tigen!</a>
</td>
</tr>
<?php
}
?>
<tr>
<td align="center" colspan="2">
<a href="<?php echo $_SERVER['PHP_SELF'].'?choose=shop'; ?>">Zur &Uuml;bersicht</a>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a>
</td>
</tr>
</table>
<?php
}
}
?>

@ -0,0 +1,415 @@
<?php
function displayCheater($action, $from, $until, $user1, $user2, $tradeid, $verify){
if($action === null){
?>
<form action="" method="POST">
<input name="choose" value="cheat" type="hidden"></input>
<table>
<tr>
<th align="center" colspan="2">Multiuser und Cheater</th>
</tr>
<tr>
<td align="center" colspan="2"><a href="<?php echo $_SERVER['PHP_SELF'].'?choose=cheat&action=access'; ?>">Zugriffe</a></td>
</tr>
<tr>
<td align="center" colspan="2"><a href="<?php echo $_SERVER['PHP_SELF'].'?choose=cheat&action=trades'; ?>">Denkwürdige Trades</a></td>
</tr>
<tr>
<td align="center" colspan="2">
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a>
</td>
</tr>
</table>
</form>
<?php
} else if($action == 'access'){
$minmax = mysql_fetch_assoc(mysql_query('SELECT DATE(min(occured)) as min, DATE(max(occured)) as max FROM multiuser'));
$low = $from===null?$minmax['min']:$from;
$high = $until===null?$minmax['max']:$until;
?>
<form action="" method="POST">
<input name="choose" value="cheat" type="hidden" />
<table>
<tr>
<th align="center" colspan="3">Zugriffe</th>
</tr>
<tr>
<td align="center">
Von: <input name="from" value="<?php echo $low; ?>" />
</td>
<td align="center">
Bis: <input name="until" value="<?php echo $high; ?>" />
</td>
<td align="center">
<input type="submit" value="aktualisieren" />
</td>
</tr>
<tr>
<td colspan="3">
<table border="1">
<tr><th>User1</th><th>User2</th><th>Anzahl</th><th>Action</th>
<?php
$cheater_qry = mysql_query('Select u1.nickname as u1n, u1.id as u1i, u2.nickname u2n, u2.id u2i, count(occured) as anzahl from multiuser left join user as u1 on multiuser.user1 = u1.id left join user as u2 on multiuser.user2 = u2.id where occured >= \''.$low.' 00:00:00\' and occured <= \''.$high.' 23:59:59\' group by u1i, u2i order by anzahl');
while($row = mysql_fetch_assoc($cheater_qry)){
echo '<tr><td>'.$row['u1n'].'</td><td>'.$row['u2n'].'</td><td>'.$row['anzahl'].'</td><td><a href="'.$_SERVER['PHP_SELF'].'?choose=cheat&action=show&from='.$low.'&until='.$high.'&user1='.$row['u1i'].'&user2='.$row['u2i'].'">Nachweis</a> | <a href="'.$_SERVER['PHP_SELF'].'?choose=cheat&action=vwarn&user1='.$row['u1i'].'&user2='.$row['u2i'].'">Verwarnen</a> | <a href="'.$_SERVER['PHP_SELF'].'?choose=cheat&action=ban&user1='.$row['u1i'].'&user2='.$row['u2i'].'">Bannen</a></td></tr>';
}
?>
</table>
</td>
</tr>
<tr>
<td align="center" colspan="3">
<a href="<?php echo $_SERVER['PHP_SELF'].'?choose=cheat'; ?>">Multiuser und Cheatermen&uuml;</a>
</td>
</tr>
<tr>
<td align="center" colspan="3">
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a>
</td>
</tr>
</table>
</form>
<?php
} else if($action == 'trades'){
// Hier ist wichtig, zu hohe Trades und Trades in den Clans
$minmax = mysql_fetch_assoc(mysql_query('SELECT DATE(min(deadline)) as min, DATE(max(deadline)) as max FROM auktion_transaktionen'));
$low = $from===null?$minmax['min']:$from;
$high = $until===null?$minmax['max']:$until;
?>
<form action="" method="POST">
<input name="choose" value="cheat" type="hidden" />
<table>
<tr>
<th align="center" colspan="3">Trades die durch den Auto-Check gefallen sind</th>
</tr>
<tr>
<td align="center">
Von: <input name="from" value="<?php echo $low; ?>" />
</td>
<td align="center">
Bis: <input name="until" value="<?php echo $high; ?>" />
</td>
<td align="center">
<input type="submit" value="aktualisieren" />
</td>
</tr>
<tr>
<td colspan="3">
<table border="1" width="100%">
<tr><th>Verk&auml;ufer</th><th>K&auml;ufer</th><th>Item</th><th>Betrag</th><th>Anzahl</th><th>Datum</th><th>Auto-Check</th><th>Action</th>
<?php
$sql = 'SELECT at.transaktionsid, u1.nickname as u1n, u1.id as u1i, u2.nickname u2n, u2.id u2i, at.anzahl, betrag, deadline, cheatingverdacht, it.name as i_name, si.name as s_name, wm.item as w_name, itemid, tablename FROM auktion_transaktionen at left join sp_item si on tablename = \'sp_ware\' and itemid = si.id left join item as it on tablename = \'ware\' and itemid = it.id left join wochen_markt as wm on tablename = \'wochen_ware\' and itemid = wm.id left join user as u1 on at.anbieter = u1.id left join user as u2 on at.bieter = u2.id where cheatingverdacht = 1 and deadline >= \''.$low.' 00:00:00\' and deadline <= \''.$high.' 23:59:59\'';
$cheater_qry = mysql_query($sql);
while($row = mysql_fetch_assoc($cheater_qry)){
$name = $row['i_name']!=null?$row['i_name']:($row['w_name']!=null?$row['w_name']:$row['s_name']);
$cheatv = $row['cheatingverdacht']==0?'OK':'WARNUNG';
echo '<tr><td align="center">'.$row['u1n'].'</td><td align="center">'.$row['u2n'].'</td><td align="center">'.$name.'</td><td align="center">'.$row['betrag'].'</td><td align="center">'.$row['anzahl'].'</td><td align="center">'.$row['deadline'].'</td><td align="center">'.$cheatv.'</td><td><a href="'.$_SERVER['PHP_SELF'].'?choose=cheat&action=show&from='.$low.'&until='.$high.'&user1='.$row['u1i'].'&user2='.$row['u2i'].'">Nachweis</a> | <a href="'.$_SERVER['PHP_SELF'].'?choose=cheat&action=undo&tradeid='.$row['transaktionsid'].'">R&uuml;ckg&auml;ngig</a> | <a href="'.$_SERVER['PHP_SELF'].'?choose=cheat&action=markok&tradeid='.$row['transaktionsid'].'">OK</a> | <a href="'.$_SERVER['PHP_SELF'].'?choose=cheat&action=vwarn&user1='.$row['u1i'].'&user2='.$row['u2i'].'">Verwarnen</a> | <a href="'.$_SERVER['PHP_SELF'].'?choose=cheat&action=ban&user1='.$row['u1i'].'&user2='.$row['u2i'].'">Bannen</a></td></tr>';
}
?>
</table>
</td>
</tr>
<tr>
<td align="center" colspan="3">
<a href="<?php echo $_SERVER['PHP_SELF'].'?choose=cheat'; ?>">Multiuser und Cheatermen&uuml;</a>
</td>
</tr>
<tr>
<td align="center" colspan="3">
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a>
</td>
</tr>
</table>
</form>
<?php
} else if($action == 'show'){
// Zeigt die Verbindungen zwischen 2 Usern auf
$minmax = mysql_fetch_assoc(mysql_query('SELECT DATE(min(occured)) as min, DATE(max(occured)) as max FROM multiuser'));
$low = $from===null?$minmax['min']:$from;
$high = $until===null?$minmax['max']:$until;
?>
<form action="" method="POST">
<input name="choose" value="cheat" type="hidden" />
<table>
<tr>
<th align="center" colspan="3">Zugriffe</th>
</tr>
<tr>
<td align="center">
Von: <input name="from" value="<?php echo $low; ?>" />
</td>
<td align="center">
Bis: <input name="until" value="<?php echo $high; ?>" />
</td>
<td align="center">
<input type="submit" value="aktualisieren" />
</td>
</tr>
<tr>
<td colspan="3">
<table border="1" width="100%">
<tr><th>User1</th><th>User2</th><th>Datum</th><th>Art</th><th>Action</th>
<?php
$sql = 'Select u1.nickname as u1n, u1.id as u1i, u2.nickname u2n, u2.id u2i, occured, type from multiuser left join user as u1 on multiuser.user1 = u1.id left join user as u2 on multiuser.user2 = u2.id where user1 = '.$user1.' and user2 = '.$user2.' and occured >= \''.$$low.' 0:00:00\' and occured <= \''.$high.' 23:59:59\' order by occured desc';
$cheater_qry = mysql_query($sql);
while($row = mysql_fetch_assoc($cheater_qry)){
echo '<tr><td align="center">'.$row['u1n'].'</td><td align="center">'.$row['u2n'].'</td><td align="center">'.$row['occured'].'</td><td align="center">'.$row['type'].'</td><td align="center"><a href="'.$_SERVER['PHP_SELF'].'?choose=cheat&action=vwarn&user1='.$row['u1i'].'&user2='.$row['u2i'].'">Verwarnen</a> | <a href="'.$_SERVER['PHP_SELF'].'?choose=cheat&action=ban&user1='.$row['u1i'].'&user2='.$row['u2i'].'">Bannen</a></td></tr>';
}
?>
</table>
</td>
</tr>
<tr>
<th align="center" colspan="3">Trades</th>
</tr>
<tr>
<td colspan="3">
<table border="1" width="100%">
<tr><th>Verk&auml;ufer</th><th>K&auml;ufer</th><th>Item</th><th>Betrag</th><th>Anzahl</th><th>Datum</th><th>Auto-Check</th><th>Action</th>
<?php
$sql = 'SELECT u1.nickname as u1n, u1.id as u1i, u2.nickname u2n, u2.id u2i, at.anzahl, betrag, deadline, cheatingverdacht, it.name as i_name, si.name as s_name, wm.item as w_name, itemid, tablename FROM auktion_transaktionen at left join sp_item si on tablename = \'sp_ware\' and itemid = si.id left join item as it on tablename = \'ware\' and itemid = it.id left join wochen_markt as wm on tablename = \'wochen_ware\' and itemid = wm.id left join user as u1 on at.anbieter = u1.id left join user as u2 on at.bieter = u2.id where bieter IN ('.$user1.','.$user2.') and anbieter IN('.$user1.','.$user2.') and deadline >= \''.$low.' 00:00:00\' and deadline <= \''.$high.' 23:59:59\'';
// echo $sql.'<br>';
$cheater_qry = mysql_query($sql);
while($row = mysql_fetch_assoc($cheater_qry)){
$name = $row['i_name']!=null?$row['i_name']:($row['w_name']!=null?$row['w_name']:$row['s_name']);
$cheatv = $row['cheatingverdacht']==0?'OK':'WARNUNG';
echo '<tr><td align="center">'.$row['u1n'].'</td><td align="center">'.$row['u2n'].'</td><td align="center">'.$name.'</td><td align="center">'.$row['betrag'].'</td><td align="center">'.$row['anzahl'].'</td><td align="center">'.$row['deadline'].'</td><td align="center">'.$cheatv.'</td><td></td></tr>';
}
?>
</table>
</td>
</tr>
<tr>
<td align="center" colspan="3">
<?php echo displayHistoryBackLink(); ?>
</td>
</tr>
<tr>
<td align="center" colspan="3">
<a href="<?php echo $_SERVER['PHP_SELF'].'?choose=cheat'; ?>">Multiuser und Cheatermen&uuml;</a>
</td>
</tr>
<tr>
<td align="center" colspan="3">
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a>
</td>
</tr>
</table>
</form>
<?php
} else if($action == 'vwarn'){
// Spricht eine Verwarnung zwischen 2 Usern aus
if($verify == 1){
$qry = mysql_query('select id, nickname from user where id in ('.$user1.', '.$user2.')');
while($row = mysql_fetch_assoc($qry)){
$users[] = $row['nickname'];
}
displayErrorMessage('Verwarnung ausgesprochen', 'Die User '.join(' und ',$users).' sind nun verwarnt!', '<a href="'.$_SERVER['PHP_SELF'].'?choose=cheat">weiter</a>');
mysql_query('INSERT INTO nachricht(betreff, von, datum, text, besitzer) values(\'Verwarnung\', \'AG-Team\', now(), \'Es kam zwischen den Accounts '.join(' und ',$users).' zu &Uuml;berschneidungen, wir bitten euch dies zu unterlassen, da wir uns sonst gezwungen sehen diese Aktivit&auml;ten zu bestrafen!\', '.$user1.')');
mysql_query('INSERT INTO nachricht(betreff, von, datum, text, besitzer) values(\'Verwarnung\', \'AG-Team\', now(), \'Es kam zwischen den Accounts '.join(' und ',$users).' zu &Uuml;berschneidungen, wir bitten euch dies zu unterlassen, da wir uns sonst gezwungen sehen diese Aktivit&auml;ten zu bestrafen!\', '.$user2.')');
logaction('Die User '.join(' und ',$users).' wurden verwarnt!');
} else{
$qry = mysql_query('select id, nickname from user where id in ('.$user1.', '.$user2.')');
while($row = mysql_fetch_assoc($qry)){
$users[] = $row['nickname'];
}
displayErrorMessage('Verwarnen', 'Sollen die User '.join(' und ',$users).' wirklich verwarnt werden?', '<a href="'.$_SERVER['PHP_SELF'].'?choose=cheat&action=vwarn&user1='.$user1.'&user2='.$user2.'&verify=1">weiter</a> | '.displayHistoryBackLink());
}
} else if($action == 'ban'){
// Bannt zwei Accounts
if($verify == 1){
$qry = mysql_query('select id, nickname from user where id in ('.$user1.', '.$user2.')');
while($row = mysql_fetch_assoc($qry)){
$users[] = $row['nickname'];
}
displayErrorMessage('Bann vollzogen!', 'Die User '.join(' und ',$users).' sind nun verwarnt!', '<a href="'.$_SERVER['PHP_SELF'].'?choose=cheat">weiter</a>');
mysql_query('INSERT INTO nachricht(betreff, von, datum, text, besitzer) values(\'Bann\', \'AG-Team\', now(), \'Es kam zwischen den Accounts '.join(' und ',$users).' zu &Uuml;berschneidungen. Deswegen sahen wir uns gezwungen diese Aktivit&auml;ten zu bestrafen!\', '.$user1.')');
mysql_query('INSERT INTO nachricht(betreff, von, datum, text, besitzer) values(\'Bann\', \'AG-Team\', now(), \'Es kam zwischen den Accounts '.join(' und ',$users).' zu &Uuml;berschneidungen. Deswegen sahen wir uns gezwungen diese Aktivit&auml;ten zu bestrafen!\', '.$user2.')');
mysql_query('Update user set bann = \'ja\' where id IN('.$user1.', '.$user2.')');
logaction('Die User '.join(' und ',$users).' wurden gebannt!');
} else{
$qry = mysql_query('select id, nickname from user where id in ('.$user1.', '.$user2.')');
while($row = mysql_fetch_assoc($qry)){
$users[] = $row['nickname'];
}
displayErrorMessage('Bannen', 'Sollen die User '.join(' und ',$users).' wirklich gebannt werden?', '<a href="'.$_SERVER['PHP_SELF'].'?choose=cheat&action=ban&user1='.$user1.'&user2='.$user2.'&verify=1">weiter</a> | '.displayHistoryBackLink());
}
} else if($action == 'undo'){
// Macht eine Auktion rückgängig
displayErrorMessage(NULL, 'not yet implemented', displayHistoryBackLink());
} else if($action == 'markok'){
if($verify == 1){
$trade = mysql_fetch_assoc(mysql_query('SELECT u1.nickname as u1n, u1.id as u1i, u2.nickname u2n, u2.id u2i, at.anzahl, betrag, deadline, cheatingverdacht, it.name as i_name, si.name as s_name, wm.item as w_name, itemid, tablename FROM auktion_transaktionen at left join sp_item si on tablename = \'sp_ware\' and itemid = si.id left join item as it on tablename = \'ware\' and itemid = it.id left join wochen_markt as wm on tablename = \'wochen_ware\' and itemid = wm.id left join user as u1 on at.anbieter = u1.id left join user as u2 on at.bieter = u2.id where transaktionsid = '.$tradeid));
displayErrorMessage('Trade validiert!', 'Der Handel zwischen '.$trade['u1n'].' und '.$trade['u2n'].' ist nun als \'Ok\' markiert!', '<a href="'.$_SERVER['PHP_SELF'].'?choose=cheat">weiter</a>');
logaction('Der Handel zwischen '.$trade['u1n'].' und '.$trade['u2n'].' wurde als \'Ok\' markiert (Tradeid = '.$tradeid.')!');
mysql_query('Update auktion_transaktionen set cheatingverdacht = 0 where transaktionsid = '.$tradeid);
} else{
$trade = mysql_fetch_assoc(mysql_query('SELECT u1.nickname as u1n, u1.id as u1i, u2.nickname u2n, u2.id u2i, at.anzahl, betrag, deadline, cheatingverdacht, it.name as i_name, si.name as s_name, wm.item as w_name, itemid, tablename FROM auktion_transaktionen at left join sp_item si on tablename = \'sp_ware\' and itemid = si.id left join item as it on tablename = \'ware\' and itemid = it.id left join wochen_markt as wm on tablename = \'wochen_ware\' and itemid = wm.id left join user as u1 on at.anbieter = u1.id left join user as u2 on at.bieter = u2.id where transaktionsid = '.$tradeid));
displayErrorMessage('Trade validieren!', 'Sollen der Handel zwischen '.$trade['u1n'].' und '.$trade['u2n'].' als \'Ok\' markiert werden?', '<a href="'.$_SERVER['PHP_SELF'].'?choose=cheat&action=markok&tradeid='.$tradeid.'&verify=1">weiter</a> | '.displayHistoryBackLink());
}
}
// TODO: Action um IP-Sharing zu erlauben! -> tabelle (duerfen keine miesen trades und fights mehr machen)
// TODO: Erlaubte IP-Sharer muessen markiert werden
// TODO: Verwarnte und Gebannte User muessen markiert werden!
}
function displayBannOptions($action, $username,$opfer,$gamebann,$shoutbann,$forenbann,$anonid){
if($action == '' or $action == NULL){
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<input type="hidden" name="choose" value="bann"></input>
<input type="hidden" name = "action" value="search"></input>
<table>
<tr>
<th colspan="2">
User auswählen
</th>
</tr>
<tr>
<td>
Username
</td>
<td>
<input name="username"></input>
</td>
</tr>
<tr>
<td>
Anonid (nur die Zahlen!)
</td>
<td>
<input name="anonid"></input>
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" value="suchen">
</td>
</tr>
<tr>
<td>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=bann">Zur &Uuml;bersicht</a><br>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a>
</td>
</tr>
</table>
</form>
<?php
} else if(is_numeric($anonid)){
mysql_query('UPDATE anon_chatter set muted = 1 where anon_id = '.$anonid);
?>
<table>
<tr>
<td>
anon_<?php echo $anonid; ?> wurde im Chat gebannt!
</td>
</tr>
<tr>
<td>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=bann">Zur &Uuml;bersicht</a>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a>
</td>
</tr>
</table>
<?php
} else if($action == "search"){
// Auslagern ;D
$qry = mysql_query('Select nickname, id from user where nickname like \''.$username.'%\'');
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<input type="hidden" name="choose" value="bann"></input>
<input type="hidden" name = "action" value="finish_him"></input>
<table>
<tr>
<th colspan="2">
Userstatus bearbeiten
</th>
</tr>
<tr>
<td>
Username
</td>
<td>
<select name="opfer">
<?php
while($result = mysql_fetch_assoc($qry)){
echo '<option value="'.$result['id'].'">'.$result['nickname'].'</option>';
}
?>
</select>
</td>
</tr>
<tr>
<td>Account</td>
<td>
<input type="radio" name="gamebann" value="1">Account sperren<br>
<input type="radio" name="gamebann" value="2">Account entsperren<br>
</td>
</tr>
<tr>
<td>Shoutbox</td>
<td>
<input type="radio" name="shoutbann" value="1">Shoutbox mute<br>
<input type="radio" name="shoutbann" value="2">Shoutbox demute<br>
</td>
</tr>
<tr>
<td>Forum</td>
<td>
<input type="radio" name="forenbann" value="1" disabled="disabled">Forenaccout sperren<br>
<input type="radio" name="forenbann" value="2" disabled="disabled">Forenaccount entsperren<br>
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" value="Banns zuweisen/l&ouml;schen">
</td>
</tr>
<tr>
<td>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=bann">Zur &Uuml;bersicht</a>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a>
</td>
</tr>
</table>
</form>
<?php
} else if($action == "finish_him"){
if($gamebann == 1){
logaction('Nutzer mit der id '.$opfer.' wurde gebannt.');
bannAccount($opfer);
} else if($gamebann == 2){
logaction('Nutzer mit der id '.$opfer.' wurde entbannt.');
unbannAccount($opfer);
}
if($shoutbann == 1){
logaction('Nutzer mit der id '.$opfer.' wurde stumm geschaltet.');
setSpamblock($opfer);
} else if($shoutbann == 2){
logaction('Stummschatung des Nutzers mit der id '.$opfer.' wurde abgebrochen.');
releaseSpamblock($opfer);
}
?>
<table>
<tr>
<td>
&Auml;nderungen &uuml;bernommen!
</td>
</tr>
<tr>
<td>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=bann">Zur &Uuml;bersicht</a>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a>
</td>
</tr>
</table>
<?php
}
}
?>
Loading…
Cancel
Save