|
|
|
<?php
|
|
|
|
/*
|
|
|
|
*
|
|
|
|
* @copyright (c) 2010 animegame.eu
|
|
|
|
* @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/config.inc.php');
|
|
|
|
include_once(ROOT_PATH.'/include/parse.inc.php');
|
|
|
|
include_once(ROOT_PATH.'/include/fehlerausgabe.inc.php');
|
|
|
|
include_once(ROOT_PATH.'/include/abholcodes.inc.php');
|
|
|
|
include_once(ROOT_PATH.'/include/designfunctions.inc.php');
|
|
|
|
include_once(ROOT_PATH.'/include/semaphore.inc.php');
|
|
|
|
include_once(ROOT_PATH.'/include/kampf_anzeige.inc.php');
|
|
|
|
include_once(ROOT_PATH.'/include/schatz.inc.php');
|
|
|
|
include_once(ROOT_PATH.'/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 :)
|
|
|
|
|
|
|
|
?>
|