Files
TravianZ/ajax.php
T
iopietro 62d6e19ee9 The first release of the refactored version
It's still a work in progress, there are a lot of things that will
change in the final release
2018-09-16 17:22:39 +02:00

82 lines
2.6 KiB
PHP

<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Filename ajax.php ##
## Developed by: Dzoki ##
## License: TravianX Project ##
## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
## ##
#################################################################################
// even with autoloader created, we can't use it here yet, as it's not been created
// ... so, let's see where it is and include it
$autoloader_found = false;
// go max 5 levels up - we don't have folders that go deeper than that
for ($i = 0; $i < 5; $i++) {
$autoprefix = str_repeat('../', $i);
if (file_exists($autoprefix.'autoloader.php')) {
$autoloader_found = true;
include_once $autoprefix.'autoloader.php';
break;
}
}
if (!$autoloader_found) {
die('Could not find autoloading class.');
}
// we need config to determine whether to log access or not
include_once($autoprefix.'GameEngine/config.php');
use App\Utils\AccessLogger;
AccessLogger::logRequest();
switch($_GET['f']) {
case 'k7':
header('Content-Type: application/json');
$x = preg_replace("/[^a-zA-Z0-9_-]/","",$_GET['x']);
$y = preg_replace("/[^a-zA-Z0-9_-]/","",$_GET['y']);
$xx = preg_replace("/[^a-zA-Z0-9_-]/","",$_GET['xx']);
$yy = preg_replace("/[^a-zA-Z0-9_-]/","",$_GET['yy']);
$howmany = $x - $xx;
if($howmany == 12 || $howmany == -12) {
include("templates/Ajax/mapscroll2.tpl");
}
else {
include("templates/Ajax/mapscroll.tpl");
}
break;
case 'kp':
$z = preg_replace("/[^a-zA-Z0-9_-]/","",$_GET['z']);
//include("Templates/Ajax/plusmap.tpl");
break;
case 'qst':
if (isset($_GET['qact'])){
$qact=preg_replace("/[^a-zA-Z0-9_-]/","",$_GET['qact']);
}else {
$qact=null;
}
if (isset($_GET['qact2'])){
$qact2=preg_replace("/[^a-zA-Z0-9_-]/","",$_GET['qact2']);
}else {
$qact2=null;
}
if (isset($_GET['qact3'])){
$qact3=preg_replace("/[^a-zA-Z0-9_-]/","",$_GET['qact3']);
}else {
$qact3=null;
}
if (!isset($_SESSION)) {
session_start();
}
if (isset($_SESSION['qtyp']) && $_SESSION['qtyp']==37) {
include("templates/Ajax/quest_core.tpl");
}else{
include("templates/Ajax/quest_core25.tpl");
}
break;
}
?>