@ -9,33 +9,57 @@
?>
<?php
function displayClanItems($action, $raumid, $raumname, $staerke, $verteidigung, $glueck, $ausdauer, $geschwindigkeit, $info, $level){
if($action == ''){
defineIfNotDefined("CLAN_CREATION_FEE", 20000);
function displayClanItems() {
$raume_qry = mysql_query('SELECT * FROM clan_item order by tp');
?>
< table >
< tr >
< th align = "center" colspan = "11" > Clanrä ume bearbeiten< / th >
< th align = "center" colspan = "12" > < h1 > Clanrä ume bearbeiten< / h1 > < / th >
< / tr >
< tr >
< td > Name< / td >
< td > Stä rke< / td >
< td > Verteidigung< / td >
< td > Glü ck< / td >
< td > Ausdauer< / td >
< td > Geschwindigkeit< / td >
< td > Kaufpreis< / td >
< td > Miete< / td >
< td > Nutzungsgebü hr< / td >
< td > TP< / td >
< td > Level< / td >
< td > bearbeiten< / td >
< / tr >
< tr >
< td colspan = 12 > < hr > < / td >
< / tr >
< tr > < td > Name< / td > < td > Stä rke< / td > < td > Verteidigung< / td > < td > Glü ck< / td > < td > Ausdauer< / td > < td > Geschwindigkeit< / td > < td > Kaufpreis< / td > < td > Miete< / td > < td > Nutzungsgebü hr< / td > < td > TP< / td > < td > Level< / 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 > '.$res['req_level'].'< / 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 > ';
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 > '.$res['req_level'].'< / td > < td > < a href = "'.$_SERVER['PHP_SELF'].'?choose=clan &action=editrooms &raumid='.$res['id'].'"> edit< / a > | < a href = "'.$_SERVER['PHP_SELF'].'?choose=clan &action=deleterooms &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 colspan = 12 > < hr > < / td >
< / tr >
< tr >
< td align = "center" colspan = "12" > < a
href="<?php echo $_SERVER [ 'PHP_SELF' ] . '?choose=clan&action=createrooms' ; ?> ">Raum
erstellen< / a >
< / td >
< / tr >
< tr >
< td align = "center" colspan = "11" >
< a href = " <?php echo $_SERVER [ 'PHP_SELF' ]; ?> " > Zum Hauptmenu</ a >
< td align = "center" colspan = "12" > < a
href="<?php echo $_SERVER [ 'PHP_SELF' ] . '?choose=clan' ; ?> ">Zum
Clanmenu< / a >
< / td >
< / tr >
< / table >
<?php
} else if($action == 'edit' || $action == 'create'){
}
function displayEditOrCreateClanRoom($action, $raumid, $raumname, $staerke, $verteidigung, $glueck, $ausdauer, $geschwindigkeit, $info, $level) {
if($raumname !== NULL){ // Sprich es wurde was geaendert!
// Berechne den TP Verbrauch
$b38 = 1.3; // Parameter aus Exceltabelle
@ -64,13 +88,13 @@ function displayClanItems($action, $raumid, $raumname, $staerke, $verteidigung,
$miete = ceil($miete/$stepmp)*$stepmp;
$nutz = ceil($nutz/$stepnp)*$stepnp;
// So und nun kann weiter gemacht werden!
if($action == 'edit'){
if($action == 'editrooms '){
logaction('Der Raum '.$raumname.' wurde editiert!');
$sql ='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.'\', req_level = '.$level.' where id = '.$raumid.'';
$res = mysql_query($sql);
if(!$res)
echo $sql . '< br > ';
} else if($action == 'create'){
} else if($action == 'createrooms '){
logaction('Der Raum '.$raumname.' wurde erstellt!');
$sql = 'INSERT INTO clan_item(name, staerke, verteidigung, ausdauer, geschwindigkeit, glueck, preis, miete, nutzung, tp, info, req_level) values(\''.$raumname.'\', '.$staerke.', '.$verteidigung.', '.$ausdauer.', '.$geschwindigkeit.', '.$glueck.', '.$kaufpreis.', '.$miete.', '.$nutz.', '.$tp.', \''.$info.'\', '.$level.')';
$res = mysql_query($sql);
@ -78,8 +102,7 @@ function displayClanItems($action, $raumid, $raumname, $staerke, $verteidigung,
echo $sql . '< br > ';
}
}
if($action == 'edit'){
if($action == 'editrooms'){
$raum = mysql_fetch_assoc(mysql_query('SELECT * FROM clan_item WHERE id = '.$raumid));
$aLabel = 'editieren';
} else{
@ -87,66 +110,92 @@ function displayClanItems($action, $raumid, $raumname, $staerke, $verteidigung,
}
?>
< form action = "" method = "POST" >
< input name = "choose" value = "clan items " type = "hidden" > < / input >
< input name = "action" value = "<?php echo $action ; ?> " type = "hidden" ></ input >
< input name = "raumid" value = "<?php echo $raumid ; ?> " type = "hidden" > </input >
< input name = "choose" value = "clan " 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ä ume <?php echo $aLabel ; ?> </ th >
< th align = "center" colspan = "2" > Clanrä ume <?php echo $aLabel ; ?>
< / th >
< / tr >
< tr >
< td > Name</ td >< td >< input type = "text" class = "text" name = "raumname" value = " <?php echo $raum [ 'name' ]; ?> " /></ td >
< td > Name< / td >
< td > < input type = "text" class = "text" name = "raumname"
value="<?php echo $raum [ 'name' ]; ?> " /></ td >
< / tr >
< tr >
< td > Stä rke</ td >< td >< input type = "text" class = "text" name = "staerke" value = " <?php echo $raum [ 'staerke' ]; ?> " /></ td >
< td > Stä 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 >
< td > Verteidigung< / td >
< td > < input type = "text" class = "text" name = "verteidigung"
value="<?php echo $raum [ 'verteidigung' ]; ?> " /></ td >
< / tr >
< tr >
< td > Glü ck</ td >< td >< input type = "text" class = "text" name = "glueck" value = " <?php echo $raum [ 'glueck' ]; ?> " /></ td >
< td > Glü 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 >
< 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 >
< td > Geschwindigkeit< / td >
< td > < input type = "text" class = "text" name = "geschwindigkeit"
value="<?php echo $raum [ 'geschwindigkeit' ]; ?> " /></ td >
< / tr >
< tr >
< td > Level</ td >< td >< input type = "text" class = "text" name = "req_level" value = " <?php echo $raum [ 'req_level' ]; ?> " /></ td >
< td > Level< / td >
< td > < input type = "text" class = "text" name = "req_level"
value="<?php echo $raum [ 'req_level' ]; ?> " /></ td >
< / tr >
< tr >
< td > Kaufpreis</ td >< td > <?php echo $raum [ 'preis' ]; ?> </ td >
< td > Kaufpreis< / td >
< td > <?php echo $raum [ 'preis' ]; ?> </ td >
< / tr >
< tr >
< td > Miete</ td >< td > <?php echo $raum [ 'miete' ]; ?> </ td >
< td > Miete< / td >
< td > <?php echo $raum [ 'miete' ]; ?> </ td >
< / tr >
< tr >
< td > Nutzungsgebü hr</ td >< td > <?php echo $raum [ 'nutzung' ]; ?> </ td >
< td > Nutzungsgebü hr< / td >
< td > <?php echo $raum [ 'nutzung' ]; ?> </ td >
< / tr >
< tr >
< td > Trainingspunkte</ td >< td > <?php echo $raum [ 'tp' ]; ?> </ td >
< 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 >
< td > Info< / td >
<?php
echo '< td > < textarea name = "info" rows = "10" cols = "50" > '.$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 Ü bersicht</ a >
< td align = "center" colspan = "2" > < a
href="<?php echo $_SERVER [ 'PHP_SELF' ] . '?choose=clan&action=rooms' ; ?> ">Zur
Ü bersicht< / a >
< / td >
< / tr >
< tr >
< td align = "center" colspan = "2" >
< a href = " <?php echo $_SERVER [ 'PHP_SELF' ]; ?> " > Zum Hauptmenu</ a >
< td align = "center" colspan = "2" > < a
href="<?php echo $_SERVER [ 'PHP_SELF' ] . '?choose=clan' ; ?> ">Zum
Clanmenu< / a >
< / td >
< / tr >
< / table >
< / form >
<?php
} else if($action == 'delete'){
}
function displayDeleteClanRoom($raumname, $raumid) {
?>
< table >
<?php
@ -155,35 +204,118 @@ function displayClanItems($action, $raumid, $raumname, $staerke, $verteidigung,
mysql_query('DELETE FROM clan_ware where item_id ='.$raumid);
?>
< tr >
< td align = "center" colspan = "2" >
Der Raum "<?php echo $raumname ; ?> " wurde gelö scht
< / td >
< td align = "center" colspan = "2" > Der Raum "<?php echo $raumname ; ?> "
wurde gelö 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ö schen? < a href = " <?php echo $_SERVER [ 'PHP_SELF' ] . '?choose=clanitems&action=delete&raumid=' . $raumid . '&raumname=' . $res [ 'name' ]; ?> " > Lö schen bestä tigen!</ a >
< td align = "center" colspan = "2" > Den Raum "<?php echo $res [ 'name' ]; ?> "
wirklich lö schen? < a
href="<?php echo $_SERVER [ 'PHP_SELF' ] . '?choose=clan&action=deleterooms&raumid=' . $raumid . '&raumname=' . $res [ 'name' ]; ?> ">Lö schen
bestä tigen!< / a >
< / td >
< / tr >
<?php
}
?>
< tr >
< td align = "center" colspan = "2" > < a
href="<?php echo $_SERVER [ 'PHP_SELF' ] . '?choose=clan&action=rooms' ; ?> ">Zur
Ü bersicht< / a >
< / td >
< / tr >
< tr >
< td align = "center" colspan = "2" > < a
href="<?php echo $_SERVER [ 'PHP_SELF' ] . '?choose=clan' ; ?> ">Zum
Clanmenu< / a >
< / td >
< / tr >
< / table >
<?php
}
function displayGeneralOptions($ccfee) {
$change = false;
if($ccfee != null & & $ccfee != CLAN_CREATION_FEE) {
setDefine('CLAN_CREATION_FEE', $ccfee);
}
?>
< form method = "POST" >
< input type = "hidden" name = "choose" value = "clan" >
< input type = "hidden" name = "action" value = "general" >
< table width = "50%" >
< tr >
< th colspan = "2" align = "center" > < h1 > Übersicht< / h1 > < / th >
< / tr >
<?php if ( $change === TRUE ) { ?>
< tr >
< td colspan = "2" align = "center" > Ä nderungen ü bernommen!< / td >
< / tr >
<?php } ?>
< tr >
< td align = "left" > Grü ndungsgebü hr< / td >
< td align = "center" >< input type = "text" name = "ccfee" value = <?php echo ( $ccfee == null ) ? CLAN_CREATION_FEE : $ccfee ; ?> > </td >
< / tr >
< tr >
< td align = "center" colspan = "2" > < input type = "submit" value = "ändern" > < / td >
< / tr >
< tr >
< td align = "center" colspan = "2" > < a
href="<?php echo $_SERVER [ 'PHP_SELF' ] . '?choose=clan' ; ?> ">Zum Clanmenu</ a >
< / td >
< / tr >
< / table >
< / form >
<?php
}
function displayClanOptions() {
?>
< table >
< tr >
< td > < a
href="<?php echo $_SERVER [ 'PHP_SELF' ]; ?> ?choose=clan& action=general">Clanoptionen
bearbeiten< / a >
< / td >
< / tr >
< tr >
< td align = "center" colspan = "2" >
< a href = " <?php echo $_SERVER [ 'PHP_SELF' ] . '?choose=clanitems' ; ?> " > Zur Ü bersicht</ a >
< td > < a
href="<?php echo $_SERVER [ 'PHP_SELF' ]; ?> ?choose=clan&action=rooms">Clanrä ume
bearbeiten< / a >
< / td >
< / tr >
< tr >
< td align = "center" colspan = "2" >
< a href = " <?php echo $_SERVER [ 'PHP_SELF' ]; ?> " > Zum Hauptmenu</ a >
< td >< a href = " <?php echo $_SERVER [ 'PHP_SELF' ]; ?> " > Zum Hauptmenu</ a >< br >
< / td >
< / tr >
< / table >
<?php
}
function displayClanMenu($action, $raumid, $raumname, $staerke, $verteidigung, $glueck, $ausdauer, $geschwindigkeit, $info, $level, $ccfee) {
switch ($action) {
case 'editrooms':
displayEditOrCreateClanRoom($action, $raumid, $raumname, $staerke, $verteidigung, $glueck, $ausdauer, $geschwindigkeit, $info, $level);
break;
case 'createrooms':
displayEditOrCreateClanRoom($action, $raumid, $raumname, $staerke, $verteidigung, $glueck, $ausdauer, $geschwindigkeit, $info, $level);
break;
case 'deleterooms':
displayDeleteClanRoom($raumname, $raumid);
break;
case 'rooms':
displayClanItems();
break;
case 'general':
displayGeneralOptions($ccfee);
break;
default:
displayClanOptions();
break;
}
}
?>