当前位置: 首页>>代码示例>>PHP>>正文


PHP Player::update方法代码示例

本文整理汇总了PHP中Player::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Player::update方法的具体用法?PHP Player::update怎么用?PHP Player::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Player的用法示例。


在下文中一共展示了Player::update方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: update

 public static function update($id)
 {
     $params = $_POST;
     $attributes = array('id' => $id, 'name' => $params['name'], 'password' => $params['password']);
     $Player = new Player($attributes);
     $errors = $Player->errors();
     if (count($errors) != 0) {
         View::make('/Player/edit.html', array('errors' => $errors, 'attributes' => $attributes));
     } else {
         $Player->update();
         Redirect::to('/player/' . $Player->id, array('message' => 'Pelaajaa on muokattu onnistuneesti!'));
     }
 }
开发者ID:Jonharju,项目名称:Tsoha-Bootstrap,代码行数:13,代码来源:player_controller.php

示例2:

$origplayer->Email = $email;
$origplayer->OKemail = $okem;
$origplayer->Trivia = $trivia;
$origplayer->Phone = $phone;
$origplayer->Notes = $notes;
$origplayer->Latestcall = $latest == "None" ? "" : $latest;
if ($origplayer->ILdiv == 0) {
    if (isset($_POST["join"])) {
        $origplayer->ILdiv = assign_ildiv($rank);
    }
} else {
    if (!$origplayer->ILpaid && !isset($_POST["stayin"])) {
        $origplayer->ILdiv = 0;
    }
}
$origplayer->update();
if (strlen($passw) != 0 && $passw != $origplayer->get_passwd()) {
    $origplayer->set_passwd($passw);
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<?php 
$Title = "Player details updated OK";
include 'php/head.php';
print <<<EOT
<body>
<script language="javascript" src="webfn.js"></script>

EOT;
include 'php/nav.php';
开发者ID:Britgo,项目名称:Online-League,代码行数:31,代码来源:ownupd2.php

示例3: Player

        break;
    case 'join':
        // Join an already created game
        // Create new player object
        $player = new Player($gameId, $playerName);
        // joingame() returns player object as JSON to be returned to js
        $response = joinGame($player, $gameId);
        break;
    case 'u':
        // Update settings for player
        // Create new player object
        $player = new Player($gameId, $playerName, $score, $playerId);
        // The update() method returns the gameStatus.
        // If more than one player is still active, player object is returned as JSON.
        // If only one player has lives left, the game is over, and JSON with gameStatus: finished is returned
        $u = $player->update($gameId, $playerId, $score);
        if ($u == 'updated' || $u == 'ongoing') {
            $response = json_encode($player, JSON_UNESCAPED_UNICODE);
        } else {
            if ($u == 'finished') {
                $s = $player->gameStatus;
                $response = "{ 'gameStatus': {$s} }";
            }
        }
    default:
        //
        break;
}
//**
//		Actions
//**
开发者ID:jtguggedal,项目名称:jtguggedal.github.io,代码行数:31,代码来源:game.php

示例4: Player

    exit;
}
?>
            <!-- MAIN SECTION -->
            <section class="main-section">
                <div class="small-12 columns">
                    <div class="row">
                        <h4>joueur - <?php 
$player = new Player();
if (isset($_POST["id"])) {
    $player->initProperty($_POST["id"], $_POST["firstName"], $_POST["lastName"], $_POST["teamId"]);
    $player->PageMode = $_POST["pageMode"];
    $player->validate($mySql);
    if (!$player->getHasError()) {
        if ($player->PageMode == Constants::PAGE_MODE_EDIT) {
            $player->update($mySql);
        } else {
            $player->addNew($mySql);
        }
        header('Location: player.php');
        exit;
    }
    echo $player->getFullName();
} else {
    if (isset($_GET["id"])) {
        $player->initDB($_GET["id"], $mySql);
        echo $player->getFullName();
        $player->PageMode = Constants::PAGE_MODE_EDIT;
    } else {
        echo "[Nouveau]";
        $player->PageMode = Constants::PAGE_MODE_ADD;
开发者ID:jgthibault,项目名称:BaseballTP,代码行数:31,代码来源:player_edit.php

示例5: removeMember

 /**
  * Removes a member from the team
  *
  * @param  int  $id The id of the player to remove
  * @return void
  */
 public function removeMember($id)
 {
     if (!$this->isMember($id)) {
         throw new Exception("The player is not a member of that team");
     }
     $player = new Player($id);
     $player->update("team", null, "s");
     $this->update('members', --$this->members, "i");
 }
开发者ID:kleitz,项目名称:bzion,代码行数:15,代码来源:Team.php

示例6: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $players = Player::findOrFail($id);
     $data = Input::all();
     $validator = Validator::make($data, Player::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     // Helper: File Upload in Player Model
     $data['id_copy'] = Player::uploadFile(Input::file('id_copy'), 'id_copy');
     $data['photo'] = Player::uploadFile(Input::file('photo'), 'photo');
     $players = new Player($data);
     $players->update($data);
     return View::make('players.index')->with('message', 'file update was successful');
 }
开发者ID:Homeboyzandroid,项目名称:greensport,代码行数:21,代码来源:PlayersController.php

示例7: testUpdateInvalidPlayer

 /**
  * test updating a Player that already exists
  *
  * @expectedException PDOException
  **/
 public function testUpdateInvalidPlayer()
 {
     // Create a Player with a non null player id and watch it fail
     $player = new Player(null, $this->Player->getPlayerId());
     $player->update($this->getPDO());
 }
开发者ID:chrispaul3625,项目名称:sprots,代码行数:11,代码来源:MasterTestIgnore.php

示例8: loginAction

 /**
  * Log in - show the login form or handle a login request
  * 
  * @todo Implement real authentication
  */
 public function loginAction()
 {
     if ($this->getRequest()->getMethod() != 'POST') {
         // Not a POST request, show log-in form
         $view = $this->initView();
         $this->render();
     } else {
         // Handle log-in form
         $username = $this->getRequest()->getParam('user');
         if ($username) {
             $password = $this->getRequest()->getParam('password');
         } else {
             $username = $this->getRequest()->getParam('suser');
             $password = $this->getRequest()->getParam('spassword');
         }
         // setup Zend_Auth adapter for a database table
         $dbAdapters = Zend_Registry::get('dbAdapters');
         $authAdapter = new Zend_Auth_Adapter_DbTable($dbAdapters['user'], 'nukevo_users', 'username', 'user_password', 'MD5(?)');
         // Set the input credential values to authenticate against
         $authAdapter->setIdentity($username);
         $authAdapter->setCredential($password);
         // do the authentication
         $auth = Zend_Auth::getInstance();
         $result = $auth->authenticate($authAdapter);
         if ($result->isValid()) {
             // success: store database row to auth's storage
             // system. (Not the password though!)
             $data = $authAdapter->getResultRowObject(null, 'password');
             $auth->getStorage()->write($data);
             Zend_Session::regenerateId();
             $this->session->logged_in = true;
             $this->session->username = $username;
             $player_table = new Player();
             $player = $player_table->getPlayerForUsername($username);
             if ($player) {
                 $this->session->steamid = $player->steamid;
             } else {
                 $member_table = new Members();
                 $member = $member_table->getMember($user);
                 if ($member) {
                     $this->session->steamid = 'STEAM_' . $member->steamid;
                     // Update player record's username
                     $player = $player_table->getPlayerForSteamid($this->session->steamid);
                     if ($player) {
                         $where = $table->getAdapter()->quoteInto('steamid = ?', $this->session->steamid);
                         $player_table->update(array('username' => $username), $where);
                     }
                 }
             }
             //$this->_forward('profile');
             $this->_redirect('/sc/player/show/user/' . $username);
         } else {
             $view = $this->initView();
             $view->user = $username;
             $view->error = 'Wrong user name or password, please try again';
             $this->render();
         }
     }
 }
开发者ID:neffers,项目名称:Nefcraft,代码行数:64,代码来源:UserController.php

示例9: authenticate

 /**
  * Checks players password.
  *
  * @param String $username Username of user attempting to authenticate.
  * @param String $password Password of user attempting to authenticate.
  *
  * @return Player Returns player if authentication was successful. Otherwise returns null.
  */
 public static function authenticate($username, $password)
 {
     $query = DB::connection()->prepare('SELECT * FROM Player WHERE username = :username LIMIT 1');
     $query->execute(array('username' => $username));
     $row = $query->fetch();
     ##    if($row && password_verify($password, $row['password'])) { ## Usersin php-versio ei tuekaan tätä.. :(
     if ($row && $password == $row['password']) {
         $player = new Player(array('id' => $row['id'], 'name' => $row['name'], 'courseId' => $row['courseid'], 'username' => $row['username'], 'password' => $row['password'], 'admin' => $row['admin'], 'joined' => $row['joined']));
         $player->update();
         return $player;
     } else {
         return null;
     }
 }
开发者ID:neodyymi,项目名称:Tsoha-Bootstrap,代码行数:22,代码来源:player.php


注:本文中的Player::update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。