You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
2.5 KiB

14 years ago
<?php
/*
*
* @copyright (c) 2010 animegame.eu
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public Licence
*
*/include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/config.inc.php');
include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/parse.inc.php');
include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/fehlerausgabe.inc.php');
include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/abholcodes.inc.php');
include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/designfunctions.inc.php');
include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/semaphore.inc.php');
include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/kampf_anzeige.inc.php');
include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/schatz.inc.php');
include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/char.inc.php');
// GET-Section
// Kritisch (SQL-Injections)
$char_id = validateUnsignedInteger($_GET['char_id'], null);
$ressource = 'User:'.$user_ida['id'];
// Unkritisch
$code = $_GET['code'];
$abort = $_GET['abort'];
$true = $_GET['true'];
if(!is_numeric($char_id)){
displayErrorMessage(NULL,'Fehler aufgetreten ... (ID des Chars keine Zahl!)', displayHistoryBackLink());
exit;
}
if(!semaphoreUP($ressource)){ // TRUE, diese Anfrage darf bearbeitet werden
displayErrorMessage(NULL,'Verarbeitung gerade in Gange, bitte warten...', displayHistoryBackLink());
exit;
}
$char = getChar($char_id);
if($char['status'] != 'Schatz Suche') {
displayErrorMessage(NULL,'Der Charakter ist nicht auf Schatzsuche', displayHistoryBackLink());
semaphoreDown($ressource);
exit;
}
if(!isUserOwnerOf($user_ida['id'],$char_id)) {
displayErrorMessage(NULL,'Der Char ist nicht deiner!', displayHistoryBackLink());
semaphoreDown($ressource);
exit;
}
if(!checkAbholcode($char_id, $code)){
displayErrorMessage(NULL,'Der Abholcode ist falsch!', displayHistoryBackLink());
semaphoreDown($ressource);
exit;
}
if($abort == 'cancel'){
if ($true == 1) {
interruptSchatzSuche($char_id);
displayErrorMessage(NULL,'Die Schatzsuche wurde abgebrochen!', displayIndexBackLink());
} else {
echo '<p>Schatz Suche wirklich abbrechen?</p>';
echo '<p><a href="./schatz3.php?char_id='.$char_id.'&code='.$code.'&abort=cancel&true=1">Ja</a> | <a href="./index.php?as=abholen&ab=Schatz Suche&char_id='.$char_id.'">Nein</a></p>';
}
} else{
if(($text = displaySchatzSuche($char)) !== null){
displayErrorMessage(NULL,$text, displayHistoryBackLink());
}
}
semaphoreDown($ressource); // Gebe die Useraktionen wieder frei :)
?>