Ejemplo n.º 1
0
<?php

include_once "../TibiaWebAPI.class.php";
$vip = array("Kamerat", "Pyruvat", "Julegave", "CM Mirade", "Sir Sippo");
$status = array("online" => array(), "offline" => array());
foreach ($vip as $playerName) {
    $player = new Tibia\Player($playerName);
    if ($player->isOnline() === "Online") {
        $status['online'][] = $playerName;
    } else {
        $status['offline'][] = $playerName;
    }
}
?>
<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8">
		<title>Is player online?</title>

		<style>
			.online { color:green; }
			.offline { color:red; }
		</style>
	</head>
	<body>
		<h1>VIP</h1>
		<ul>
		<?php 
foreach ($status['online'] as $name) {
    ?>
Ejemplo n.º 2
0
<?php

include_once "../TibiaWebAPI.class.php";
$player = new Tibia\Player($_GET['name']);
$isOnline = $player->isOnline();
?>
<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8">
		<title>Is player online?</title>

		<style>
			.Online { color:green; }
			.Offline { color:red; }
		</style>
	</head>
	<body>
		<h1>Is <?php 
echo $_GET['name'];
?>
 online?</h1>
		<p class="<?php 
echo $isOnline;
?>
"><?php 
echo $_GET['name'];
?>
 is <?php 
echo $isOnline;
?>