pokemon-showdown-client/action.php
Ben Davies e3fcaa492c
Properly set the encoding to UTF-8 on all HTML pages (#1467)
This adds the BOM to all HTTP pages as per the HTML5 spec and ensures
all pages use UTF-8 as their meta charset (which is still kept for
compatibility with older browsers).
2020-02-23 00:13:56 -08:00

38 lines
1009 B
PHP

<?php
/*
License: GPLv2 or later
<http://www.gnu.org/licenses/gpl-2.0.html>
*/
error_reporting(E_ALL);
if (@$_GET['act'] === 'dlteam') {
header("Content-Type: text/plain; charset=utf-8");
if (substr(@$_SERVER['HTTP_REFERER'], 0, 32) !== 'https://play.pokemonshowdown.com') {
// since this is only to support Chrome on HTTPS, we can get away with a very specific referer check
die("access denied");
}
echo base64_decode(@$_GET['team']);
die();
}
if (preg_match('/^http\\:\\/\\/[a-z0-9]+\\.psim\\.us\\//', $_SERVER['HTTP_REFERER'] ?? '')) {
header("Access-Control-Allow-Origin: *");
} else if ($_POST['sid'] ?? null) {
header("Access-Control-Allow-Origin: *");
}
// header("X-Debug: " . @$_SERVER['HTTP_REFERER']);
include_once 'lib/ntbb-session.lib.php';
include_once '../pokemonshowdown.com/config/servers.inc.php';
include_once 'lib/dispatcher.lib.php';
$dispatcher = new ActionDispatcher(array(
new DefaultActionHandler(),
new LadderActionHandler()
));
$dispatcher->executeActions();