예제 #1
0
파일: event.php 프로젝트: testt98/ebattles
 function deletePlayers()
 {
     global $sql;
     $q = "SELECT " . TBL_PLAYERS . ".*" . " FROM " . TBL_PLAYERS . " WHERE (" . TBL_PLAYERS . ".Event = '" . $this->fields['EventID'] . "')";
     $result = $sql->db_Query($q);
     $num_players = mysql_numrows($result);
     if ($num_players != 0) {
         for ($j = 0; $j < $num_players; $j++) {
             $pID = mysql_result($result, $j, TBL_PLAYERS . ".PlayerID");
             deletePlayer($pID);
         }
     }
 }
예제 #2
0
    // TODO: only for ladders?
    updateStats($event_id, $time, TRUE);
    header("Location: eventmanage.php?eventid={$event_id}");
    exit;
}
if (isset($_POST['unban_player']) && $_POST['unban_player'] != "") {
    $playerid = $_POST['unban_player'];
    unbanPlayer($playerid);
    // TODO: only for ladders?
    updateStats($event_id, $time, TRUE);
    header("Location: eventmanage.php?eventid={$event_id}");
    exit;
}
if (isset($_POST['kick_player']) && $_POST['kick_player'] != "") {
    $playerid = $_POST['kick_player'];
    deletePlayer($playerid);
    if ($event->getField('FixturesEnable') == TRUE && $event->getField('Status') == 'active') {
        $event->brackets(true);
    }
    updateStats($event_id, $time, TRUE);
    header("Location: eventmanage.php?eventid={$event_id}");
    exit;
}
if (isset($_POST['del_player_games']) && $_POST['del_player_games'] != "") {
    $playerid = $_POST['del_player_games'];
    deletePlayerMatches($playerid);
    if ($event->getField('FixturesEnable') == TRUE) {
        $event->brackets(true);
    }
    updateStats($event_id, $time, TRUE);
    header("Location: eventmanage.php?eventid={$event_id}");
예제 #3
0
     } else {
         admin();
     }
     break;
 case "updateplayer":
     //
     if ($pcat == 4) {
         updatePlayer();
     } else {
         admin();
     }
     break;
 case "deleteplayer":
     //
     if ($pcat == 4) {
         deletePlayer();
     } else {
         admin();
     }
     break;
 case "playerbynumber":
     //
     if ($pcat == 3 || $pcat == 4) {
         PlayerByNumber();
     } else {
         admin();
     }
     break;
     // ************ Funkcje obs3ugi Gier *********************//
 // ************ Funkcje obs3ugi Gier *********************//
 case "addgame":
예제 #4
0
파일: clan.php 프로젝트: testt98/ebattles
 function deleteDivPlayers()
 {
     global $sql;
     $q_DivPlayers = "SELECT " . TBL_TEAMS . ".*, " . TBL_PLAYERS . ".*" . " FROM " . TBL_TEAMS . ", " . TBL_PLAYERS . " WHERE (" . TBL_TEAMS . ".Division = '" . $this->fields['DivisionID'] . "')" . " AND (" . TBL_PLAYERS . ".Team = " . TBL_TEAMS . ".TeamID)";
     $result_DivPlayers = $sql->db_Query($q_DivPlayers);
     $numDivPlayers = mysql_numrows($result_DivPlayers);
     for ($j = 0; $j < $numDivPlayers; $j++) {
         $pID = mysql_result($result_DivPlayers, $j, TBL_PLAYERS . ".PlayerID");
         deletePlayer($pID);
     }
 }
require_once "common.php";
require_once "functions-player.php";
protect();
showHeader();
$schoolID = Auth::schoolID();
if ($schoolID == 0) {
    die("Please log in to a coach account to manage players.");
}
if (isset($_POST['name'])) {
    $name = mysql_real_escape_string($_POST['name']);
    $gender = mysql_real_escape_string($_POST['gender']);
    addPlayer($name, $gender, $schoolID);
}
if (isset($_POST['delete'])) {
    $id = mysql_real_escape_string($_POST['delete']);
    deletePlayer($id);
}
if ($schoolID == 0) {
    $rs = mysql_query("SELECT * FROM player");
} else {
    $rs = mysql_query("SELECT * FROM player WHERE school_id={$schoolID}");
}
if (mysql_num_rows($rs) > 0) {
    echo <<<HELLO
<table width="250">
<tr>
\t<th>Name</th>
\t<th>Gender</th>
\t<th>Actions</th>
</tr>
HELLO;
예제 #6
0
}
while ($row = mysql_fetch_array($res)) {
    $deleteteam++;
    print "Deleting team {$row[0]} #{$row[1]}\n";
    deleteTeam($row[1]);
}
// Delete all teamless players, who havnt been logged on for 3 months.
$sql = "SELECT p.callsign, p.id " . "FROM l_player p " . "WHERE p.team = 0 " . "AND p.last_login < subdate(now(), INTERVAL 3 MONTH) ORDER BY p.callsign";
$res = mysql_query($sql);
if (!$res) {
    print " Failed: {$sql}\n";
}
while ($row = mysql_fetch_array($res)) {
    $deleteplayer++;
    print "Delete teamless player: " . $row[0] . "\n";
    deletePlayer($row[1], stripslashes($row[0]));
}
// Find and mark all active teams (played a match during the last 45 days)
// this may look odd if a user sees this, perhaps rewrite this.
$sql = "UPDATE l_team SET active = 'no'";
$res = mysql_query($sql);
if (!$res) {
    print " Failed: {$sql}\n";
}
$sql = "SELECT distinct t.id " . "FROM l_team t, l_fight f " . "WHERE (f.team1 = t.id or f.team2 = t.id) " . " AND f.tstamp > subdate(now(), INTERVAL 45 DAY) " . " and t.id != {$deadteam}";
$res = mysql_query($sql);
if (!$res) {
    print " Failed: {$sql}\n";
}
while ($row = mysql_fetch_array($res)) {
    $sql = "UPDATE l_team SET active = 'yes' WHERE id = {$row[0]}";
예제 #7
0
 } else {
     if ($type == "deleteGroup") {
         $message = deleteGroup($conn);
         $groups = readGroups($conn);
     } else {
         if ($type == "addPlayer") {
             $message = addPlayer($conn);
             $players = readPlayers($conn);
         } else {
             if ($type == "editPlayer") {
                 $message = editPlayer($conn);
                 $players = readPlayers($conn);
                 $characters = readCharacters($conn);
             } else {
                 if ($type == "deletePlayer") {
                     $message = deletePlayer($conn);
                     $players = readPlayers($conn);
                 } else {
                     if ($type == "addCharacter") {
                         $message = addCharacter($conn);
                         $characters = readCharacters($conn);
                     } else {
                         if ($type == "editCharacter") {
                             $message = editCharacter($conn);
                             $characters = readCharacters($conn);
                             $records = readRecords($conn);
                         } else {
                             if ($type == "deleteCharacter") {
                                 $message = deleteCharacter($conn);
                                 $characters = readCharacters($conn);
                             } else {
예제 #8
0
$event_id = intval($_GET['eventid']);
if (!$event_id) {
    header("Location: ./events.php");
    exit;
}
$event = new Event($event_id);
$error_str = '';
if (isset($_POST['quitevent'])) {
    $pid = $_POST['player'];
    // Player can quit an event if he has not played yet
    // TODO - can quit if event not started.
    $q = "SELECT DISTINCT " . TBL_PLAYERS . ".*" . " FROM " . TBL_PLAYERS . ", " . TBL_SCORES . " WHERE (" . TBL_PLAYERS . ".PlayerID = '{$pid}')" . " AND (" . TBL_SCORES . ".Player = " . TBL_PLAYERS . ".PlayerID)";
    $result = $sql->db_Query($q);
    $nbrscores = mysql_numrows($result);
    if ($nbrscores == 0) {
        deletePlayer($pid);
        $event->setFieldDB('IsChanged', 1);
    }
    header("Location: eventinfo.php?eventid={$event_id}");
}
if (isset($_POST['checkinevent'])) {
    $pid = $_POST['player'];
    checkinPlayer($pid);
    if ($event->getField('FixturesEnable') == TRUE && $event->getField('Status') == 'active') {
        $event->brackets(true);
    }
    $event->setFieldDB('IsChanged', 1);
    header("Location: eventinfo.php?eventid={$event_id}");
}
if (isset($_POST['teamcheckinevent'])) {
    $team_id = $_POST['team'];