function do_search($name, $search_aliases = false)
{
    global $currentconfig;
    global $currentconfignumber;
    global $coddb;
    global $t;
    global $text;
    $count = 0;
    $link = baselink();
    $query = "SELECT {$t['b3_clients']}.name, {$t['players']}.id, {$t['players']}.fixed_name,\n              {$t['players']}.hide \n              FROM {$t['b3_clients']}, {$t['players']}\n              WHERE ({$t['b3_clients']}.id = {$t['players']}.client_id)\n              AND ( \n                      ({$t['b3_clients']}.name LIKE \"%{$name}%\")\n                  OR\n                      ({$t['players']}.fixed_name LIKE \"%{$name}%\")\n                  )\n              AND {$t['players']}.hide = 0";
    $result = $coddb->sql_query($query);
    opentablerow('100');
    echo "<td>" . $text["currentplnames"] . "<td></tr><tr>";
    while ($row = $coddb->sql_fetchrow($result)) {
        opentablecell('100');
        if ($row['fixed_name'] == "") {
            echo "<a href=\"{$link}?func=player&playerid={$row['id']}&config={$currentconfignumber}\">" . htmlspecialchars(utf2iso($row['name'])) . "</a><br/>";
            $count++;
        } else {
            if (stristr($row['fixed_name'], $name)) {
                echo "<a href=\"{$link}?func=player&playerid={$row['id']}&config={$currentconfignumber}\">" . htmlspecialchars(utf2iso($row['fixed_name'])) . "</a><br/>";
                $count++;
            }
        }
        closetablecell();
        echo "</tr><tr>";
    }
    closetablerow();
    if ($search_aliases == "true") {
        $query = "SELECT {$t['b3_aliases']}.alias, {$t['b3_clients']}.name, {$t['players']}.id\n        FROM {$t['b3_aliases']}, {$t['b3_clients']}, {$t['players']}\n        WHERE ({$t['b3_aliases']}.alias LIKE \"%{$name}%\")\n        AND {$t['b3_aliases']}.client_id = {$t['b3_clients']}.id\n        AND {$t['b3_clients']}.id = {$t['players']}.client_id\n        AND {$t['players']}.hide = 0\n        AND {$t['players']}.fixed_name = '' ";
        $result = $coddb->sql_query($query);
        if ($coddb->sql_numrows($result) > 0) {
            echo "Alias results:<br/>";
        }
        opentablerow('100');
        echo "<td>Search results (aliase -> current playername)<td></tr><tr>";
        while ($row = $coddb->sql_fetchrow($result)) {
            opentablecell('100');
            echo "{$row['alias']} -> <a href=\"{$link}?func=player&playerid={$row['id']}&config={$currentconfignumber}\">{$row['name']}</a><br/>";
            $count++;
            closetablecell();
            echo "</tr><tr>";
        }
        closetablerow();
    }
    return $count;
}
예제 #2
0
function player_compare_item($player1, $player2, $citem = "skill", $cbar = true, $switchwinner = false, $columns = 1)
{
    global $separatorline;
    global $ccounter1;
    global $ccounter2;
    global $main_width;
    $cwidth = $main_width / $columns - 200;
    if (!is_numeric($player1[$citem]) || !is_numeric($player2[$citem])) {
        $cbar = false;
        $cclass1 = "innertable";
        $cclass2 = "innertable";
    } else {
        if ($player1[$citem] >= $player2[$citem]) {
            if (is_numeric($player1[$citem])) {
                $player1perc = 1;
                $player2perc = $player2[$citem] / $player1[$citem];
            }
            $cclass1 = "innertable";
            $cbarcolor1 = "green";
            $cclass2 = "attention";
            $cbarcolor2 = "red";
            $ccounter2++;
        } else {
            if (is_numeric($player1[$citem])) {
                $player1perc = $player1[$citem] / $player2[$citem];
                $player2perc = 1;
            }
            $cclass1 = "attention";
            $cbarcolor1 = "red";
            $cclass2 = "innertable";
            $cbarcolor2 = "green";
            $ccounter1++;
        }
        if ($switchwinner) {
            if ($cclass1 == "attention") {
                $cclass1 = "innertable";
                $cbarcolor1 = "green";
                $cclass2 = "attention";
                $cbarcolor2 = "red";
                $ccounter2++;
                $ccounter1--;
            } else {
                $cclass1 = "attention";
                $cbarcolor1 = "red";
                $cclass2 = "innertable";
                $cbarcolor2 = "green";
                $ccounter1++;
                $ccounter2--;
            }
        }
    }
    opentablerow(100);
    echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" class=\"innertable\">";
    if ($cbar) {
        $temp1 = sprintf("%.2f", $player1perc) * 100;
        $temp2 = sprintf("%.2f", $player2perc) * 100;
        echo "<tr height=\"10\" class=\"outertable\"><td align=\"center\" colspan=\"3\">" . ucfirst($citem) . "</td></tr>";
        echo "<tr height=\"10\"><td class={$cclass1} width=\"140\" align=\"left\">" . htmlspecialchars(utf2iso($player1['name'])) . "</td><td class={$cclass1} width=\"60\" align=\"left\">" . $player1[$citem] . "</td><td width=\"{$cwidth}\" class={$cclass1} align=\"left\"><img src=\"images/bars/bar-small/" . $cbarcolor1 . "_middle_9.gif\" height=\"9\" width=\"" . $player1perc * $cwidth . "\" title=\"" . $temp1 . "%\"></td></tr>";
        if ($separatorline == 1) {
            echo "<tr><td colspan=\"3\" class=\"outertable\"><img src=\"images/spacer.gif\" width=\"1\" height=\"1\" alt=\"\"></td></tr>";
        }
        // This draws a one pixel line between rows
        echo "<tr height=\"10\"><td class={$cclass2} width=\"140\" align=\"left\">" . htmlspecialchars(utf2iso($player2['name'])) . "</td><td class={$cclass2} width=\"60\" align=\"left\">" . $player2[$citem] . "</td><td width=\"{$cwidth}\" class={$cclass2} align=\"left\"><img src=\"images/bars/bar-small/" . $cbarcolor2 . "_middle_9.gif\" height=\"9\" width=\"" . $player2perc * $cwidth . "\" title=\"" . $temp2 . "%\"></td></tr>";
    } elseif ($citem == "country") {
        echo "<tr height=\"10\" class=\"outertable\"><td align=\"center\" colspan=\"2\">" . ucfirst($citem) . "</td></tr>";
        echo "<tr height=\"10\"><td class={$cclass1} width=\"140\" align=\"left\">" . htmlspecialchars(utf2iso($player1['name'])) . "</td><td class={$cclass1} width=\"60\" align=\"center\">" . $player1['flag'] . "</td></tr>";
        if ($separatorline == 1) {
            echo "<tr><td colspan=\"2\" class=\"outertable\"><img src=\"images/spacer.gif\" width=\"1\" height=\"1\" alt=\"\"></td></tr>";
        }
        // This draws a one pixel line between rows
        echo "<tr height=\"10\"><td class={$cclass2} width=\"140\" align=\"left\">" . htmlspecialchars(utf2iso($player2['name'])) . "</td><td class={$cclass2} width=\"60\" align=\"center\">" . $player2['flag'] . "</td></tr>";
    } else {
        echo "<tr height=\"10\" class=\"outertable\"><td align=\"center\" colspan=\"2\">" . ucfirst($citem) . "</td></tr>";
        echo "<tr height=\"10\"><td class={$cclass1} width=\"140\" align=\"left\">" . htmlspecialchars(utf2iso($player1['name'])) . "</td><td class={$cclass1} width=\"60\" align=\"left\">" . $player1[$citem] . "</td></tr>";
        if ($separatorline == 1) {
            echo "<tr><td colspan=\"2\" class=\"outertable\"><img src=\"images/spacer.gif\" width=\"1\" height=\"1\" alt=\"\"></td></tr>";
        }
        // This draws a one pixel line between rows
        echo "<tr height=\"10\"><td class={$cclass2} width=\"140\" align=\"left\">" . htmlspecialchars(utf2iso($player2['name'])) . "</td><td class={$cclass2} width=\"60\" align=\"left\">" . $player2[$citem] . "</td></tr>";
    }
    closetablerow();
}
예제 #3
0
    if (isset($_SESSION['currentconfignumber'])) {
        $currentconfignumber = $_SESSION['currentconfignumber'];
        $currentconfig = "../config/statsconfig" . $currentconfignumber . ".php";
    }
    // double check config number found point to an existing config file or fallback to config 1
    if (!file_exists($currentconfig)) {
        $currentconfig = "config/statsconfig1.php";
        $currentconfignumber = 1;
    }
}
require_once $currentconfig;
// pop should hold the subdir depth of this file in relation to the xlrstats root.
$pop = 1;
include "../languages/languages.php";
displaysimpleheader(1);
opentablerow('100');
opentablecell('100');
echo "<h1 align=\"center\">XLRstats - Signature Builder </h1>";
if (isset($_POST['submit'])) {
    if (strlen($_POST['id']) == 0) {
        die("Please enter a player ID");
    }
    $ptemp = explode("/", GetFileDir($_SERVER['PHP_SELF']));
    array_pop($ptemp);
    array_pop($ptemp);
    $link = "http://" . $_SERVER['HTTP_HOST'] . implode("/", $ptemp);
    extract($_POST, EXTR_PREFIX_ALL, "in");
    $in_id = stripslashes($in_id);
    $player_id = $in_id;
    if ($currentconfignumber != 0) {
        $url = $link . "/sig/?config=" . $currentconfignumber . "&id=" . urlencode($player_id);