attacken.inc.php überarbeitet, Code verbessert, Attackenset-Condition leerimplementiert

main
radiskull 13 years ago
parent 7ea5d22f33
commit af296fbb8c

@ -223,7 +223,7 @@ if(checkLoginData($_SESSION['user'],$_SESSION['password'])){
} else if($_REQUEST['choose'] == 'logout'){
logout();
} else if($_REQUEST['choose'] == 'attacken'){
displayAttackeOptions($_REQUEST['action'], $_REQUEST['attackname'], $_REQUEST['attackid'], $_REQUEST['depth'], $_REQUEST['name'], $_REQUEST['starke'], $_REQUEST['verteidigung'], $_REQUEST['speed'], $_REQUEST['hp'], $_REQUEST['mp'], $_REQUEST['rassen'], $_REQUEST['level'], $_REQUEST['geld'], $_REQUEST['type'], $_REQUEST['info'], $_REQUEST['req_atk'], $_REQUEST['req_lvl'], $_REQUEST['Frucht'], $_REQUEST['runden'], $_REQUEST['maxlvl']);
displayAttackenMenu($_REQUEST['action'], $_REQUEST['attackname'], $_REQUEST['attackid'], $_REQUEST['depth'], $_REQUEST['name'], $_REQUEST['starke'], $_REQUEST['verteidigung'], $_REQUEST['speed'], $_REQUEST['hp'], $_REQUEST['mp'], $_REQUEST['rassen'], $_REQUEST['level'], $_REQUEST['geld'], $_REQUEST['type'], $_REQUEST['info'], $_REQUEST['req_atk'], $_REQUEST['req_lvl'], $_REQUEST['Frucht'], $_REQUEST['runden'], $_REQUEST['maxlvl']);
} else if($_REQUEST['choose'] == 'bann'){
displayBannOptions($_REQUEST['action'], $_REQUEST['username'],$_REQUEST['opfer'],$_REQUEST['gamebann'],$_REQUEST['shoutbann'],$_REQUEST['forenbann'],$_REQUEST['anonid']);
} else if($_REQUEST['choose'] == 'items'){

@ -8,7 +8,7 @@
*/
?>
<?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){
function displayAttackenMenu($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>
@ -30,6 +30,29 @@ function displayAttackeOptions($action, $attackname, $attackid, $depth, $name, $
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=attacken&action=delete">Attacke l&ouml;schen</a>
</td>
</tr>
<tr>
<th>Attackenset-Conditions</th>
</tr>
<tr>
<td>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=attacken">Condition erstellen</a>
</td>
</tr>
<tr>
<td>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=attacken">Condition editieren</a>
</td>
</tr>
<tr>
<td>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=attacken">Condition l&ouml;schen</a>
</td>
</tr>
<tr>
<td>
<br>
</td>
</tr>
<tr>
<td>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a><br>
@ -38,8 +61,23 @@ function displayAttackeOptions($action, $attackname, $attackid, $depth, $name, $
</table>
<?php
} else if(($action == 'delete' || $action == 'edit') && $attackname === NULL && $attackid === NULL){
searchfirstAttack($action);
} else if(($action == 'delete' || $action == 'edit') && $attackid === NULL){
searchsecondAttack($action, $attackname);
} else if(($action == 'create' || $action == 'edit') && $depth === NULL){
createOrEditAttack($action, $attackid);
} else if($action == 'create' && $depth == 1){
createAttack($attackname, $Frucht, $starke, $verteidigung, $speed, $hp, $mp, $rassen, $level, $geld, $type, $info, $req_atk, $req_lvl, $runden, $maxlvl);
} else if($action == 'delete' && $depth >= 1){
deleteAttack($attackid, $depth);
} else if($action == 'edit' && $depth == 1){
editAttack($attackname, $attackid, $Frucht, $starke, $verteidigung, $speed, $hp, $mp, $rassen, $level, $geld, $type, $info, $req_atk, $req_lvl, $runden, $maxlvl);
}
}
function searchfirstAttack($action) {
?>
<form action="" method="POST">
<form action="" method="POST">
<input name="choose" value="attacken" type="hidden"></input>
<input name="action" value="<?php echo $action; ?>" type="hidden"></input>
<table>
@ -61,10 +99,11 @@ function displayAttackeOptions($action, $attackname, $attackid, $depth, $name, $
</tr>
</table>
</form>
<?php
} else if(($action == 'delete' || $action == 'edit') && $attackid === NULL){
$qry = mysql_query('Select name,id from attacken where name like \'%'.$attackname.'%\'');
<?php
}
function searchsecondAttack($action, $attackname) {
$qry = mysql_query('Select name,id from attacken where name like \'%'.$attackname.'%\'');
?>
<form action="" method="POST">
<input name="choose" value="attacken" type="hidden"></input>
@ -96,8 +135,10 @@ function displayAttackeOptions($action, $attackname, $attackid, $depth, $name, $
</table>
</form>
<?php
} else if(($action == 'create' || $action == 'edit') && $depth === NULL){
if($action == 'edit'){
}
function createOrEditAttack($action, $attackid) {
if($action == 'edit'){
$row = mysql_fetch_assoc(mysql_query('Select * from attacken where id ='.$attackid));
}
@ -124,7 +165,7 @@ function displayAttackeOptions($action, $attackname, $attackid, $depth, $name, $
Name:
</td>
<td>
<input name='attackname' value='<?php echo $row[name]===NULL?'Attackenname':$row[name]; ?>'></input>
<input name='attackname' value='<?php echo $row['name']===NULL?'Attackenname':$row['name']; ?>'></input>
</td>
</tr>
<tr>
@ -132,7 +173,7 @@ function displayAttackeOptions($action, $attackname, $attackid, $depth, $name, $
St&auml;rke:
</td>
<td>
<input name='starke' value='<?php echo $row[starke]===NULL?0:$row[starke]; ?>'></input>
<input name='starke' value='<?php echo $row['starke']===NULL?0:$row['starke']; ?>'></input>
</td>
</tr>
<tr>
@ -140,7 +181,7 @@ function displayAttackeOptions($action, $attackname, $attackid, $depth, $name, $
Verteidigung:
</td>
<td>
<input name='verteidigung' value='<?php echo $row[verteidigung]===NULL?0:$row[verteidigung]; ?>'></input>
<input name='verteidigung' value='<?php echo $row['verteidigung']===NULL?0:$row['verteidigung']; ?>'></input>
</td>
</tr>
<tr>
@ -148,7 +189,7 @@ function displayAttackeOptions($action, $attackname, $attackid, $depth, $name, $
Speed:
</td>
<td>
<input name='speed' value='<?php echo $row[speed]===NULL?0:$row[speed]; ?>'></input>
<input name='speed' value='<?php echo $row['speed']===NULL?0:$row['speed']; ?>'></input>
</td>
</tr>
<tr>
@ -156,7 +197,7 @@ function displayAttackeOptions($action, $attackname, $attackid, $depth, $name, $
HP:
</td>
<td>
<input name='hp' value='<?php echo $row[hp]===NULL?0:$row[hp]; ?>'></input>
<input name='hp' value='<?php echo $row['hp']===NULL?0:$row['hp']; ?>'></input>
</td>
</tr>
<tr>
@ -164,7 +205,7 @@ function displayAttackeOptions($action, $attackname, $attackid, $depth, $name, $
MP:
</td>
<td>
<input name='mp' value='<?php echo $row[mp]===NULL?0:$row[mp]; ?>'></input>
<input name='mp' value='<?php echo $row['mp']===NULL?0:$row['mp']; ?>'></input>
</td>
</tr>
<tr>
@ -172,7 +213,7 @@ function displayAttackeOptions($action, $attackname, $attackid, $depth, $name, $
Rassen:
</td>
<td>
<input name='rassen' value='<?php echo $row[rassen]===NULL?0:$row[rassen]; ?>'></input>
<input name='rassen' value='<?php echo $row['rassen']===NULL?0:$row['rassen']; ?>'></input>
</td>
</tr>
<tr>
@ -180,7 +221,7 @@ function displayAttackeOptions($action, $attackname, $attackid, $depth, $name, $
Level:
</td>
<td>
<input name='level' value='<?php echo $row[level]===NULL?0:$row[level]; ?>'></input>
<input name='level' value='<?php echo $row['level']===NULL?0:$row['level']; ?>'></input>
</td>
</tr>
<tr>
@ -188,7 +229,7 @@ function displayAttackeOptions($action, $attackname, $attackid, $depth, $name, $
Geld:
</td>
<td>
<input name='geld' value='<?php echo $row[geld]===NULL?0:$row[geld]; ?>'></input>
<input name='geld' value='<?php echo $row['geld']===NULL?0:$row['geld']; ?>'></input>
</td>
</tr>
<tr>
@ -196,7 +237,7 @@ function displayAttackeOptions($action, $attackname, $attackid, $depth, $name, $
Type:
</td>
<td>
<input name='type' value='<?php echo $row[type]===NULL?'normal':$row[type]; ?>'></input>
<input name='type' value='<?php echo $row['type']===NULL?'normal':$row['type']; ?>'></input>
</td>
</tr>
<tr>
@ -204,7 +245,7 @@ function displayAttackeOptions($action, $attackname, $attackid, $depth, $name, $
Info:
</td>
<td>
<input name='info' value='<?php echo $row[info]===NULL?'No Info available yet!':$row[info]; ?>'></input>
<input name='info' value='<?php echo $row['info']===NULL?'No Info available yet!':$row['info']; ?>'></input>
</td>
</tr>
<tr>
@ -212,7 +253,7 @@ function displayAttackeOptions($action, $attackname, $attackid, $depth, $name, $
Required Attacks:
</td>
<td>
<input name='req_atk' value='<?php echo $row[req_atk]===NULL?0:$row[req_atk]; ?>'></input>
<input name='req_atk' value='<?php echo $row['req_atk']===NULL?0:$row['req_atk']; ?>'></input>
</td>
</tr>
<tr>
@ -220,7 +261,7 @@ function displayAttackeOptions($action, $attackname, $attackid, $depth, $name, $
Required Level:
</td>
<td>
<input name='req_lvl' value='<?php echo $row[req_lvl]===NULL?0:$row[req_lvl]; ?>'></input>
<input name='req_lvl' value='<?php echo $row['req_lvl']===NULL?0:$row['req_lvl']; ?>'></input>
</td>
</tr>
<tr>
@ -257,7 +298,7 @@ function displayAttackeOptions($action, $attackname, $attackid, $depth, $name, $
Runden:
</td>
<td>
<input name='runden' value='<?php echo $row[runden]===NULL?0:$row[runden]; ?>'></input>
<input name='runden' value='<?php echo $row['runden']===NULL?0:$row['runden']; ?>'></input>
</td>
</tr>
<tr>
@ -265,7 +306,7 @@ function displayAttackeOptions($action, $attackname, $attackid, $depth, $name, $
Maxlvl:
</td>
<td>
<input name='maxlvl' value='<?php echo $row['maxlvl']===NULL?0:$row[maxlvl]; ?>'></input>
<input name='maxlvl' value='<?php echo $row['maxlvl']===NULL?0:$row['maxlvl']; ?>'></input>
</td>
</tr>
<tr>
@ -281,8 +322,10 @@ function displayAttackeOptions($action, $attackname, $attackid, $depth, $name, $
</table>
</form>
<?php
} else if($action == 'create' && $depth == 1){
if($Frucht != 0){
}
function createAttack($attackname, $Frucht, $starke, $verteidigung, $speed, $hp, $mp, $rassen, $level, $geld, $type, $info, $req_atk, $req_lvl, $runden, $maxlvl) {
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;
@ -292,8 +335,10 @@ function displayAttackeOptions($action, $attackname, $attackid, $depth, $name, $
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){
}
function deleteAttack($attackid, $depth) {
if($depth == 4){
$sql = 'Delete from attacken where id = '.$attackid;
// echo 'Debugnachricht: '.$sql.'<br>';
mysql_query($sql);
@ -307,8 +352,10 @@ function displayAttackeOptions($action, $attackname, $attackid, $depth, $name, $
?>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));
}
function editAttack($attackname, $attackid, $Frucht, $starke, $verteidigung, $speed, $hp, $mp, $rassen, $level, $geld, $type, $info, $req_atk, $req_lvl, $runden, $maxlvl) {
$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 {
@ -321,9 +368,8 @@ function displayAttackeOptions($action, $attackname, $attackid, $depth, $name, $
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
}
?><a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=attacken">Zum Attackenmenü</a>, <a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a><br><?php
}
?>
Loading…
Cancel
Save