debug anzeige aus item genommen

anmelden/abmelden von offenen Clankämpfen eingebaut
main
radiskull 13 years ago
parent 538610351b
commit dd415b8ca6

@ -9,6 +9,7 @@
include_once(ROOT_PATH.'/include/clan.inc.php'); include_once(ROOT_PATH.'/include/clan.inc.php');
include_once(ROOT_PATH.'/include/fehlerausgabe.inc.php'); include_once(ROOT_PATH.'/include/fehlerausgabe.inc.php');
include_once(ROOT_PATH.'/include/parse.inc.php'); include_once(ROOT_PATH.'/include/parse.inc.php');
include_once(ROOT_PATH.'/include/char.inc.php');
//Get-Section //Get-Section
if(isset($_GET['action'])) { if(isset($_GET['action'])) {
@ -18,8 +19,20 @@ if(isset($_GET['action'])) {
} }
$challangedclan_id = validateUnsignedInteger($_GET['challangedclan_id'], null); $challangedclan_id = validateUnsignedInteger($_GET['challangedclan_id'], null);
$inquirychallenge_clanid = validateUnsignedInteger($_GET['clanid'], null); $inquirychallenge_clanid = validateUnsignedInteger($_GET['clanid'], null);
$clan_challange_id = validateUnsignedInteger($_GET['challenge'], null);
$char_id = validateUnsignedInteger($_GET['char'], null);
//unkritisch //unkritisch
if($action == null) {
$action = $_POST['action'];
}
if($char_id == null) {
$char_id = validateUnsignedInteger($_POST['char'], null);
}
$slot = validateUnsignedInteger($_POST['slot'], null);
if($clan_challange_id == null) {
$clan_challange_id = validateUnsignedInteger($_POST['challenge'], null);
}
function displayChallengeClan($user, $clan_id) { function displayChallengeClan($user, $clan_id) {
if($clan_id == -1 || $clan_id == NULL) { if($clan_id == -1 || $clan_id == NULL) {
@ -49,7 +62,7 @@ function displayChallengeAccepted($user, $clan_id) {
} }
acceptChallengeRequest($clan_id, $user); acceptChallengeRequest($clan_id, $user);
echo 'Herausforderung wurde angenommen!<br><br>'; echo 'Herausforderung wurde angenommen!<br><br>';
echo displayHistoryBackLink(); echo '<a href="index.php?as=clan/kampf_info">zurück</a>';
} }
function displayDenyChallenge($clan_id) { function displayDenyChallenge($clan_id) {
@ -63,13 +76,150 @@ function displayDenyChallenge($clan_id) {
<th colspan="2">Herausforderung wirklich ablehnen?</th> <th colspan="2">Herausforderung wirklich ablehnen?</th>
</tr> </tr>
<tr> <tr>
<td align="center"><?php echo '<a href="index.php?as=clan/kampf_info&action=denychallenge&clanid='.$clan_id.'">ja</a>';?></td> <td align="center"><?php echo '<a href="index.php?as=clan/kampf_info&action=denychallenge&clanid='.$clan_id.'">ja</a>';?>
<td align="center"><?php echo '<a href="index.php?as=clan/kampf_info">nein</a>';?></td> </td>
<td align="center"><?php echo '<a href="index.php?as=clan/kampf_info">nein</a>';?>
</td>
</tr> </tr>
</table> </table>
<?php <?php
} }
function displayShowChallenge($clan_challenge_id, $user) {
$user_clan = getClan($user['clan']);
$open_challenge_ids = getOpenChallengeIDs($user_clan['id']);
if(!in_array($clan_challenge_id, $open_challenge_ids)) {
displayErrorMessage(NULL, 'Wollte da jemand schummeln? ;)', displayHistoryBackLink());
exit;
}
//initialisieren von wichtigen variablen
$participating_clan_ids = getParticipatingClanIDs($clan_challenge_id);
if($participating_clan_ids[0] != $user_clan['id']) {
$other_clan = getClan($participating_clan_ids[0]);
} else {
$other_clan = getClan($participating_clan_ids[1]);
}
$user_clan_chars = getParticipatingCharIDs($clan_challenge_id, $user_clan['id']);
$other_clan_chars = getParticipatingCharIDs($clan_challenge_id, $other_clan['id']);
$user_chars = getCharsOfUser($user['id']);
$slots = array();
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<input type="hidden" name="as" value=clan/kampf_info> <input
type="hidden" name="action" value="joinchallenge"> <input
type="hidden" name="challenge"
value="<?php echo $clan_challenge_id;?>">
<table>
<tr>
<th colspan="3"><?php echo $other_clan['clanname'];?></th>
</tr>
<?php
for ($i = 1; $i < 6; $i++) {
echo '<tr>';
echo '<td><b>Slot '.$i.'</b></td>';
if($other_clan_chars[$i] != null) {
echo '<td align="center">besetzt</td>';
} else {
echo '<td align="center">frei</td>';
}
echo '</tr>';
}
?>
<tr>
<th colspan="3"><?php echo $user_clan['clanname'];?></th>
</tr>
<?php
for ($i = 1; $i < 6; $i++) {
echo '<tr>';
echo '<td><b>Slot '.$i.'</b></td>';
if($user_clan_chars[$i] != null) {
$char = getChar($user_clan_chars[$i]);
echo '<td align="center">'.$char['name'].'</td>';
if(isUserOwnerOf($user['id'], $char['id'])) {
echo '<td align="center"><a href="index.php?as=clan/kampf_info&action=leavechallenge&challenge='.$clan_challenge_id.'&char='.$char['id'].'">abmelden</a></td>';
}
} else {
echo '<td align="center">frei</td>';
$slots[] = $i;
}
echo '</tr>';
}
?>
<tr>
<th colspan="3">Teilnahme</th>
</tr>
<tr>
<td><b>Charakter:</b></td>
<td align="center"><select id="input" name="char">
<option value="-1">Charakter ausw&auml;hlen</option>
<?php
foreach($user_chars as $char){
echo '<option value="'.$char['id'].'">'.$char['name'].'</option>';
}
?>
</select>
</td>
</tr>
<tr>
<td><b>Slot:</b></td>
<td align="center"><select id="input" name="slot">
<option value="-1">Slot ausw&auml;hlen</option>
<?php
foreach($slots as $slot){
echo '<option value="'.$slot.'">'.$slot.'</option>';
}
?>
</select>
</td>
</tr>
<tr>
<td align="center" colspan="3"><input id="input" type=submit
value='anmelden'></td>
</tr>
<tr>
<td align="center" colspan="3"><?php echo '<a href="index.php?as=clan/kampf_info">zur&uuml;ck</a>';?>
</td>
</tr>
</table>
</form>
<?php
}
function displayJoinChallenge($user, $clan_challenge_id, $char_id, $slot) {
$success = joinChallenge($clan_challenge_id, $user, $char_id, $slot);
if($success != null) {
displayErrorMessage(NULL, $success, displayHistoryBackLink());
exit;
} else {
echo 'Der Charakter wurde erfoglreich angemeldet.<br><br>';
echo '<a href="index.php?as=clan/kampf_info">zur&uuml;ck</a>';
}
}
function displayLeaveChallenge($user, $clan_challenge_id, $char_id) {
$user_clan = getClan($user['clan']);
$open_challenge_ids = getOpenChallengeIDs($user_clan['id']);
if(!in_array($clan_challenge_id, $open_challenge_ids)) {
displayErrorMessage(NULL, 'Wollte da jemand schummeln? ;)', displayHistoryBackLink());
exit;
}
$success = leaveChallenge($clan_challenge_id, $user, $char_id);
if($success != null) {
displayErrorMessage(NULL, $success, displayHistoryBackLink());
exit;
} else {
echo 'Der Charakter wurde erfoglreich abgemeldet.<br><br>';
echo '<a href="index.php?as=clan/kampf_info">zur&uuml;ck</a>';
}
}
function getFightType($id) { function getFightType($id) {
switch ($id) { switch ($id) {
case DAVY_BACK_FIGHT: case DAVY_BACK_FIGHT:
@ -83,13 +233,12 @@ function getFightType($id) {
function displayClanFightMenu($user) { function displayClanFightMenu($user) {
$user_clan = getClan($user['clan']); $user_clan = getClan($user['clan']);
// $clans = getAllClans();
$clans_tmp = getClanFightCapableClanIds(); $clans_tmp = getClanFightCapableClanIds();
foreach ($clans_tmp as $clan_tmp_id) { foreach ($clans_tmp as $clan_tmp_id) {
$clans[] = getClan($clan_tmp_id); $clans[] = getClan($clan_tmp_id);
} }
$challenges = getOpenChallengeRequests($user_clan['id']); $open_challenge_requests = getOpenChallengeRequests($user_clan['id']);
$test = getOpenChallengeIDs($user_clan['id']); $open_challenge_ids = getOpenChallengeIDs($user_clan['id']);
?> ?>
<div align="center"> <div align="center">
<table width="100%" border="1"> <table width="100%" border="1">
@ -124,7 +273,7 @@ function displayClanFightMenu($user) {
<th align="center" height="25">Option</th> <th align="center" height="25">Option</th>
</tr> </tr>
<?php <?php
foreach ($challenges as $challenge) { foreach ($open_challenge_requests as $challenge) {
$clan = getClan($challenge['clan_requester']); $clan = getClan($challenge['clan_requester']);
echo '<tr><td align ="center">'.$clan['clanname'].'</td><td align ="center">'.formatTimestamp($challenge['challenged_time']).'</td>'; echo '<tr><td align ="center">'.$clan['clanname'].'</td><td align ="center">'.formatTimestamp($challenge['challenged_time']).'</td>';
echo '<td align ="center">'.getFightType($challenge['type']).'</td><td align ="center">'.$challenge['anzahl_chars'].'</td>'; echo '<td align ="center">'.getFightType($challenge['type']).'</td><td align ="center">'.$challenge['anzahl_chars'].'</td>';
@ -139,12 +288,21 @@ function displayClanFightMenu($user) {
<th height="30" colspan="2" align="center">offene Herausforderungen</th> <th height="30" colspan="2" align="center">offene Herausforderungen</th>
</tr> </tr>
<?php <?php
foreach ($challenges as $cllng) { foreach ($open_challenge_ids as $oci) {
echo '<tr> <td>'.$cllng.'<td></tr>'; $participating_clan_ids = getParticipatingClanIDs($oci);
foreach ($participating_clan_ids as $pci)
if($pci != $user_clan['id']) {
$challenged_clan = getClan($pci);
echo '<tr>';
echo '<td> '.$challenged_clan['clanname'].'</td>';
echo '<td align="center"><a href="index.php?as=clan/kampf_info&action=showchallenge&challenge='.$oci.'">'.anzeigen.'</a></td>';
echo '</tr>';
}
} }
?> ?>
</table> </table>
</div><?php </div>
<?php
} }
if($action == 'challengeclan') { if($action == 'challengeclan') {
@ -156,6 +314,12 @@ if($action == 'challengeclan') {
} else if($action == 'denychallenge') { } else if($action == 'denychallenge') {
denyChallengeRequest($inquirychallenge_clanid, $user_ida); denyChallengeRequest($inquirychallenge_clanid, $user_ida);
displayClanFightMenu($user_ida); displayClanFightMenu($user_ida);
} else if($action == 'showchallenge') {
displayShowChallenge($clan_challange_id, $user_ida);
} else if($action == 'joinchallenge') {
displayJoinChallenge($user_ida, $clan_challange_id, $char_id, $slot);
} else if($action == 'leavechallenge') {
displayLeaveChallenge($user_ida, $clan_challange_id, $char_id);
} else if ($action == NULL) { } else if ($action == NULL) {
displayClanFightMenu($user_ida); displayClanFightMenu($user_ida);
} }

@ -320,9 +320,6 @@ $sql = "SELECT item_id, count(item_id) as anzahl, user, id, ru_mal FROM ware WHE
//echo $sql; //echo $sql;
$item2 = mysql_query($sql); $item2 = mysql_query($sql);
$item1 = mysql_query("SELECT item_id, id, ru_mal FROM ware WHERE user='$user[id]' group by item_id"); $item1 = mysql_query("SELECT item_id, id, ru_mal FROM ware WHERE user='$user[id]' group by item_id");
print_r($char_id1);
?> ?>
<div align="center"> <div align="center">

Loading…
Cancel
Save