Wenn man aus dem Clan austritt und man ist der letzte User, dann wird der Clan geloescht. Ansonsten 2 dateien von dos2unix linebreaks umgewandelt. Noch weitere kleinere Bugfixes.

main
hecht 13 years ago
parent 60c43a6d29
commit 241298a40d

@ -10,6 +10,9 @@ include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/config.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/parse.inc.php');
include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/clan.inc.php');
// GET-Section
// Kritisch (SQL-Injections)
$item_id = validateUnsignedInteger($_GET['item_id'], null);
@ -19,14 +22,20 @@ $charm = $_GET['charm'];
if($charm == 3)
{
$item_info = mysql_fetch_array(mysql_query("SELECT id, preis, name, anzahl FROM clan_item WHERE id='$item_id' LIMIT 1"));
$user = mysql_Fetch_array(mysql_query("SELECT leader, co_leader, geld, id FROM clan WHERE id='$user_ida[clan]'"));
$item_info = mysql_fetch_assoc(mysql_query("SELECT * FROM clan_item WHERE id='$item_id' LIMIT 1"));
$user = getClan($user_ida['clan']); // mysql_Fetch_array(mysql_query("SELECT leader, co_leader, geld, id FROM clan WHERE id='$user_ida[clan]'"));
if($user['leader'] != $user_ida['id'] AND $user['co_leader'] != $user_ida['id']) {
displayErrorMessage(NULL,'Nur der Leader und der Co-Leader kann Clanitems kaufen!', displayHistoryBackLink());
exit;
}
if($user['level'] >= $item_info['req_level']) {
$fehler_m = 'Euer Clan hat nicht das nötige Level';
displayErrorMessage(NULL,$fehler_m, displayHistoryBackLink());
exit;
}
if($user['geld'] < $item_info['preis'])
{
@ -34,6 +43,7 @@ if($charm == 3)
displayErrorMessage(NULL,$fehler_m, displayHistoryBackLink());
exit;
}
$new_geld = $user[geld] - $item_info[preis];
mysql_query("UPDATE clan_item SET anzahl=anzahl-1 WHERE id=".$item_info[id]." LIMIT 1");
@ -94,6 +104,8 @@ if(!$charm)
$c_item[$row['item_id']] = 1;
}
$clan = getClan($user_ida['clan']);
while($row = mysql_fetch_array($item_name))
{
$info = '';
@ -111,10 +123,12 @@ if(!$charm)
<td align="center"><?php echo displayCount($row['tp']); ?></td>
<td align="center"><?php echo $info; ?></td>
<?php
if($c_item[$row['id']] === 1){
if($c_item[$row['id']] >= 1){
echo '<td align="center"><a href="javascript:if(confirm(\''.$row['name'].' Wirklich abreissen?\')==true) window.location.href=\'index.php?as=clan/c_markt&charm=5&item_id='.$row['id'].'\'"><img border=0 src="design/bilder/buttons/abreissen.gif" width="42" height="19"></a></td>';
} else{
echo '<td align="center"><a href="javascript:if(confirm(\''.$row['name'].' Wirklich kaufen?\')==true) window.location.href=\'index.php?as=clan/c_markt&charm=3&item_id='.$row['id'].'\'"><img border=0 src="design/bilder/buttons/kaufen.gif" width="42" height="19"></a></td>';
} else if($clan['level'] < $row['req_level']){
echo '<td align="center"><img border=0 src="design/bilder/buttons/lvlup.png" width="42" height="19"></td>';
} else {
echo '<td align="center"><a href="javascript:if(confirm(\''.$row['name'].' Wirklich kaufen?\')==true) window.location.href=\'index.php?as=clan/c_markt&charm=3&item_id='.$row['id'].'\'"><img border=0 src="design/bilder/buttons/kaufen.gif" width="42" height="19"></a></td>';
}
?>
</tr>
@ -129,4 +143,4 @@ if(!$charm)
</table>
<?php
}
?>
?>

File diff suppressed because it is too large Load Diff

@ -160,33 +160,149 @@ function inviteUser(array $user, $userid, array $clan = NULL){
}
}
define("DAVY_BACK_FIGHT", 1);
define("SURVIVAL", 2);
/**
*
* Challenge an other clan (Davy Back Fight)
* @param array $user the user array
* @param int $clanid the id of the clan to challenge
* @param int $validTime the amount of hours that the challenge is valid
*/
function challengeClan(array $user, $clanid, $type = DAVY_BACK_FIGHT, $anzahl, $validTime = 24) {
$qry = mysql_query('SELECT * FROM clan WHERE id = ' . $user['clan']);
$clan = mysql_fetch_assoc($qry);
function challengeClan(array $user, array $charids, $clanid, $validTime = 24) {
if($clan === NULL) {
$qry = mysql_query('Select * from clan where id = ' . $user['clan']);
$clan = mysql_fetch_assoc($qry);
}
$oclan = mysql_fetch_assoc(mysql_query('SELECT * FROM clan WHERE id = ' . $clanid));
if($clan['leader'] != $user['id'] && $clan['co_leader'] != $user['id']){
return 'Nur der Leader, bzw. der Co-Leader kann andere Clans herausfordern!!';
}
// TODO: Further implementation
return NULL;
if(!$clan || !$oclan) {
return 'Entweder bist du nicht in einem Clan oder der andere Clan existiert nicht mehr!!';
}
if($clan['leader'] != $user['id'] && $clan['co_leader'] != $user['id']){
return 'Nur der Leader, bzw. der Co-Leader kann andere Clans herausfordern!!';
}
// Fordere heraus!
mysql_query('INSERT INTO clan_challenge(clan_requester, clan_challenged, type, anzahl, valid, accepted) VALUES('.$user['clan'].', '.$clanid.','.$type.' , TIMESTAMPADD(HOUR, CURRENT_TIMESTAMP, 4), '.$anzahl.', false)');
if(mysql_affected_rows() > 0) {
if(is_numeric($oclan['leader'])) {
sendMessage($user['nickname'], $oclan['leader'], 'Davy Back Fight Herausforderung', 'Der Clan '.$oclan['clanname'].' hat euch zu einem Davy Back Fight herausgefordert! Über "Mein Clan" könnt ihr die Herausforderung annehmen!');
}
if(is_numeric($oclan['co_leader']) && $oclan['leader'] != $oclan['co_leader']) {
sendMessage($user['nickname'], $oclan['co_leader'], 'Davy Back Fight Herausforderung', 'Der Clan '.$oclan['clanname'].' hat euch zu einem Davy Back Fight herausgefordert! Über "Mein Clan" könnt ihr die Herausforderung annehmen!');
}
} else {
return 'Konnte den anderen Clan nicht herausfordern!!';
}
return NULL;
}
function acceptChallenge(array $user, array $charids) {
if($clan === NULL) {
$qry = mysql_query('Select * from clan where id = ' . $user['clan']);
$clan = mysql_fetch_assoc($qry);
}
if($clan['leader'] != $user['id'] && $clan['co_leader'] != $user['id']){
return 'Nur der Leader, bzw. der Co-Leader kann herausforderungen anderer Clans annehmen!!';
}
// TODO: Further implementation
return NULL;
function acceptChallenge($challengeid, array $user) {
$qry = mysql_query('Select * from clan where id = ' . $user['clan']);
$clan = mysql_fetch_assoc($qry);
if(!$clan) {
return 'Du bist in keinem Clan!!';
}
if($clan['leader'] != $user['id'] && $clan['co_leader'] != $user['id']){
return 'Nur der Leader, bzw. der Co-Leader kann herausforderungen anderer Clans annehmen!!';
}
$clan_challenge = mysql_fetch_assoc(mysql_query('SELECT * FROM clan_challenge WHERE clan_challenge_id = ' .$challengeid));
if($user['clan'] != $clan_challenge['clan_challenged']) {
return 'Du kannst die Herausforderung nicht annehmen, da du nicht im herausgeforderten Clan bist!';
}
// The user must be in the challanged clan
$oclan = mysql_fetch_assoc('SELECT * FROM clan WHERE id = '.$clan_challenge['clan_requester']);
mysql_query('UPDATE clan_challenge SET accepted = TRUE WHERE clan_challenge_id = ' .$challengeid);
if(mysql_affected_rows() > 0) {
if(is_numeric($oclan['leader'])) {
sendMessage($user['nickname'], $oclan['leader'], 'Davy Back Fight', 'Der Clan '.$oclan['clanname'].' hat eure Herausforderungen zu einem Davy Back Fight angenommen! Über "Mein Clan" könnt ihr nun Chars anmelden!');
}
if(is_numeric($oclan['co_leader']) && $oclan['leader'] != $oclan['co_leader']) {
sendMessage($user['nickname'], $oclan['co_leader'], 'Davy Back Fight', 'Der Clan '.$oclan['clanname'].' hat eure Herausforderungen zu einem Davy Back Fight angenommen! Über "Mein Clan" könnt ihr nun Chars anmelden!');
}
} else {
return 'Du kannst die Herausforderungen nicht annehmen. Wurde die Herausforderung schon angenommen?';
}
return NULL;
}
function getOpenChallengesByUser(array $user) {
$qry = mysql_query('SELECT * FROM clan_challenge WHERE accepted = FALSE AND clan_requester = '.$user['clan'].' OR clan_challenged = '.$user['clan']);
$array = array();
while($row = mysql_fetch_assoc($qry)) {
$array[] = $row;
}
return $array;
}
function getOpenChallengesByClanId($clanid) {
$qry = mysql_query('SELECT * FROM clan_challenge WHERE accepted = FALSE AND clan_requester = '.$clanid.' OR clan_challenged = '.$clanid);
$array = array();
while($row = mysql_fetch_assoc($qry)) {
$array[] = $row;
}
return $array;
}
/**
* This function lets a user take part in the clan fight! The clan fight will be calculated if all chars have been registered.
* A challenge can only be joined if there is no other char of the same user joined. If the given slot is free and the challangeid is valid.
* @param int $challengeid the id of the challenge
* @param array $user the user array
* @param int $charid the id of the char that should join
*/
function joinChallenge($challengeid, array $user, $charid, $slot ) {
$qry = mysql_query('Select * from clan where id = ' . $user['clan']);
$clan = mysql_fetch_assoc($qry);
if(!$clan) {
return 'Du bist in keinem Clan!!';
}
$clan_challenge = mysql_fetch_assoc(mysql_query('SELECT * FROM clan_challenge WHERE clan_challenge_id = ' .$challengeid));
if($user['clan'] != $clan_challenge['clan_challenged'] && $user['clan'] != $clan_challenge['clan_requester'] ) {
return 'Du kannst an der Herausforderung nicht teilnehmen, da du nicht in einem teilnehmenden Clan bist!';
}
$char = getChar($charid);
if($user['id'] != $char['besitzer']) {
return 'Du kannst den Char nicht an der Herausforderung teilnehmen lassen, da er dir nicht gehört!';
}
// query all clan_challange_participants to see if the user already has a char in competition!
}
/**
* This function does the calculation of the clan fight.
* @param int $challengeid the id of the challenge
*/
function calculateChallenge($challengeid) {
}
?>

Loading…
Cancel
Save