radiskull 13 years ago
parent 807faace93
commit 5d691a9697

@ -11,54 +11,55 @@
function displayAttackenMenu($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){ if($action === NULL){
?> ?>
<table> <table>
<tr> <tr>
<th>Attacken</th> <th>Attacken</th>
</tr> </tr>
<tr> <tr>
<td> <td><a
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=attacken&action=create">Attacke erstellen</a> href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=attacken&action=create">Attacke
erstellen</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td><a
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=attacken&action=edit">Attacke editieren</a> href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=attacken&action=edit">Attacke
editieren</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td><a
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=attacken&action=delete">Attacke l&ouml;schen</a> href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=attacken&action=delete">Attacke
l&ouml;schen</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<th>Attackenset-Conditions</th> <th>Attackenset-Conditions</th>
</tr> </tr>
<tr> <tr>
<td> <td><a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=attacken">Condition
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=attacken">Condition erstellen</a> erstellen</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td><a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=attacken">Condition
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=attacken">Condition editieren</a> editieren</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td><a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=attacken">Condition
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=attacken">Condition l&ouml;schen</a> l&ouml;schen</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td><br>
<br>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td><a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a><br>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a><br>
</td> </td>
</tr> </tr>
</table> </table>
<?php <?php
} else if(($action == 'delete' || $action == 'edit') && $attackname === NULL && $attackid === NULL){ } else if(($action == 'delete' || $action == 'edit') && $attackname === NULL && $attackid === NULL){
searchfirstAttack($action); searchfirstAttack($action);
@ -77,45 +78,41 @@ function displayAttackenMenu($action, $attackname, $attackid, $depth, $name, $st
function searchfirstAttack($action) { function searchfirstAttack($action) {
?> ?>
<form action="" method="POST"> <form action="" method="POST">
<input name="choose" value="attacken" type="hidden"></input> <input name="choose" value="attacken" type="hidden"></input> <input
<input name="action" value="<?php echo $action; ?>" type="hidden"></input> name="action" value="<?php echo $action; ?>" type="hidden"></input>
<table> <table>
<tr> <tr>
<th colspan="2">Attacke suchen</th> <th colspan="2">Attacke suchen</th>
</tr> </tr>
<tr> <tr>
<td> <td><input name="attackname">
<input name="attackname">
</td> </td>
<td> <td><input type="submit" name="suche">
<input type="submit" name="suche">
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td><a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a><br>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a><br>
</td> </td>
</tr> </tr>
</table> </table>
</form> </form>
<?php <?php
} }
function searchsecondAttack($action, $attackname) { function searchsecondAttack($action, $attackname) {
$qry = mysql_query('Select name,id from attacken where name like \'%'.$attackname.'%\''); $qry = mysql_query('Select name,id from attacken where name like \'%'.$attackname.'%\'');
?> ?>
<form action="" method="POST"> <form action="" method="POST">
<input name="choose" value="attacken" type="hidden"></input> <input name="choose" value="attacken" type="hidden"></input> <input
<input name="action" value="<?php echo $action; ?>" type="hidden"></input> name="action" value="<?php echo $action; ?>" type="hidden"></input>
<?php if($action == 'delete'){ echo '<input name="depth" value="1" type="hidden"></input>'; }?> <?php if($action == 'delete'){ echo '<input name="depth" value="1" type="hidden"></input>'; }?>
<table> <table>
<tr> <tr>
<th colspan="2">Attacke ausw&auml;hlen</th> <th colspan="2">Attacke ausw&auml;hlen</th>
</tr> </tr>
<tr> <tr>
<td> <td><select name="attackid">
<select name="attackid">
<?php <?php
while($row = mysql_fetch_assoc($qry)){ while($row = mysql_fetch_assoc($qry)){
echo '<option value="'.$row['id'].'">'.$row['name'].'</option>\n'; echo '<option value="'.$row['id'].'">'.$row['name'].'</option>\n';
@ -123,17 +120,15 @@ function searchsecondAttack($action, $attackname) {
?> ?>
</select> </select>
</td> </td>
<td> <td><input type="submit" name="ausw&auml;hlen">
<input type="submit" name="ausw&auml;hlen">
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td><a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a><br>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a><br>
</td> </td>
</tr> </tr>
</table> </table>
</form> </form>
<?php <?php
} }
@ -141,141 +136,182 @@ function createOrEditAttack($action, $attackid) {
if($action == 'edit'){ if($action == 'edit'){
$row = mysql_fetch_assoc(mysql_query('Select * from attacken where id ='.$attackid)); $row = mysql_fetch_assoc(mysql_query('Select * from attacken where id ='.$attackid));
} }
//Alle attacken auslesen
$att_qry = mysql_query('SELECT id,name FROM attacken WHERE info not like \'%NPC%\' ORDER BY name');
$available_attacks = array();
while($attacks = mysql_fetch_assoc($att_qry)) {
$available_attacks[] = array($attacks['id'], $attacks['name']);
}
$used_attacks = explode(',', $row['req_atk']);
?> ?>
<form action="" method="POST"> <form action="" method="POST">
<input name="choose" value="attacken" type="hidden"></input> <input name="choose" value="attacken" type="hidden"></input> <input
<input name="action" value="<?php echo $action; ?>" type="hidden"></input> name="action" value="<?php echo $action; ?>" type="hidden"></input> <input
<input name="attackid" value="<?php echo $attackid; ?>" type="hidden"></input> name="attackid" value="<?php echo $attackid; ?>" type="hidden"></input>
<input name="depth" value="1" type="hidden"></input> <input name="depth" value="1" type="hidden"></input>
<table> <table>
<tr> <tr>
<th colspan="2">Attacke</th> <th colspan="2">Attacke</th>
</tr> </tr>
<tr> <tr>
<td> <td>ID:</td>
ID: <td><?php echo $attackid; ?>
</td>
<td>
<?php echo $attackid; ?>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>Name:</td>
Name: <td><input name='attackname'
</td> value='<?php echo $row['name']===NULL?'Attackenname':$row['name']; ?>'></input>
<td>
<input name='attackname' value='<?php echo $row['name']===NULL?'Attackenname':$row['name']; ?>'></input>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>St&auml;rke:</td>
St&auml;rke: <td><input name='starke'
</td> value='<?php echo $row['starke']===NULL?0:$row['starke']; ?>'></input>
<td>
<input name='starke' value='<?php echo $row['starke']===NULL?0:$row['starke']; ?>'></input>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>Verteidigung:</td>
Verteidigung: <td><input name='verteidigung'
</td> value='<?php echo $row['verteidigung']===NULL?0:$row['verteidigung']; ?>'></input>
<td>
<input name='verteidigung' value='<?php echo $row['verteidigung']===NULL?0:$row['verteidigung']; ?>'></input>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>Speed:</td>
Speed: <td><input name='speed'
</td> value='<?php echo $row['speed']===NULL?0:$row['speed']; ?>'></input>
<td>
<input name='speed' value='<?php echo $row['speed']===NULL?0:$row['speed']; ?>'></input>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>HP:</td>
HP: <td><input name='hp'
</td> value='<?php echo $row['hp']===NULL?0:$row['hp']; ?>'></input>
<td>
<input name='hp' value='<?php echo $row['hp']===NULL?0:$row['hp']; ?>'></input>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>MP:</td>
MP: <td><input name='mp'
</td> value='<?php echo $row['mp']===NULL?0:$row['mp']; ?>'></input>
<td>
<input name='mp' value='<?php echo $row['mp']===NULL?0:$row['mp']; ?>'></input>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>Rassen:</td>
Rassen: <td><input name='rassen'
</td> value='<?php echo $row['rassen']===NULL?0:$row['rassen']; ?>'></input>
<td>
<input name='rassen' value='<?php echo $row['rassen']===NULL?0:$row['rassen']; ?>'></input>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>Level:</td>
Level: <td><input name='level'
</td> value='<?php echo $row['level']===NULL?0:$row['level']; ?>'></input>
<td>
<input name='level' value='<?php echo $row['level']===NULL?0:$row['level']; ?>'></input>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>Geld:</td>
Geld: <td><input name='geld'
</td> value='<?php echo $row['geld']===NULL?0:$row['geld']; ?>'></input>
<td>
<input name='geld' value='<?php echo $row['geld']===NULL?0:$row['geld']; ?>'></input>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>Type:</td>
Type: <td><select name="type">
</td> <?php
<td> $types = array('normal', 'kaioken', 'kaioken2', 'SSJ', 'lose', 'lose2', 'hpmp', 'hp', 'tausch', 'tausch2', 'majin', 'copy', 'runde', 'frucht', 'konterhp');
<input name='type' value='<?php echo $row['type']===NULL?'normal':$row['type']; ?>'></input> foreach ($types as $type) {
if($row['type'] == $type){
echo '<option value="'.$type.'" selected="selected">'.$type.'</option>';
} else{
echo '<option value="'.$type.'">'.$type.'</option>';
}
}
?>
</select>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>Info:</td>
Info: <td><input name='info'
</td> value='<?php echo $row['info']===NULL?'No Info available yet!':$row['info']; ?>'></input>
<td>
<input name='info' value='<?php echo $row['info']===NULL?'No Info available yet!':$row['info']; ?>'></input>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>Required Attacks:</td>
Required Attacks: <td><select name="req_atk[0]">
</td> <?php
<td> if($used_attacks[0] == 0){
<input name='req_atk' value='<?php echo $row['req_atk']===NULL?0:$row['req_atk']; ?>'></input> echo '<option value="0" selected="selected">-Keine-</option>';
} else {
echo '<option value="0">-Keine-</option>';
}
foreach ($available_attacks as $attack) {
if($attack[0] == $used_attacks[0]){
echo '<option value="'.$attack[0].'" selected="selected">'.$attack[1].'</option>';
} else{
echo '<option value="'.$attack[0].'">'.$attack[1].'</option>';
}
}
?>
</select>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td></td>
Required Level: <td><select name="req_atk[1]">
<?php
if($used_attacks[1] == 0){
echo '<option value="0" selected="selected">-Keine-</option>';
} else {
echo '<option value="0">-Keine-</option>';
}
foreach ($available_attacks as $attack) {
if($attack[0] == $used_attacks[1]){
echo '<option value="'.$attack[0].'" selected="selected">'.$attack[1].'</option>';
} else{
echo '<option value="'.$attack[0].'">'.$attack[1].'</option>';
}
}
?>
</select>
</td> </td>
<td> </tr>
<input name='req_lvl' value='<?php echo $row['req_lvl']===NULL?0:$row['req_lvl']; ?>'></input> <tr>
<td></td>
<td><select name="req_atk[2]">
<?php
if($used_attacks[2] == 0){
echo '<option value="0" selected="selected">-Keine-</option>';
} else {
echo '<option value="0">-Keine-</option>';
}
foreach ($available_attacks as $attack) {
if($attack[0] == $used_attacks[2]){
echo '<option value="'.$attack[0].'" selected="selected">'.$attack[1].'</option>';
} else{
echo '<option value="'.$attack[0].'">'.$attack[1].'</option>';
}
}
?>
</select>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>Required Level:</td>
Frucht: <td><input name='req_lvl'
value='<?php echo $row['req_lvl']===NULL?0:$row['req_lvl']; ?>'></input>
</td> </td>
<td> </tr>
<select name = "Frucht"> <tr>
<td>Frucht:</td>
<td><select name="Frucht">
<?php <?php
// Fuers dropdown // Fuers dropdown
$f_sql = 'SELECT id, item FROM wochen_markt WHERE type = \'Teufels Frucht\' order by item'; $f_sql = 'SELECT id, item FROM wochen_markt WHERE type = \'Teufels Frucht\' order by item';
$f_qry = mysql_query($f_sql); $f_qry = mysql_query($f_sql);
// <input name='Frucht' value='<?php echo $row[Frucht]===NULL?0:$row[Frucht]; '></input> // <input name='Frucht' value='<?php echo $row[Frucht]===NULL?0:$row[Frucht]; '></input>
if($row['Frucht'] === NULL || $row['Frucht'] == 0){ if($row['Frucht'] === NULL || $row['Frucht'] == 0){
echo '<option value="0" selected="selected">-Keine-</option>'; echo '<option value="0" selected="selected">-Keine-</option>';
} else { } else {
@ -294,33 +330,27 @@ function createOrEditAttack($action, $attackid) {
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>Runden:</td>
Runden: <td><input name='runden'
</td> value='<?php echo $row['runden']===NULL?0:$row['runden']; ?>'></input>
<td>
<input name='runden' value='<?php echo $row['runden']===NULL?0:$row['runden']; ?>'></input>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>Maxlvl:</td>
Maxlvl: <td><input name='maxlvl'
</td> value='<?php echo $row['maxlvl']===NULL?0:$row['maxlvl']; ?>'></input>
<td>
<input name='maxlvl' value='<?php echo $row['maxlvl']===NULL?0:$row['maxlvl']; ?>'></input>
</td> </td>
</tr> </tr>
<tr> <tr>
<td colspan="2"> <td colspan="2"><input type="submit" value='<?php echo $action; ?>'></input>
<input type="submit" value='<?php echo $action; ?>'></input>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td><a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a><br>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a><br>
</td> </td>
</tr> </tr>
</table> </table>
</form> </form>
<?php <?php
} }
@ -333,14 +363,19 @@ function createAttack($attackname, $Frucht, $starke, $verteidigung, $speed, $hp,
echo $sql.'<br>'; echo $sql.'<br>';
mysql_query($sql); mysql_query($sql);
logaction('Attacke '.$attackname.' wurde erstellt!'); logaction('Attacke '.$attackname.' wurde erstellt!');
?>Attacke sollte nun erstellt sein!!<br><a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a><br><?php ?>
Attacke sollte nun erstellt sein!!
<br>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a>
<br>
<?php
} }
function deleteAttack($attackid, $depth) { function deleteAttack($attackid, $depth) {
if($depth == 4){ if($depth == 4){
$sql = 'Delete from attacken where id = '.$attackid; $sql = 'Delete from attacken where id = '.$attackid;
// echo 'Debugnachricht: '.$sql.'<br>'; // echo 'Debugnachricht: '.$sql.'<br>';
mysql_query($sql); mysql_query($sql);
mysql_query('Delete from lernen where at_id = '.$attackid); mysql_query('Delete from lernen where at_id = '.$attackid);
logaction('Attacke mit id = '.$attackid.' wurde geloescht!'); logaction('Attacke mit id = '.$attackid.' wurde geloescht!');
@ -349,13 +384,25 @@ function deleteAttack($attackid, $depth) {
for($i=0;$i<$depth;$i++){ for($i=0;$i<$depth;$i++){
$wirklich .= 'wirklich '; $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 ?>
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 ?>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a>
<br>
<?php
} }
function editAttack($attackname, $attackid, $Frucht, $starke, $verteidigung, $speed, $hp, $mp, $rassen, $level, $geld, $type, $info, $req_atk, $req_lvl, $runden, $maxlvl) { 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)); $row = mysql_fetch_assoc(mysql_query('Select * from attacken where id ='.$attackid));
$req_atk = implode(',', $req_atk);
if($Frucht != 0){ 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; $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 { } else {
@ -364,11 +411,17 @@ function editAttack($attackname, $attackid, $Frucht, $starke, $verteidigung, $sp
if($row['name'] != $attackname){ if($row['name'] != $attackname){
mysql_query('Update lernen set name = \''.$attackname.'\' WHERE at_id ='.$attackid); mysql_query('Update lernen set name = \''.$attackname.'\' WHERE at_id ='.$attackid);
} }
// echo 'Debugnachricht: '.$sql.'<br>'; // echo 'Debugnachricht: '.$sql.'<br>';
mysql_query($sql); mysql_query($sql);
logaction('Attacke mit dem jetzigen Namen '.$attackname.' wurde editiert!'); 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