本文整理汇总了PHP中Player::findByName方法的典型用法代码示例。如果您正苦于以下问题:PHP Player::findByName方法的具体用法?PHP Player::findByName怎么用?PHP Player::findByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Player
的用法示例。
在下文中一共展示了Player::findByName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: content
function content()
{
$playername = "";
if (isset($_SESSION['username'])) {
$playername = $_SESSION['username'];
}
if (isset($_GET['player'])) {
$playername = $_GET['player'];
}
if (isset($_POST['player'])) {
$playername = $_POST['player'];
}
if (chop($playername) != "") {
$player = Player::findByName($playername);
if (!is_null($player)) {
profileTable($player);
} else {
echo "<center>\n";
echo "{$playername} could not be found in the database. Please check";
echo " your spelling and try again.\n";
echo "</center>\n";
}
} else {
echo "<center>\n";
echo "Please <a href=\"login.php\">log in</a> to see";
echo " your profile. You may also use the search below without";
echo " logging in.\n";
echo "</center>\n";
}
echo "<br><br>\n";
searchForm($playername);
}
示例2: findOrCreateByName
static function findOrCreateByName($playername)
{
$found = Player::findByName($playername);
if (is_null($found)) {
return Player::createByName($playername);
}
return $found;
}
示例3: content
function content()
{
global $playername;
if (chop($playername) != "") {
$player = Player::findByName($playername);
if (!is_null($player)) {
profileTable($player);
} else {
echo "<center>\n";
echo "{$playername} could not be found in the database. Please check";
echo " your spelling and try again.\n";
echo "</center>\n";
}
} else {
echo "<center>\n";
echo "Please <a href=\"login.php\">log in</a> to see";
echo " your profile. You may also use the search without";
echo " logging in.\n";
echo "</center>\n";
}
echo "<br /><br />\n";
}
示例4: dciinputmatches
function dciinputmatches($event, $reg, $data)
{
echo "Adding matches to {$event->name}.<br />";
$lines = explode_dcir_lines($data);
for ($table = 0; $table < sizeof($lines) / 6; $table++) {
$offset = $table * 6;
$numberofrounds = explode(",", $lines[$offset]);
$playeraresults = explode(",", $lines[$offset + 1]);
$playerbresults = explode(",", $lines[$offset + 2]);
$playerawins = explode(",", $lines[$offset + 3]);
$playerbwins = explode(",", $lines[$offset + 4]);
for ($round = 1; $round <= sizeof($numberofrounds); $round++) {
if ($numberofrounds[$round - 1] != 0) {
// find by name returns player object! not just a name!
$playera = Player::findByName($reg[$playeraresults[$round - 1] - 1]);
$playerb = Player::findByName($reg[$playerbresults[$round - 1] - 1]);
// may want to write a custom function later that just returns name
// should probably do a check to for NULL here for to see if player object
// was in fact returned for playera and playerb, just in case the dciregister
// function above failed to register
$result = 'D';
// TODO: need to do a check for a bye here
if ($playerawins[$round - 1] > $playerbwins[$round - 1]) {
$result = 'A';
}
// player A wins
if ($playerbwins[$round - 1] > $playerawins[$round - 1]) {
$result = 'B';
}
// player B wins
echo "{$playera->name} vs {$playerb->name} in Round: {$round} and ";
if ($result == 'A') {
echo "{$playera->name} wins {$playerawins[$round - 1]} - {$playeralosses[$round - 1]}<br />";
}
if ($result == 'B') {
echo "{$playerb->name} wins {$playerbwins[$round - 1]} - {$playerblosses[$round - 1]}<br />";
}
if ($result == 'D') {
echo " match is a draw<br />";
}
$event->addMatch($playera->name, $playerb->name, $round, $result, $playerawins[$round - 1], $playerbwins[$round - 1]);
}
}
}
}
示例5: die
<?php
require_once '../lib.php';
if (strncmp($_SERVER['HTTP_USER_AGENT'], "infobot", 7) != 0) {
die("You're not infobot!");
}
if ($_GET['passkey'] != $CONFIG['infobot_passkey']) {
die("Wrong passkey");
}
# generate a user passkey for verification
$random_num = mt_rand();
$key = sha1($random_num);
$challenge = substr($key, 0, 5);
$player = Player::findByName($_GET['username']);
if (!$player) {
echo "<UaReply>You're not registered on {$CONFIG['site_name']}!</UaReply>";
}
$player->setChallenge($challenge);
echo "<UaReply>Your verification code for {$CONFIG['site_name']} is {$challenge}</UaReply>";
示例6: updateReg
function updateReg()
{
$event = new Event($_POST['name']);
for ($ndx = 0; $ndx < sizeof($_POST['delentries']); $ndx++) {
$event->removeEntry($_POST['delentries'][$ndx]);
}
$new = chop($_POST['newentry']);
if (strcmp($new, "") != 0) {
$player = Player::findByName($new);
if (!$player) {
$player = Player::createByName($new);
}
$event->addPlayer($player->name);
}
}
示例7: handleActions
function handleActions()
{
global $hasError;
global $errormsg;
if (!isset($_POST['series'])) {
return;
}
$seriesname = $_POST['series'];
$series = new Series($seriesname);
if (!$series) {
return;
}
if (!$series->authCheck(Player::loginName())) {
return;
}
if ($_POST['action'] == "Update Series") {
$newactive = $_POST['isactive'];
$newtime = $_POST['hour'];
$newday = $_POST['start_day'];
$prereg = 0;
if (isset($_POST['preregdefault'])) {
$prereg = $_POST['preregdefault'];
}
$series = new Series($seriesname);
if ($series->authCheck(Player::loginName())) {
$series->active = $newactive;
$series->start_time = $newtime . ":00:00";
$series->start_day = $newday;
$series->prereg_default = $prereg;
$series->save();
}
} else {
if ($_POST['action'] == "Change Logo") {
if ($_FILES['logo']['size'] > 0) {
$file = $_FILES['logo'];
$name = $file['name'];
$tmp = $file['tmp_name'];
$size = $file['size'];
$type = $file['type'];
$series->setLogo($tmp, $type, $size);
}
} else {
if ($_POST['action'] == "Update Organizers") {
if (isset($_POST['delstewards'])) {
$removals = $_POST['delstewards'];
foreach ($removals as $deadsteward) {
$series->removeSteward($deadsteward);
}
}
if (!isset($_POST['addsteward'])) {
return;
}
$addition = $_POST['addsteward'];
$addplayer = Player::findByName($addition);
if ($addplayer == NULL) {
$hasError = true;
$errormsg .= "Can't add {$addition} to stewards, they don't exist!";
return;
}
if ($addplayer->verified == 0 && Player::getSessionPlayer()->super == 0) {
$hasError = true;
$errormsg .= "Can't add {$addplayer->name} to stewards, they aren't a verified user!";
return;
}
$series->addSteward($addplayer->name);
} else {
if ($_POST['action'] == "Update Points Rules") {
$new_rules = $_POST['new_rules'];
$series->setSeasonRules($_POST['season'], $new_rules);
}
}
}
}
}