Meine Techniken Anzeige überarbeitet (Anzeige aller Attacken und deren Vorraussetzung + Testuser können Attacken (auswählen) sofort lernen)

Bugs behoben/Code Verbesserungen durchgeführt
main
radiskull 14 years ago
parent c2b99ec1c6
commit a167c6bfce

@ -28,10 +28,7 @@ $char_bild = validateURL($_GET['char_bild']);
$char_lvl = validateInteger($_GET['char_lvl'], NULL); $char_lvl = validateInteger($_GET['char_lvl'], NULL);
// Unkritisch // Unkritisch
if($_POST['charm'] === NULL) { $charm = $_REQUEST['charm'];
$charm = $_GET['charm'];
} else
$charm = $_POST['charm'];
$char_type = $_GET['char_type']; $char_type = $_GET['char_type'];
?> ?>
@ -345,7 +342,8 @@ if ($anzahl_charactere < $chars_max) {
} else if($charm == 3) { } else if($charm == 3) {
handleThirdPhaseForTester($char_1_type, $char_name, $char_lvl); handleThirdPhaseForTester($char_1_type, $char_name, $char_lvl);
} else if($charm == 4) { } else if($charm == 4) {
handleErstelleCharRequestOfTestUser($user_ida, $_POST['char_type'], $_POST['char_name'], $_POST['char_bild'], $_POST['lvl'], $_POST['lp'], $_POST['hp'], $_POST['mp'], $_POST['str'], $_POST['def'], $_POST['spd'], $_POST['end'], $_POST['lck']); handleErstelleCharRequestOfTestUser($user_ida, $_REQUEST['char_type'], $_REQUEST['char_name'], $_REQUEST['char_bild'], $_REQUEST['lvl'], $_REQUEST['lp'],
$_REQUEST['hp'], $_REQUEST['mp'], $_REQUEST['str'], $_REQUEST['def'], $_REQUEST['spd'], $_REQUEST['end'], $_REQUEST['lck']);
} }
} else { } else {
echo 'Du hast bereits die maximal mögliche Menge an Characteren erstellt, die du erstellen kannst.<br />Nämlich '.$anzahl_charactere.' von '.$chars_max.' Charaktere.'; echo 'Du hast bereits die maximal mögliche Menge an Characteren erstellt, die du erstellen kannst.<br />Nämlich '.$anzahl_charactere.' von '.$chars_max.' Charaktere.';

@ -35,26 +35,27 @@ function getOtherUserGroups($user) {
} }
function displayUserGroups($action, $name, $ugname, $delete, $add) { function displayUserGroups($action, $name, $ugname, $delete, $add) {
if($action === 'search') { if($action === 'search') {
$username = validateName($name); $username = validateName($name);
if ($delete !== NULL && $delete >= 0) { if($username !== NULL) {
$qry = 'DELETE FROM user_gruppe_zuordnung WHERE user_id in (SELECT id FROM user WHERE nickname = \''.$username. if ($delete !== NULL && $delete >= 0) {
$qry = 'DELETE FROM user_gruppe_zuordnung WHERE user_id in (SELECT id FROM user WHERE nickname = \''.$username.
'\') AND gruppen_id = '.$delete.';'; '\') AND gruppen_id = '.$delete.';';
mysql_query($qry); mysql_query($qry);
} else if($add !== NULL && $add >= 0) { } else if($add !== NULL && $add >= 0) {
$qry = 'INSERT INTO user_gruppe_zuordnung(user_id, gruppen_id) $qry = 'INSERT INTO user_gruppe_zuordnung(user_id, gruppen_id)
VALUES((SELECT id FROM user WHERE nickname = \''.$username.'\'), '.$add.');'; VALUES((SELECT id FROM user WHERE nickname = \''.$username.'\'), '.$add.');';
mysql_query($qry); mysql_query($qry);
} }
$usergroups = getUserGroups($username); $usergroups = getUserGroups($username);
$notusergroups = getOtherUserGroups($username); $notusergroups = getOtherUserGroups($username);
?> ?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST"> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<input name="choose" value="usergroups" type="hidden"></input> <input name="choose" value="usergroups" type="hidden"></input> <input
<input name="action" value="search" type="hidden"></input> name="action" value="search" type="hidden"></input> <input
<input name="uname" value="<?php echo $username; ?>" type="hidden"></input> name="uname" value="<?php echo $username; ?>" type="hidden"></input>
<table width="80%"> <table width="80%">
<tr> <tr>
<th align="center" colspan="3">User <?php echo $username;?></th> <th align="center" colspan="3">User <?php echo $username;?></th>
@ -107,7 +108,9 @@ function displayUserGroups($action, $name, $ugname, $delete, $add) {
</tr> </tr>
</table> </table>
</form> </form>
<?php <?php } else {
echo 'Ungültiger Username!<br><a href='.$_SERVER['PHP_SELF'].'?choose=usergroups>Zur&uuml;ck</a>';
}
} else if($action === 'show') { } else if($action === 'show') {
$username = validateName($ugname); $username = validateName($ugname);
$sqlqry = 'SELECT u.nickname FROM user_gruppe_zuordnung ugz $sqlqry = 'SELECT u.nickname FROM user_gruppe_zuordnung ugz
@ -122,7 +125,7 @@ function displayUserGroups($action, $name, $ugname, $delete, $add) {
<tr> <tr>
<td colspan="3"> <td colspan="3">
<table border="1" width="100%"> <table border="1" width="100%">
<?php <?php
echo '<tr>'; echo '<tr>';
$x = 0; $x = 0;
while($row = mysql_fetch_assoc($usergroups_qry)){ while($row = mysql_fetch_assoc($usergroups_qry)){
@ -154,15 +157,15 @@ function displayUserGroups($action, $name, $ugname, $delete, $add) {
} else { } else {
?> ?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST"> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<input name="choose" value="usergroups" type="hidden"></input> <input name="choose" value="usergroups" type="hidden"></input> <input
<input name="action" value="search" type="hidden"></input> name="action" value="search" type="hidden"></input>
<table width="80%"> <table width="80%">
<tr> <tr>
<th align="center" colspan="3">User suchen</th> <th align="center" colspan="3">User suchen</th>
</tr> </tr>
<tr> <tr>
<td align="center">Username: <input name="uname" value="" /> <td align="center">Username: <input name="uname" value="" /> <input
<input type="submit" value="search" /> type="submit" value="search" />
</td> </td>
</tr> </tr>
<tr> <tr>
@ -190,7 +193,7 @@ function displayUserGroups($action, $name, $ugname, $delete, $add) {
</tr> </tr>
</table> </table>
</form> </form>
<?php <?php
} }
}?> }?>

@ -9,6 +9,9 @@
//Konstanten //Konstanten
define("admin", 1); define("admin", 1);
define("tester", 2); define("tester", 2);
define("entwickler", 2);
define("designer", 2);
define("Werbung_an", 2);
include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/parse.inc.php'); include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/parse.inc.php');

@ -9,8 +9,11 @@
include_once ($_SERVER['DOCUMENT_ROOT'] . 'ag/include/designfunctions.inc.php'); include_once ($_SERVER['DOCUMENT_ROOT'] . 'ag/include/designfunctions.inc.php');
include_once ($_SERVER['DOCUMENT_ROOT'] . 'ag/include/fehlerausgabe.inc.php'); include_once ($_SERVER['DOCUMENT_ROOT'] . 'ag/include/fehlerausgabe.inc.php');
include_once ($_SERVER['DOCUMENT_ROOT'] . 'ag/include/parse.inc.php'); include_once ($_SERVER['DOCUMENT_ROOT'] . 'ag/include/parse.inc.php');
include_once ($_SERVER['DOCUMENT_ROOT'] . 'ag/include/char.inc.php');
$char_id = validateUnsignedInteger($_GET['char_id'], null); $char_id = validateUnsignedInteger($_GET['char_id'], null);
$attack_id = validateUnsignedInteger($_REQUEST['attack_id'], null);
if ($char_id == null) { if ($char_id == null) {
include ($_SERVER['DOCUMENT_ROOT'] . 'ag/char_index.php'); include ($_SERVER['DOCUMENT_ROOT'] . 'ag/char_index.php');
exit; exit;
@ -19,27 +22,103 @@ if ($char_id == null) {
displayErrorMessage(NULL, 'Dieser Charakter geh&ouml;rt nicht dir.', displayHistoryBackLink()); displayErrorMessage(NULL, 'Dieser Charakter geh&ouml;rt nicht dir.', displayHistoryBackLink());
exit; exit;
} }
$use = mysql_query('SELECT a.name, l.benutzt FROM lernen l LEFT JOIN attacken a ON(a.id=l.at_id) WHERE l.besitzer='.$char_id.' ORDER BY l.id'); if ($attack_id != null) {
?> $test = 'INSERT INTO lernen(name, at_id,besitzer,aktiv) VALUES'.
<table border="0" width="480" height="83"> '((SELECT name FROM attacken WHERE id ='.$attack_id.'), '.$attack_id.', '.$char_id.', 1);';
<tr> $qry = mysql_query($test);
<td height="50" width="480" colspan="2">
<p align="center"><b>Technik System</b></td>
</tr>
<?php
while ($row = mysql_fetch_array($use)) {
?>
<tr>
<td height="25" width="152"><b>&nbsp; <?php echo $row[name]; ?></b></td>
<td height="25" width="312">&nbsp;<b><font color=#0000ff><?php echo $row[benutzt]; ?></font></b> mal im Kampf
eingesetzt.</td>
</tr>
<?php
} }
?> $attacks_learned = getAttacksforChar($char_id, 0);
</table> $attacks_unlearned = getAttacksforChar($char_id, 1);
<?php $testuser = isUserInGroup($usergroups, tester);
?>
<form
action=<?php echo $_SERVER['PHP_SELF'].'?as=info/lern&char_id='.$char_id; ?>
method="POST">
<table border="0" width="500" height="83">
<tr>
<td height="50" width="480" colspan="2">
<p align="center">
<b>Technik System</b>
</td>
</tr>
<tr>
<td width="100%">
<table border="0" width="100%">
<tr>
<th width="30%">Attacke</th>
<th width="10%">Level</th>
<th width="10%">eingesetzt</th>
<th width="10%">Anzahl</th>
<th width="40%">benötigte Attacken</th>
<?php if($testuser) {
echo '<th widht="5%">lernen?</th>';
}
?>
</tr>
<?php
foreach ($attacks_learned as $item) {
?>
<tr>
<td><b><?php echo $item['name']; ?> </b>
</td>
<td align="center">-</td>
<td align="center"><?php echo $item['benutzt'].'x'; ?>
</td>
<td align="center">-</td>
<td>gelernt!</td>
} </tr>
?> <?php
}
foreach ($attacks_unlearned as $item) {
?>
<tr>
<td><b><?php echo $item['name']; ?> </b></td>
<td align="center"><?php if($item['levelups']) {
echo $item['levelups'];
} else
echo '-';
?>
</td>
<td align="center">0x</td>
<td align="center"><?php if(isset($item['req'])) {
foreach($item['req'] as $requirenment) {
echo $requirenment['reggs'].'x<br>';
}
} else
echo '-';
?>
</td>
<td><?php if(isset($item['req'])) {
foreach($item['req'] as $requirenment) {
echo $requirenment['name'].'<br>';
}
} else
echo ' ';
if($testuser) {
echo '<td align="center">';
echo '<input type="radio" value="'.$item['id'].'" name="attack_id">';
echo '</td>';
}
?>
</td>
</tr>
<?php };?>
</table>
</td>
</tr>
<?php
if($testuser) {
echo '<tr>';
echo '<td><hr id="hrc"></td>';
echo '</tr>';
echo '<tr>';
echo '<td align="center"><input id="input" size="15" type="submit" value="lernen"></td>';
echo '</tr>';
}
?>
</table>
</form>
<?php }?>
Loading…
Cancel
Save