added missing sign up stuffz and made tournaments manageable

main
hecht 7 years ago
parent 2c5f3f8e8e
commit 0189ccc302

@ -11,97 +11,107 @@ defineIfNotDefined('TURNIER_ANFAENGER_GEBUEHR', 10000);
defineIfNotDefined('TURNIER_WOCHEN_GEBUEHR', 50000);
defineIfNotDefined('TURNIER_WOCHENST_GEBUEHR', 50000);
function displayTournamentOptions() {
include_once(ROOT_PATH.'/include/tournament.inc.php');
function persistTournamentChanges($request) {
$data = getTournamentType($request['id']);
$changes = array();
foreach ($data as $key => $value) {
if (isset($request[$key])) {
if ($request[$key] == 'on') {
$value = 1;
} else {
$value = $request[$key];
}
}
if ($key == 'id') {
continue;
} else if ($key == 'name') {
$changes[] = $key.'=\''.$value.'\'';
} else {
$changes[] = $key.'='.$value;
}
}
$sql = 'UPDATE tournament_types SET '.join(',', $changes).' WHERE id = '.$request['id'];
// echo $sql;
silent_query($sql);
return db_affected_rows();
}
function displayTournamentForm($request, $data) {
$form_data = array();
foreach ($data as $key => $value) {
$form_data[$key] = isset($request[$key]) ? $request[$key] : $value;
}
?>
<form method="POST">
<input type="hidden" name="choose" value="tournament"> <input
type="hidden" name="action" value="checktnmt">
<table width="80%">
<form method="POST" action="">
<table>
<tr>
<th colspan="2"><h1 style="text-align: center">Übersicht</h1></th>
<th colspan="2">Turnier editieren</th>
</tr>
<tr>
<td>Art</td>
<td style="text-align: center"><select id="input" name="art">
<option value="klein">Anf&auml;ngerturnier</option>
<option value="wochen">Wochenturnier</option>
<option value="wochenst">Wochenturnier non-Fusion</option>
<option value="gross">Weltturnier</option>
<option value="grossst">Weltturnier non-Fusion</option>
</select>
</td>
<td colspan="2" align="center"><hr /></td>
</tr>
<tr>
<td>Anzahl</td>
<td style="text-align: center"><select id="input" name="anzahl">
<option value="2">2</option>
<option value="4">4</option>
<option value="8">8</option>
<option value="16">16</option>
<option value="32">32</option>
<option value="64">64</option>
<option value="128">128</option>
<option value="256">256</option>
<option value="512">512</option>
</select>
</tr>
<tr>
<td>Fusion erlaubt?</td>
<td style="text-align: center"><select id="input" name="fusion">
<option value="1">ja</option>
<option value="0">nein</option>
</select>
<td align="left">Name:</td>
<td>
<input type="text" name="name" value=<?php echo $form_data['name']; ?> />
</td>
</tr>
<tr>
<td>Spezialcharaktere erlaubt? (Kaio/Shichi)</td>
<td style="text-align: center"><select id="input" name="special">
<option value="1">ja</option>
<option value="0">nein</option>
<td align="left">Teilnehmer:</td>
<td>
<select name="competitors">
<?php
for ($i = 2; $i <= 512; $i *= 2 ) {
$selected = '';
if ( $form_data['competitors'] == $i ) {
$selected = ' selected';
}
?>
<option value="<?php echo $i; ?>" <?php echo $selected; ?>><?php echo $i; ?></option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<td>Min. Level</td>
<td style="text-align: center"><input name="minlevel" value="1"></td>
</tr>
<tr>
<td>Max. Level</td>
<td style="text-align: center"><input name="maxlevel" value="150"></td>
</tr>
<tr>
<td>Teilnehmer</td>
<td style="text-align: center"><select id="input" name="gain">
<option value="Anmeldung">Anmeldung</option>
<option value="PL">Powerlevel</option>
<option value="Level">Level</option>
</select>
<td>Fusion ausschließen?</td>
<td>
<input type="checkbox" name="excl_fusions" <?php echo $form_data['excl_fusions']?'checked="checked"':''; ?> />
</td>
</tr>
<tr>
<td>Zufällige Reihenfolge?</td>
<td style="text-align: center"><select id="input" name="randomize">
<option value="1">ja</option>
<option value="0">nein</option>
</select>
<td>Gewinner ausschließen?</td>
<td>
<input type="checkbox" name="excl_winners" <?php echo $form_data['excl_winners']?'checked="checked"':''; ?> />
</td>
</tr>
<tr>
<td>Ausrüstung ignorieren?</td>
<td style="text-align: center"><select id="input" name="itemless">
<option value="1">ja</option>
<option value="0">nein</option>
</select>
<td>Spezialchars ausschließen?</td>
<td>
<input type="checkbox" name="excl_special_chars" <?php echo $form_data['excl_special_chars']?'checked="checked"':''; ?> />
</td>
</tr>
<tr>
<td>Chance auf eine Frucht</td>
<td style="text-align: center"><select id="input" name="fruit">
<td>Maximale Teilnahme von Fusionen</td>
<td>
<select name="excl_fusion_particip_count">
<?php
for ($i = 0; $i <= 100; ++$i) {
for ($i = 0; $i < 4; ++$i ) {
$selected = '';
if ( $form_data['excl_fusion_particip_count'] == $i ) {
$selected = ' selected';
}
?>
<option value="<?php echo $i; ?>"><?php echo $i; ?>%</option>
<option value="<?php echo $i; ?>" <?php echo $selected; ?>><?php echo $i; ?></option>
<?php
}
?>
@ -109,13 +119,17 @@ for ($i = 0; $i <= 100; ++$i) {
</td>
</tr>
<tr>
<td>Fruchttyp</td>
<td style="text-align: center"><select id="input" name="fruit_type">
<td>Mindest Level</td>
<td>
<select name="min_level">
<?php
$types = array('natur', 'Logia', 'Paramecia', 'Zoan');
foreach ($types as $type) {
for ($i = 1; $i < CHAR_MAX_LEVEL; ++$i ) {
$selected = '';
if ( $form_data['min_level'] == $i ) {
$selected = ' selected';
}
?>
<option value="<?php echo $type; ?>"><?php echo $type; ?></option>
<option value="<?php echo $i; ?>" <?php echo $selected; ?>><?php echo $i; ?></option>
<?php
}
?>
@ -123,167 +137,161 @@ foreach ($types as $type) {
</td>
</tr>
<tr>
<td>Turniergewinner ausschliessen?</td>
<td style="text-align: center"><select id="input" name="exclude_winners">
<option value="1">ja</option>
<option value="0">nein</option>
<td>Maximales Level</td>
<td>
<select name="max_level">
<option value="0">-</option>
<?php
for ($i = 1; $i < CHAR_MAX_LEVEL; ++$i ) {
$selected = '';
if ( $form_data['max_level'] == $i ) {
$selected = ' selected';
}
?>
<option value="<?php echo $i; ?>" <?php echo $selected; ?>><?php echo $i; ?></option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<td>Anzahl Teilnahmen nach der Fusionen ausgeschlossen werden?</td>
<td style="text-align: center"><select id="input" name="exclude_fusi_count">
<option value="0">deaktiviert</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
<td>Reihenfolge jede Runde neu?</td>
<td>
<input type="checkbox" name="randomize" <?php echo $form_data['randomize']?'checked="checked"':''; ?> />
</td>
</tr>
<!-- <tr>
<td>Gruppenphase?</td>
<td style="text-align: center"><select id="input" name="gruppenphase">
<option value="0">nein</option>
<option value="1">ja</option>
</select>
</td>
</tr>
<tr>
<td>Gruppengr&ouml;sse</td>
<td style="text-align: center"><input name="grp_size" value="0"></td>
</tr>
<tr>
<td>Anzahl der Sieger die eine Gruppe verlassen</td>
<td style="text-align: center"><input name="grp_proceed" value="0"></td>
</tr>-->
<tr>
<td align="center" colspan="2"><input type="submit" value="starten">
<td>Ausrüstung ignorieren?</td>
<td>
<input type="checkbox" name="without_equip" <?php echo $form_data['without_equip']?'checked="checked"':''; ?> />
</td>
</tr>
<tr>
<td align="center" colspan="2"><a
href="<?php echo $_SERVER['PHP_SELF'].'?choose=tournament'; ?>">Zur&uuml;ck</a>
<td>Frucht Droprate?</td>
<td>
<select id="input" name="fruit_chance">
<?php
for ($i = 0; $i <= 100; ++$i) {
$selected = '';
if ( $form_data['fruit_chance'] == $i ) {
$selected = ' selected';
}
?>
<option value="<?php echo $i; ?>" <?php echo $selected; ?>><?php echo $i; ?>%</option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<td align="center" colspan="2"><a
href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a>
</td>
</tr>
</table>
</form>
<td>Fruchttyp</td>
<td>
<select id="input" name="fruit_type">
<option value="0">-</option>
<?php
$types = array('Logia', 'Paramecia', 'Zoan', 'natur');
foreach ($types as $type) {
$selected = '';
if ( $form_data['fruit_type'] == $type) {
$selected = ' selected';
}
function displayCheckTournament($request) {
$name = $request['art'];
$anzahl = $request['anzahl'];
$fusion = $request['fusion'];
$special = $request['special'];
$minlvl = $request['minlevel'];
$maxlvl = $request['maxlevel'];
$gain = $request['gain'];
$random = $request['randomize'];
$itemless = $request['itemless'];
$fruit_chance = $request['fruit'];
$fruit_type = $request['fruit_type'];
$exclude_winners = $request['exclude_winners'];
$exclude_fusi_count = $request['exclude_fusi_count'];
if(is_numeric($minlvl) && is_numeric($maxlvl)) {?>
<table width="80%">
<tr>
<th colspan="2" style="text-align: center">Turnier wirklich starten?</th>
</tr>
<tr>
<td style="text-align: center"><a
href="<?php echo $GLOBALS['URL_TO_TURNIER'].'?fusion='.$fusion.'&special='.
$special.'&minlevel='.$minlvl.'&maxlevel='.$maxlvl.'&gain='.$gain.'&randomize='.
$random.'&name='.$name.'&anzahl='.$anzahl.'&itemless='.$itemless.'&fruit='.
$fruit_chance.'&fruit_type='.$fruit_type.'&exclude_winners='.$exclude_winners.
'&exclude_fusi_count='.$exclude_fusi_count;?>"
target="_blank">Turnier starten!</a>
</td>
<td style="text-align: center"><a
href="<?php echo $_SERVER['PHP_SELF'].'?choose=tournament&action=tnmt'; ?>">Doch
nicht</a>
?>
<option value="<?php echo $type; ?>" <?php echo $selected; ?>><?php echo $type; ?></option>
<?php
}
?>
</select>
</td>
</tr>
</table>
<tr>
<td>Teilnameart</td>
<td>
<select id="input" name="gain">
<?php
} else {
echo 'Keine gültige Eingabe von Min. oder Max. Level<br>';
echo '<a href="'.$_SERVER['PHP_SELF'].'?choose=tournament&action=tnmt">Zur&uuml;ck</a>';
}
}
function displayEditFee($request) {
$klein = $request['klein'];
$wochen = $request['wochen'];
$wochenst = $request['wochenst'];
$change = FALSE;
if($klein !== NULL || $wochen !== null) {
if($klein !== NULL && $klein != TURNIER_ANFAENGER_GEBUEHR) {
$change = TRUE;
setDefine('TURNIER_ANFAENGER_GEBUEHR', $klein);
$types = array( TOURNAMENT_GAIN_ANMELDUNG => 'Anmeldung', TOURNAMENT_GAIN_PL => 'Powerlevel', TOURNAMENT_GAIN_LEVEL => 'Level' );
foreach ($types as $key => $value) {
$selected = '';
if ( $form_data['gain'] == $key) {
$selected = ' selected';
}
if($wochen !== NULL && $wochen != TURNIER_WOCHEN_GEBUEHR) {
$change = TRUE;
setDefine('TURNIER_WOCHEN_GEBUEHR', $wochen);
}
if($wochenst !== NULL && $wochenst != TURNIER_WOCHENST_GEBUEHR) {
$change = TRUE;
setDefine('TURNIER_WOCHENST_GEBUEHR', $wochenst);
}
} else {
?>
<option value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $value; ?></option>
<?php
}
?>
<form method="get">
<input type="hidden" name="choose" value="tournament"> <input
type="hidden" name="action" value="fee">
<table width="80%">
<tr>
<th colspan="2"><h1 style="text-align: center">Übersicht</h1></th>
</tr>
<?php if($change === TRUE) {?>
<tr>
<td colspan="2" align="center">&Auml;nderungen &uuml;bernommen!</td>
</tr>
<?php }?>
<tr>
<td colspan="2" align="center"><b>Anf&auml;ngerturnier</b>
</select>
</td>
</tr>
<tr>
<td align="left">Anmeldegeb&uuml;hr:</td>
<td><input type="text" name="klein"
value=<?php echo ($klein == null)?TURNIER_ANFAENGER_GEBUEHR:$klein;?>>
<td>Eventuelle Anmeldegebühr</td>
<td>
<input type="number" name="entrance_fee" value="<?php echo $form_data['entrance_fee']; ?>" />
</td>
</tr>
<tr>
<td colspan="2" align="center"><b>Wochenturnier</b>
<td>Wochentag</td>
<td>
<select id="input" name="day_of_week">
<option value="0">-</option>
<?php
$translation = array('', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag', 'Sonntag');
for ($i = 1; $i < count($translation); ++$i) {
$selected = '';
if ( $form_data['day_of_week'] == $i ) {
$selected = ' selected';
}
?>
<option value="<?php echo $i; ?>" <?php echo $selected; ?>><?php echo $translation[$i]; ?></option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<td align="left">Anmeldegeb&uuml;hr:</td>
<td><input type="text" name="wochen"
value=<?php echo ($wochen == null)?TURNIER_WOCHEN_GEBUEHR:$wochen;?>>
<td>Tag des Monats</td>
<td>
<select id="input" name="day_of_month">
<option value="0">-</option>
<?php
for ($i = 1; $i <= 28; ++$i) {
$selected = '';
if ( $form_data['day_of_month'] == $i ) {
$selected = ' selected';
}
?>
<option value="<?php echo $i; ?>" <?php echo $selected; ?>><?php echo $i; ?></option>
<?php
}
?>
</select>
</td>
</tr>
<td colspan="2" align="center"><b>Wochenturnier non-Fusion</b>
<tr>
<td>Tageszeit</td>
<td>
<select id="input" name="hour_of_day">
<?php
for ($i = 0; $i < 24; ++$i) {
$selected = '';
if ( $form_data['hour_of_day'] == $i ) {
$selected = ' selected';
}
?>
<option value="<?php echo $i; ?>" <?php echo $selected; ?>><?php echo $i; ?> Uhr</option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<td align="left">Anmeldegeb&uuml;hr:</td>
<td><input type="text" name="wochenst"
value=<?php echo ($wochenst == null)?TURNIER_WOCHENST_GEBUEHR:$wochenst;?>>
</td>
<td colspan="2" align="center"><hr /></td>
</tr>
<td align="center" colspan="2"><input type="submit"
value="&auml;ndern">
</td>
<tr>
<td colspan="2" align="center"><input type="submit" value="speichern" /></td>
</tr>
<tr>
<td align="center" colspan="2"><a
@ -300,36 +308,77 @@ function displayEditFee($request) {
<?php
}
function displayStartTournament($id) {
runTournament($id);
}
function displayEditTournament($request) {
$persisted = false;
if(isset($request['name'])) {
$persisted = persistTournamentChanges($request);
if (!$persisted) {
echo '<p>Speichern nicht erfolgreich.</p>';
}
}
if ( !$persisted ) {
displayTournamentForm($request, getTournamentType($request['id']));
} else {
echo 'Editieren erfolgreich. <a href="'.$_SERVER['PHP_SELF'].'?choose=tournament">Weiter</a>';
}
}
function displayTournamentMenu($request) {
switch ($request['action']) {
case 'checktnmt':
displayCheckTournament($request);
break;
case 'tnmt':
displayTournamentOptions();
case 'start':
displayStartTournament($request['id']);
break;
case 'fee':
displayEditFee($request);
case 'edit':
displayEditTournament($request);
break;
default:
?>
<table>
<?php if($GLOBALS['URL_TO_TURNIER'] !== null) { ?>
<tr>
<td><a
href="<?php $_SERVER['PHP_SELF'] ?>?choose=tournament&action=tnmt">Turnier
starten</a>
</td>
<th colspan="3">Turniere</th>
</tr>
<?php }?>
<?php
$tournaments = getTournamentTypes();
foreach ($tournaments as $tournament) {
?>
<tr>
<td><a
href="<?php $_SERVER['PHP_SELF'] ?>?choose=tournament&action=fee">
Anmeldegebühren bearbeiten</a>
<td><?php echo $tournament['name']?>:</td>
<?php
if (canStartTournament($tournament)) {
?>
<td><a href="<?php $_SERVER['PHP_SELF'] ?>?choose=tournament&action=start&id=<?php echo $tournament['id']; ?>">starten</a></td>
<?php
} else {
?>
<td>starten</td>
<?php
}
?>
</td>
<?php
if (canEditTournament($tournament)) {
?>
<td><a href="<?php $_SERVER['PHP_SELF'] ?>?choose=tournament&action=edit&id=<?php echo $tournament['id']; ?>">edit</a></td>
<?php
} else {
?>
<td>edit</td>
<?php
}
?>
</tr>
<?php
}
?>
<tr>
<td><a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a>
<td colspan="3">
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a>
</td>
</tr>
</table>

@ -11,6 +11,7 @@ include_once(ROOT_PATH.'//include/designfunctions.inc.php');
include_once (ROOT_PATH . '/include/clan.inc.php');
include_once (ROOT_PATH . '/include/clan_chat.inc.php');
$itemsx1 = mysqli_num_rows(db_query("SELECT id FROM sp_ware WHERE item='1' AND user='$user_ida[id]'"));
$itemsz1 = mysqli_fetch_array(db_query("SELECT id FROM sp_ware WHERE item='1' AND user='$user_ida[id]' LIMIT 1"));
@ -55,10 +56,14 @@ if ($name AND $passwort) {
$training_009 = "";
$turnier_009 = '<a href="index.php?as=turnier&art=wochen">Wochen Turnier Anmeldung</a><br>' .
'<a href="index.php?as=turnier&art=wochenst">Non-Fusi Turnier Anmeldung</a><br>'.
'<a href="index.php?as=turnier&art=klein">Anf&auml;nger Turnier Anmeldung</a><br>' .
'<a href="index.php?as=turnier_auswahl">Turnier Angucken</a><br>';
$turnier_009 = '';
$tournaments = db_query('SELECT id, abbrevation FROM tournament_types WHERE gain = 0');
foreach ($tournaments as $tournament) {
$turnier_009 = $turnier_009 . '<a href="index.php?as=turnier&type_id='.$tournament['id'].'">'.$tournament['abbrevation'].' Anmeldung</a><br>';
}
$turnier_009 = $turnier_009 . '<a href="index.php?as=turnier_auswahl">Turnier Angucken</a><br>';
if ($user_ida['clan'] == 0) {
$clan_009 = "

@ -38,12 +38,6 @@ function getStatus($charid, $buffer_enabled = true) {
return $GLOBALS['char_buffered_statuses'][$charid];
}
$sql = 'SELECT count(*) as anzahl FROM turnier_kampf t where art != \'gross\' and (win = ' . $charid . ' or lose = ' . $charid . ') and dauer > now()';
$row = mysqli_fetch_assoc(db_query($sql));
if ($row['anzahl'] > 0) {
$GLOBALS['char_buffered_statuses'][$charid] = 'Turnier';
return 'Turnier';
}
$sql = 'SELECT count(*) as anzahl from quests where charid = ' . $charid;
$row = mysqli_fetch_assoc(db_query($sql));
if ($row['anzahl'] > 0) {
@ -63,7 +57,7 @@ function getStatus($charid, $buffer_enabled = true) {
$GLOBALS['char_buffered_statuses'][$charid] = 'Kampf erstellt';
return 'Kampf erstellt';
}
$sql = 'SELECT count(*) as anzahl FROM turnier1 where charakter = ' . $charid;
$sql = 'SELECT count(*) as anzahl FROM tournament_registration where charakter = ' . $charid;
$row = mysqli_fetch_assoc(db_query($sql));
if ($row['anzahl'] > 0) {
$GLOBALS['char_buffered_statuses'][$charid] = 'Angemeldet';

@ -177,10 +177,6 @@ function addExpToChar($char_id, $n_exp){
db_query($sql);
$char = getChar($char_id, false); // We really want the actual char!!
if($char['level'] > 25) {
// remove this char out of the registration of the beginners tournament
db_query('Delete from turnier1 where art = \'klein\' and charakter = \''.$char_id.'\'');
}
}
function addExpToArena($user_id, $n_exp){

@ -14,123 +14,82 @@ include_once(ROOT_PATH.'/include/designfunctions.inc.php');
include_once(ROOT_PATH.'/include/char.inc.php');
include_once(ROOT_PATH.'/include/halloffame.inc.php');
include_once(ROOT_PATH.'/include/auktion_functions.inc.php');
include_once(ROOT_PATH.'/include/tournament.inc.php');
// GET-Section
// Kritisch (SQL-Injections)
$char_id = validateUnsignedInteger($_GET['char_id'], null);
$art = validateString($_GET['art']);
$type_id = validateUnsignedInteger($_GET['type_id']);
// Unkritisch
$charm = $_GET['charm'];
function anmelden($user, $charid, $art){
// Security
if($art != 'klein' && $art != 'wochen' && $art != 'wochenst'){
function anmelden($user, $charid, $type_id){
$tournament_type = getTournamentType($type_id);
$filter_sql = getTournamentCharExclusionSQL($tournament_type, 'c');
$anzahl = $tournament_type['competitors'];
if ($tournament_type['gain'] != TOURNAMENT_GAIN_ANMELDUNG) {
displayErrorMessage(NULL,'Es ist ein Fehler beim Anmelden aufgetreten!!','<a href="index.php">weiter...</a>');
return;
}
if(!is_numeric($charid)){ // Ist Charid wirklich eine Zahl????
displayErrorMessage(NULL,'Charid ist nicht numerisch!!','<a href="index.php">weiter...</a>');
return;
}
// Es wird angenommen, dass $user schon sicher ist, weil das in der config.inc.php ausgelesen wird
if($art == 'wochen') {
$fee = (TURNIER_WOCHEN_GEBUEHR=='TURNIER_WOCHEN_GEBUEHR')?0:TURNIER_WOCHEN_GEBUEHR;
} else if($art == 'klein') {
$fee = (TURNIER_ANFAENGER_GEBUEHR=='TURNIER_ANFAENGER_GEBUEHR')?0:TURNIER_ANFAENGER_GEBUEHR;
} else if($art == 'wochenst') {
$fee = (TURNIER_WOCHENST_GEBUEHR=='TURNIER_WOCHENST_GEBUEHR')?0:TURNIER_WOCHENST_GEBUEHR;
}
$fee = $tournament_type['entrance_fee'];
if(getUserAvailableMoney($user['id']) < $fee) {
displayErrorMessage(NULL,'Nicht genug Geld um am Turnier teilzunehmen!','<a href="index.php">weiter...</a>');
return;
}
if($art == 'klein' && getHallOfFameEntryCount('Anf&auml;ngerturnier', $user['id']) >= 2) {
displayErrorMessage(NULL,'Du hast das Anf&auml;ngerturnier schon zu oft gewonnen!!!','<a href="index.php">weiter...</a>');
$sear_a = mysqli_num_rows(db_query('SELECT tr.id FROM tournament_registration tr inner join chars as c ON tr.charakter = c.id WHERE tr.type='.$type_id.' AND '.$filter_sql));
echo $sear_a.'<br>'; // Print the amount of registrations!
if($sear_a >= $anzahl) {
displayErrorMessage(NULL,'Turnier voll! Es k&uuml;nnen maximal nur '.$anzahl.' Chars am Turnier teilnehmen','<a href="index.php?as=turnier&type_id='.$type_id.'">weiter...</a>');
return;
}
if($art == 'klein'){
$races = getSpecialRaceIds();
$special_race_ids = array();
foreach($races as $race) {
$special_race_ids[] = '\''.$race['id'].'\'';
}
// Char darf max lvl 25 haben und keine Fusion sein und auch keine Teufelsfrucht gegessen haben
$special_clue = 'AND level<=25 AND fusion_rasse = \'0\' AND rasse NOT IN ('.implode(',',$special_race_ids).') AND frucht is null';
$anzahl = 32;
} else if($art == 'wochenst') {
$special_clue = 'AND fusion_rasse = \'0\'';
$anzahl = 64;
} else{
$anzahl = 64;
}
// sehr speziell und deswegen nicht getChar();
$PRUEF = mysqli_num_rows(db_query('SELECT id FROM chars WHERE id=\''.$charid.'\' '.$special_clue.' AND besitzer=\''.$user['id'].'\' LIMIT 1'));
$PRUEF = mysqli_num_rows(db_query('SELECT id FROM chars c WHERE id=\''.$charid.'\' AND '.$filter_sql.' AND besitzer=\''.$user['id'].'\' LIMIT 1'));
if(!$PRUEF) {
displayErrorMessage(NULL,'Charakter erf&uuml;llt die Bestimungen nicht!','<a href="index.php?as=turnier&art='.$art.'">weiter...</a>');
displayErrorMessage(NULL,'Charakter erf&uuml;llt die Bestimungen nicht!','<a href="index.php?as=turnier&type_id='.$type_id.'">weiter...</a>');
return;
}
$sear_a = mysqli_num_rows(db_query('SELECT id FROM turnier1 WHERE art=\''.$art.'\''));
if($sear_a >= $anzahl) {
displayErrorMessage(NULL,'Turnier voll! Es k&uuml;nnen maximal nur '.$anzahl.' Chars am Turnier teilnehmen','<a href="index.php?as=turnier&art='.$art.'">weiter...</a>');
return;
}
$sear = mysqli_fetch_assoc(db_query('SELECT id FROM turnier1 WHERE besitzer=\''.$user['id'].'\' and art = \''.$art.'\' LIMIT 1'));
$sear = mysqli_fetch_assoc(db_query('SELECT id FROM tournament_registration WHERE besitzer=\''.$user['id'].'\' and type = \''.$type_id.'\' LIMIT 1'));
if($sear['id']) {
displayErrorMessage(NULL,'Es darf nur einer deiner Chars am Turnier teilnehmen','<a href="index.php?as=turnier&art='.$art.'">weiter...</a>');
displayErrorMessage(NULL,'Es darf nur einer deiner Chars am Turnier teilnehmen','<a href="index.php?as=turnier&type_id='.$type_id.'">weiter...</a>');
return;
}
$sql = 'INSERT turnier1 SET charakter='.$charid.', besitzer='.$user['id'].', art = \''.$art.'\'';
$sql = 'INSERT tournament_registration SET charakter='.$charid.', besitzer='.$user['id'].', type = '.$type_id;
// echo $sql;
db_query($sql);
db_query('UPDATE chars SET status=\'Turnier\' WHERE id='.$charid);
db_query('UPDATE user SET geld= '.($user['geld']-$fee).' WHERE id='.$user['id']);
displayErrorMessage('&Auml;nderungen &uuml;bernommen','Charakter erfolgreich beim Turnier angemeldet','<a href="index.php?as=turnier&art='.$art.'">weiter...</a>');
displayErrorMessage('&Auml;nderungen &uuml;bernommen','Charakter erfolgreich beim Turnier angemeldet','<a href="index.php?as=turnier&type_id='.$type_id.'">weiter...</a>');
return;
}
function abmelden($user_ida, $char_id, $art){
db_query('DELETE FROM turnier1 WHERE charakter=\''.$char_id.'\' AND besitzer=\''.$user_ida['id'].'\'');
function abmelden($user_ida, $char_id, $type_id){
db_query('DELETE FROM tournament_registration WHERE charakter=\''.$char_id.'\' AND besitzer=\''.$user_ida['id'].'\'');
db_query('UPDATE chars SET status=\'Frei\' WHERE id=\''.$char_id.'\' AND besitzer=\''.$user_ida['id'].'\' AND status=\'Turnier\' LIMIT 1');
displayErrorMessage('&Auml;nderungen &uuml;bernommen','Charakter erfolgreich beim Turnier abgemeldet','<a href="index.php?as=turnier&art='.$art.'">weiter...</a>');
displayErrorMessage('&Auml;nderungen &uuml;bernommen','Charakter erfolgreich beim Turnier abgemeldet','<a href="index.php?as=turnier&type_id='.$type_id.'">weiter...</a>');
return;
}
function displayDefault($user, $art){
function displayDefault($user, $type_id){
$tournament_type = getTournamentType($type_id);
$filter_sql = getTournamentCharExclusionSQL($tournament_type);
if($art == 'klein'){
$turniername = 'Anf&auml;nger';
$races = getSpecialRaceIds();
$special_race_ids = array();
foreach($races as $race) {
$special_race_ids[] = '\''.$race['id'].'\'';
}
// Char darf max lvl 25 haben und keine Fusion sein und auch keine Teufelsfrucht gegessen haben
$special_clue = ' AND level<=25 AND fusion_rasse = \'0\' AND rasse NOT IN ('.implode(',',$special_race_ids).') AND frucht is null';
$fee = (TURNIER_ANFAENGER_GEBUEHR=='TURNIER_ANFAENGER_GEBUEHR')?0:TURNIER_ANFAENGER_GEBUEHR;
} else if($art == 'wochen'){
$turniername = 'Wochen';
$fee = (TURNIER_WOCHEN_GEBUEHR=='TURNIER_WOCHEN_GEBUEHR')?0:TURNIER_WOCHEN_GEBUEHR;
} else if($art == 'wochenst') {
$turniername = 'Wochen non-fusion';
$fee = (TURNIER_WOCHENST_GEBUEHR=='TURNIER_WOCHENST_GEBUEHR')?0:TURNIER_WOCHENST_GEBUEHR;
} else {
displayErrorMessage(NULL,'Anzeigefehler!!','<a href="index.php">weiter...</a>');
return;
}
// sehr speziell und deswegen nicht getChar();
$sql = 'SELECT id, name FROM chars WHERE besitzer='.$user['id'].$special_clue;
$sql = 'SELECT id, name FROM chars WHERE besitzer='.$user['id'].' AND '.$filter_sql;
$char = db_query($sql);
if(!$char)
echo $sql;
@ -148,16 +107,16 @@ else document.forms[0].elements['submit'].disabled=true;
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get">
<input type="hidden" name="as" value="turnier">
<input type="hidden" name="charm" value="1">
<input type="hidden" name="art" value="<?php echo $art; ?>">
<input type="hidden" name="type_id" value="<?php echo $type_id; ?>">
<table cellpadding="0" cellspacing="0" width="100%" height="25">
<!-- MSTableType="layout" -->
<tr>
<th colspan="2" align="center"><?php echo $turniername; ?>-Turnier Anmeldung</th>
<th colspan="2" align="center"><?php echo $tournament_type['name']; ?> Anmeldung</th>
</tr>
<tr>
<th align="center">Anmeldegeb&uuml;hr</th>
<td valign="top">
<?php echo $fee;?>
<?php echo $tournament_type['entrance_fee'];?>
</td>
</tr>
<tr>
@ -182,7 +141,7 @@ while($row = mysqli_fetch_assoc($char)) {
</tr>
</table><hr id="hrc">
<?php
$char_ag = db_query('SELECT c.id as charid, c.name, t.charakter, u.nickname, u.id as userid FROM turnier1 t LEFT JOIN chars c ON(t.charakter=c.id) LEFT JOIN user u ON(t.besitzer=u.id) WHERE t.art=\''.$art.'\'');
$char_ag = db_query('SELECT c.id as charid, c.name, t.charakter, u.nickname, u.id as userid FROM tournament_registration t LEFT JOIN chars c ON(t.charakter=c.id) LEFT JOIN user u ON(t.besitzer=u.id) WHERE t.type='.$type_id);
?>
<table cellpadding="0" cellspacing="0" width="388" height="0">
<!-- MSTableType="layout" -->
@ -198,7 +157,7 @@ $char_ag = db_query('SELECT c.id as charid, c.name, t.charakter, u.nickname, u.i
<?php
while($row2 = mysqli_fetch_assoc($char_ag)) {
if($row2['userid'] == $user['id']) {
$alo = '<a href="index.php?as=turnier&charm=2&char_id='.$row2['charakter'].'&art='.$art.'">Abmelden</a>';
$alo = '<a href="index.php?as=turnier&charm=2&char_id='.$row2['charakter'].'&type_id='.$type_id.'">Abmelden</a>';
} else {
$alo = '&nbsp;';
}
@ -216,11 +175,11 @@ while($row2 = mysqli_fetch_assoc($char_ag)) {
}
if($charm == 1){
anmelden($user_ida,$char_id,$art);
anmelden($user_ida,$char_id,$type_id);
} else if($charm == 2){
abmelden($user_ida, $char_id,$art);
abmelden($user_ida, $char_id,$type_id);
} else{
displayDefault($user_ida, $art);
displayDefault($user_ida, $type_id);
}

@ -31,7 +31,7 @@ function displaySomething($event_id, $id, $new_max_turnier, $char_nic1, $char_ni
// GET-Section
// Kritisch (SQL-Injections)
$art = validateStringCritical($_GET['art']);
$type_id = validateUnsignedInteger($_GET['type_id']);
$id = validateUnsignedInteger($_GET['id']);
// Unkritisch
@ -40,9 +40,9 @@ $charm = $_GET['charm'];
$turnier_daten = NULL;
if (is_numeric($id)) {
$turnier_daten = mysqli_fetch_assoc(db_query('SELECT * from turniere WHERE id = "'.$id.'"'));
$turnier_daten = mysqli_fetch_assoc(db_query('SELECT * from tournament WHERE id = "'.$id.'"'));
} else {
$turnier_daten = mysqli_fetch_assoc(db_query('SELECT * from turniere WHERE art = "'.$art.'" ORDER BY datum DESC LIMIT 1'));
$turnier_daten = mysqli_fetch_assoc(db_query('SELECT * from tournament WHERE type = "'.$type_id.'" ORDER BY datum DESC LIMIT 1'));
}
if(!$turnier_daten) {
@ -56,15 +56,13 @@ else if($charm == 1) {
echo '<link rel="stylesheet" type="text/css" href="design/style3.css">';
$turnier_date = $turnier_daten['datum'];
$turnier_info = db_query('SELECT win, char1, char2, id, round, dauer FROM turnier_kampf WHERE art=\''.$art.'\' ORDER BY id ASC');
$u=0;
$pl = 300;
$eventChars = array();
$char_nick1 = array();
$char_nick2 = array();
$char_nic1[] = array();
$char_nic2[] = array();
$char_nic1 = array();
$char_nic2 = array();
$char1 = array();
$char2 = array();
$win = array();
@ -105,7 +103,7 @@ else if($charm == 1) {
$char_nick1[]=$char_info1['char_name'];
$char_nick2[]=$char_info2['char_name'];
$char1[]=$char_info1['event_char_id'];
$char2[]=$char_info1['event_char_id'];
$char2[]=$char_info2['event_char_id'];
$win[]=$event_fight['winner'];
$round[]=getEventFightMetaData($event_id, $event_fight_id)['round'];

@ -5,11 +5,16 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public Licence
*
*/
include_once('path.inc.php'); // get the path ;)
include_once(ROOT_PATH.'/include/tournament.inc.php');
?>
<SCRIPT language="JavaScript">
function kampf(art){
window.open("./turnier2.php?charm=1&art="+art,"","status=no,hotkeys=no,Height=600,Width=929,scrollbars=yes");
function kampf(type_id){
window.open("./turnier2.php?charm=1&type_id="+type_id,"","status=no,hotkeys=no,Height=600,Width=929,scrollbars=yes");
}
</SCRIPT>
@ -18,38 +23,21 @@
<tr>
<th valign="top" colspan="3" align="center">Turnier Auswahl</th>
</tr>
<?php
$tournament_types = getTournamentTypes();
foreach ($tournament_types as $tournament_type) {
?>
<tr>
<td valign="top" align="center">
<a href='javascript:kampf("woche");'>
<img border="0" src="design/bilder/buttons/wt-turnier.jpg" title="Das Turnier ist einmal die Woche, Sonntags um 15 Uhr. (64 Spieler)" width="150" height="150" />
</a>
</td>
<td>&nbsp;</td>
<td valign="top" align="center">
<a href='javascript:kampf("wochenst");'>
<img border="0" src="design/bilder/buttons/wts-turnier.jpg" title="Das Turnier ist einmal die Woche, Samstags um 15 Uhr. (64 Spieler ohne Fusionen)" width="150" height="150" />
</a>
</td>
</tr>
<tr>
<td colspan="3" valign="top" align="center">
<a href='javascript:kampf("klein");'>
<img border="0" src="design/bilder/buttons/af-turnier.jpg" title="Das Anf&auml;nger Turnier ist einmal die Woche, Freitags um 15 Uhr. (32 Spieler)" width="150" height="150" />
</a>
</td>
</tr>
<tr>
<td align="center">
<a href='javascript:kampf("gross");'>
<img border="0" src="design/bilder/buttons/WT-turnier.jpg" title="Das Welt Turnier ist immer am ersten Tag des Monats um 21 Uhr (Maximal 512 Spieler)" width="150" height="150" />
</a>
</td>
<td>&nbsp;</td>
<td valign="top" align="center">
<a href='javascript:kampf("grossst");'>
<img border="0" src="design/bilder/buttons/WTs-turnier.jpg" title="Das Turnier ist immer am 15. Tag des Monats um 21 Uhr, (Maximal 512 Spieler ohne Fusionen)" width="150" height="150" />
<a href='javascript:kampf("<?php echo $tournament_type['id']; ?>");'>
<img border="0" src="<?php echo $tournament_type['icon']; ?>" title="Das Turnier ist einmal die Woche, Sonntags um 15 Uhr. (64 Spieler)" width="150" height="150" />
</a>
</td>
<td align="center">Hier kommt noch info hin (to be programmed)</td>
</tr>
<?php
}
?>
</table>

Loading…
Cancel
Save