Esempio n. 1
0
<?php

### pre_common_member_verify
### e.g. wp-content/plugins/likedome/tournament.php?opt=['methodname']&type=1&flag=1
define('LIKEDOME_PLUGINS_ROOT', dirname(__FILE__));
require_once LIKEDOME_PLUGINS_ROOT . '/includes/classes.php';
tournament();
function tournament()
{
    global $wpdb, $user_identity, $user_ID;
    header('Content-Type: text/html; charset=' . getCharset() . '');
    if (intval($_REQUEST['matchid']) > 0 && intval($_REQUEST['opt']) > 0) {
        echo "参数错误!";
        exit;
    }
    $matchid = intval($_REQUEST['matchid']);
    if (!empty($user_identity)) {
        $username = htmlspecialchars(addslashes($user_identity));
    } else {
        if (!empty($_COOKIE['comment_author_' . COOKIEHASH])) {
            $username = htmlspecialchars(addslashes($_COOKIE['comment_author_' . COOKIEHASH]));
        } else {
            echo "需要登陆";
            exit;
        }
    }
    switch ($_REQUEST['opt']) {
        case 'apply':
            if (!getUserVerify($user_ID)) {
                echo "需要选手认证才可以报名";
                exit;
Esempio n. 2
0
<?php

//header("Content-Type:application/json");
include_once "../base/bd_configuracion.php";
include_once "../base/funcionesBase.php";
include_once "../sharedfunctions/SharedFunctions.php";
include_once "../Tournament.php";
$con = new bd_configuracion();
$con->conectar();
if (isset($_POST['data']) && empty($_POST['data']) == false) {
    $strTemp = $_POST['data'];
    try {
        $stringWinnersArray = tournament(str_replace(' ', '', $strTemp));
        setWinnerPoints(getNameWinner($stringWinnersArray));
        deliverResponse(200, $stringWinnersArray);
    } catch (Exception $e) {
        deliverResponse(400, "Error processing data");
    }
} else {
    deliverResponse(400, "Error processing data");
}
function deliverResponse($status, $data)
{
    header("HTTP/1.1 {$status}");
    $response['status'] = $status;
    $response['winner'] = str_replace('"', '', $data);
    $jsonResponse = json_encode($response);
    echo $jsonResponse;
}
<?php

include_once "../base/bd_configuracion.php";
include_once "../base/funcionesBase.php";
include_once "../sharedfunctions/SharedFunctions.php";
include_once "/Tournament.php";
include_once "../sharedfunctions/fileFunctions.php";
$con = new bd_configuracion();
$con->conectar();
$stringArchivo = uploadFile();
if ($stringArchivo != "") {
    $stringWinnersArray = tournament(str_replace(' ', '', $stringArchivo));
    setWinnerPoints(getNameWinner($stringWinnersArray));
}
$resultado = getTopTen();
?>

<html lang="en">

	<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-5"> 
	 <script src="//use.edgefonts.net/poiret-one.js"></script>
	<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
	<head>

	<script src="//code.jquery.com/jquery-1.11.3.min.js"></script>	
	<script type="text/javascript" src="javascript/TournamentJS.js"></script>
	<script type="text/javascript" src="javascript/PaperSiccorsRockRules.js"></script>
	<!-- <script>var gameListInput = '<?php 
echo $stringArchivo;
?>
';</script> -->