コード例 #1
0
ファイル: battle.php プロジェクト: ng2k12/MercenaryInc
function displayBountyAttack($user)
{
    $bounties = Bounty::getBountiesForUser($user->getID());
    $numBounties = count($bounties);
    if ($numBounties <= 0) {
        print "There are currently no bounties. Sorry!";
    } else {
        foreach ($bounties as $bounty) {
            $id = $bounty->getTargetID();
            //is this safe..
            $userName = $bounty->name;
            $bountyAmount = $bounty->getPayment();
            ?>
			
			Mercenary: <a href='<?php 
            $_SERVER['DOCUMENT_ROOT'];
            ?>
/externalplayerprofile.php?userID=<?php 
            echo $id;
            ?>
'><?php 
            echo $userName;
            ?>
</a> Bounty: <?php 
            echo $bountyAmount;
            ?>
			<!-- Implement the attacking button and functionality -->
			<form action="<?php 
            $_SERVER['DOCUMENT_ROOT'];
            ?>
/backend/attackplayer.php" method="POST">
			<input type='hidden' name='userID' value='<?php 
            echo $id;
            ?>
' />
			<input type='submit' value='Attack'/>
			</form>
			<?php 
        }
    }
}
コード例 #2
0
ファイル: battle.php プロジェクト: ng2k12/MercInc
function displayBountyAttack($user, $serverRoot)
{
    $bounties = Bounty::getBountiesForUser($user->getID());
    $numBounties = count($bounties);
    $enemy_html = '';
    if ($numBounties > 0) {
        $enemy_html = '<div id="two">
		<table class="pvp hitlist">
		<tr>
			<th>Opponent</th>
			<th class="armysize">Bounty</th>
			<th></th>
		</tr>';
        foreach ($bounties as $bounty) {
            $id = $bounty->getTargetID();
            //is this safe..
            $userName = $bounty->name;
            $bountyAmount = $bounty->bounty;
            if ($user->checkSameUsersInAgency($_SESSION['userID'], $id) == false && $_SESSION['userID'] != $id) {
                $enemy_html .= '<tr>
                <td class="oppname">
                    <h5><a  onclick="playSound(' . SOUND_CLICK . ')"  href="' . $serverRoot . 'externalplayerprofile.php?userID=' . $id . '">' . $userName . '</a></h5>
					<p>LVL ' . $bounty->level . ' ' . getPlayerTypeFromTypeID($bounty->type) . '</p>

			    </td>
                <td class="oppsize"><p>$' . $bountyAmount . '</p></td>
                <td class="oppattack"><a  href="javascript:" onclick="playAndRedirect(\'\',\'' . $serverRoot . 'backend/attackplayer.php?userID=' . $id . '&attack_type=bounty&bountyAmount=' . $bountyAmount . '\')" class="blackbutton">Attack</a></td>
            </tr>';
            }
            //$_SESSION['bountyAmount'] = $bountyAmount;
        }
        $enemy_html .= '</table></div>';
    }
    echo $enemy_html;
}