本文整理汇总了PHP中online函数的典型用法代码示例。如果您正苦于以下问题:PHP online函数的具体用法?PHP online怎么用?PHP online使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了online函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: must_be_authorized
function must_be_authorized()
{
global $base_url;
if (!online()) {
header("Location: {$base_url}", true, 302);
print "Location: {$base_url}";
return false;
}
}
示例2: install_tor
function install_tor()
{
# TODO: probably a better way to update, install, and check installed
# TODO: force installed to external SD card?
# Check to see if tor is installed first (don't waste our time otherwise)
if (is_tor_installed()) {
echo 'Tor is already installed!';
return false;
}
# Check to see if we are online to update and download tor
if (online()) {
exec('opkg update') && exec('opkg install tor');
exec('cp /etc/tor/torrc /etc/tor/torrc.bak_' . time());
exec('cp ' . $directory . '/torrc.pineapple /etc/tor/torrc');
exec('/etc/init.d/tor stop');
echo 'Tor has been installed';
return true;
} else {
echo "You must be online to install tor";
return false;
}
}
示例3: order_vols
function order_vols($vols)
{
$online = array();
$offline = array();
foreach ($vols as $vol) {
if (online($vol->status)) {
$online[] = $vol;
} else {
$offline[] = $vol;
}
}
shuffle($online);
return array_merge($online, $offline);
}
示例4: online
} else {
return true;
}
}
function online($server, $port)
{
$socket = fsockopen($server, $port, $errno, $errstr, 1);
if (!$socket) {
return false;
} else {
return true;
}
}
if ($_GET['ajaxsync'] == "get-shoutcast-update" && readCache($cacheTime, $cacheOn)) {
$masterServerData = explode(":", $masterServer);
if ($masterServer && online($masterServerData[0], trim($masterServerData[1]))) {
$masterServerData = explode(",", getSCData($masterServerData[0], trim($masterServerData[1])));
$shoutCast["listeners"] = $masterServerData[0];
if (trim($masterServerData[1]) == 1) {
$shoutCast["status"] = $onAirStatus;
} else {
$shoutCast["status"] = $offAirStatus;
}
$shoutCast["peaklisteners"] = (int) trim($masterServerData[2]);
$shoutCast["maxlisteners"] = (int) trim($masterServerData[3]);
$shoutCast["uniquelisteners"] = (int) trim($masterServerData[4]);
$shoutCast["bitrate"] = (int) trim($masterServerData[5]);
for ($i = 6; $i < count($masterServerData); $i++) {
$shoutCast["song"] .= $masterServerData[$i] . '';
}
$shoutCast["serverscount"] = 1;
示例5: array
<?php
//Not done yet with class display!
$things = array('0' => 'Human Fighter', '1' => 'Warrior', '2' => 'Gladiator', '3' => 'Warlord', '4' => 'Human Knight', '5' => 'Paladin', '6' => 'Dark Avenger', '7' => 'Rogue', '8' => 'Treasure Hunter', '9' => 'Hawkeye', '10' => 'Human Mystic', '11' => 'Human Wizard', '12' => 'Sorcerer', '13' => 'Necromancer', '14' => 'Warlock', '15' => 'Cleric', '16' => 'Bishop', '17' => 'Prophet', '18' => 'Elven Fighter', '19' => 'Elven Knight', '20' => 'Temple Knight', '21' => 'Sword Singer', '22' => 'Elven Scout', '23' => 'Plains Walker', '24' => 'Silver Ranger', '25' => 'Elven Mystic', '26' => 'Elven Wizard', '27' => 'Spellsinger', '28' => 'Elemental Summoner', '29' => 'Elven Oracle', '30' => 'Elven Elder', '31' => 'Dark Fighter', '32' => 'Palus Knight', '33' => 'Shillien Knight', '34' => 'Bladedancer', '35' => 'Assassin', '36' => 'Abyss Walker', '37' => 'Phantom Ranger', '38' => 'Dark Mystic', '39' => 'Dark Wizard', '40' => 'Spellhowler', '41' => 'Phantom Summoner', '42' => 'Shillien Oracle', '43' => 'Shillien Elder', '44' => 'Orc Fighter', '45' => 'Orc Raider', '46' => 'Destroyer', '47' => 'Monk', '48' => 'Tyrant', '49' => 'Orc Mystic', '50' => 'Orc Shaman', '51' => 'Overlord', '52' => 'Warcryer', '53' => 'Dwarf Fighter', '54' => 'Scavenger', '55' => 'Bounty Hunter', '56' => 'Artisan', '57' => 'Warsmith', '88' => 'Duelist', '89' => 'Dreadnought', '90' => 'Phoenix Knight', '91' => 'Hell Knight', '92' => 'Sagittarius', '93' => 'Adventurer', '94' => 'Archmage', '95' => 'Soultaker', '96' => 'Arcana Lord', '97' => 'Cardinal', '98' => 'Hierophant', '99' => 'Evas Templar', '100' => 'Sword Muse', '101' => 'Wind Rider', '102' => 'Moonlight Sentinel', '103' => 'Mystic Muse', '104' => 'Elemental Master', '105' => 'Evas Saint', '106' => 'Shillien Templar', '107' => 'Spectral Dancer', '108' => 'Ghost Hunter', '109' => 'Ghost Sentinel', '110' => 'Storm Screamer', '111' => 'Spectral Master', '112' => 'Shillien Saint', '113' => 'Titan', '114' => 'Grand Khavatari', '115' => 'Dominator', '116' => 'Doom Cryer', '117' => 'Fortune Seeker', '118' => 'Maestro', '119' => 'World Trap', '120' => 'Player Trap', '121' => 'Double Ghost', '122' => 'Siege Attacker', '123' => 'Male Kamael Soldier', '124' => 'Female Kamael Soldier', '125' => 'Trooper', '126' => 'Warder', '127' => 'Berserker', '128' => 'Male Soul Breaker', '129' => 'Female Soul Breaker', '130' => 'Arbalester', '131' => 'Doombringer', '132' => 'Male Soul Hound', '133' => 'Female Soul Hound', '134' => 'Trickster', '135' => 'Inspector', '136' => 'Judicator', '139' => 'Sigel Knight', '140' => 'Tyrr Warrior', '141' => 'Othell Rogue', '142' => 'Yul Archer', '143' => 'Feoh Wizard', '144' => 'Iss Enchanter', '145' => 'Wynn Summoner', '146' => 'Aeore Healer', '148' => 'Sigel Phoenix Knight', '149' => 'Sigel Hell Knight', '150' => 'Sigel Evas Templar', '151' => 'Sigel Shillien Templar', '152' => 'Tyrr Duelist', '153' => 'Tyrr Dreadnought', '154' => 'Tyrr Titan', '155' => 'Tyrr Grand Khavatari', '156' => 'Tyrr Maestro', '157' => 'Tyrr Doombringer', '158' => 'Othell Adventurer', '159' => 'Othell Wind Rider', '160' => 'Othell Ghost Hunter', '161' => 'Othell Fortune Seeker', '162' => 'Yul Sagittarius', '163' => 'Yul Moonlight Sentinel', '164' => 'Yul Ghost Sentinel', '165' => 'Yul Trickster', '166' => 'Feoh Archmage', '167' => 'Feoh Soultaker', '168' => 'Feoh Mystic Muse', '169' => 'Feoh Storm Screamer', '170' => 'Feoh Soulhounds', '171' => 'Iss Hierophant', '172' => 'Iss Sword Muse', '173' => 'Iss Spectral Dancer', '174' => 'Iss Dominator', '175' => 'Iss Doomcryer', '176' => 'Wynn Arcana Lord', '177' => 'Wynn Elemental Master', '178' => 'Wynn Spectral Master', '179' => 'Aeore Cardinal', '180' => 'Aeore Evas Saint', '181' => 'Aeore Shillien Saint', '182' => 'Etheria Fighter', '183' => 'Etheria Wizard', '184' => 'Marauder', '185' => 'Cloud Breaker', '186' => 'Ripper', '187' => 'Stratomancer', '188' => 'Eviscerator', '189' => 'Sayhas Seer');
function online($str)
{
$div = time() - (time() - $str);
$div1 = $div % 86400;
$div2 = $div % 3600;
$dias = floor($div / 86400);
$horas = floor($div1 / 3600);
$minutos = floor($div2 / 60);
return $retotno = "{$dias} Day's {$horas} Hour's {$minutos} Minutes";
}
$PegaPersonagens = $conexao->prepare("SELECT *,(SELECT clan_name FROM clan_data WHERE characters.clanid = clan_id) AS clan FROM characters WHERE account_name = ?");
$PegaPersonagens->execute(array($res_user['login']));
if ($PegaPersonagens->rowCount() <= 0) {
echo "<div id=\"no\">You don't have characters yet!</div>";
}
$a = $PegaPersonagens->fetchAll(PDO::FETCH_ASSOC);
foreach ($a as $res) {
$res['clan'] = empty($res['clan']) ? 'No clan' : $res['clan'];
$res['online'] = $res['online'] == 1 ? 'Yes' : 'No';
$res['nobless'] = $res['nobless'] == 1 ? 'Yes' : 'No';
echo "\r\n\t\t\t<span class='admin'><span class='username'>Profile:</span> {$res['account_name']}</span>\r\n\t\t\t<table class='ranking'>\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<tr><td>Characters in the account:</td><td> {$res['char_name']}</td></tr>\r\n\t\t\t\t\t<tr><td>Level:</td><td> {$res['level']}</td></tr>\r\n\t\t\t\t\t<tr><td>Class:</td><td>" . $things[$res['classid']] . "</td></tr>\r\n\t\t\t\t\t<tr><td>Clan:</td><td> {$res['clan']}</td></tr>\r\n\t\t\t\t\t<tr><td>PvPs:</td><td> {$res['pvpkills']}</td></tr>\r\n\t\t\t\t\t<tr><td>Pks:</td><td> {$res['pkkills']}</td></tr>\r\n\t\t\t\t\t<tr><td>Title:</td><td> {$res['title']}</td></tr>\r\n\t\t\t\t\t<tr><td>Reputation:</td><td> {$res['reputation']}</td></tr>\r\n\t\t\t\t\t<tr><td>Online:</td><td> {$res['online']}</td></tr>\r\n\t\t\t\t\t<tr><td>Online time:</td><td> " . online($res['onlinetime']) . "</td></tr>\r\n\t\t\t\t\t<tr><td>Nobless:</td><td> {$res['nobless']}</td></tr>\r\n\t\t\t\t</tr>\r\n\t\t\t</table>";
}
?>
<?php
}
示例6: avg
}
function avg()
{
$file_count = fopen('count.txt', 'rb');
$data = '';
while (!feof($file_count)) {
$data .= fread($file_count, 4096);
}
fclose($file_count);
@(list($today, $yesterday, $total, $date, $days) = split("%", $data));
echo ceil($total / $days);
}
?>
Đang online: <?php
echo online();
?>
<br>
Truy cập hôm nay: <?php
echo today();
?>
<br>
Truy cập hôm qua: <?php
echo yesterday();
?>
<br>
Tổng số truy cập: <?php
total();
?>
<br>
Truy cập trung bình: <?php
示例7: while
echo " <div class='panel panel-default'>\n <div class='panel-heading'>\n <h4 class='panel-title'>\n <a class='accordion-toggle' data-toggle='collapse' data-parent='#accordion' href='#forsale{$parcelUUID}'>\n<B>{$parcelname}</B>\n </a>\n\t</h4>\n </div>\n <div id='forsale{$parcelUUID}' class='accordion-body collapse'>\n <div class='panel-body'>\n<p>\n<B>Area:</B> {$area}<br>\n<B>Price:</B> V\$ {$saleprice}<br>\n<B>Region:</B> {$regionname}<br>\n<a href=''>Teleport</a>\n</p>\n </div>\n </div>\n </div>\n";
}
$forsaleq->free();
}
if ($type == "people" || !$type) {
$pplq = $mysqli->query("SELECT * FROM {$osmain}.useraccounts WHERE FirstName LIKE '%{$search}%' OR LastName LIKE '%{$search}%' ORDER BY `Created` ASC LIMIT 0,100");
while ($pplnum = $pplq->fetch_array(MYSQLI_BOTH)) {
$uuid = $pplnum['PrincipalID'];
$sFirst = $pplnum['FirstName'];
$sLast = $pplnum['LastName'];
if ($sLast == "Resident") {
$profname = $sFirst;
} else {
$profname = $sFirst . "." . $sLast;
}
$online = online($uuid);
if ($online == "False") {
$onoff = "offlinedot.png";
} else {
if ($online == "True") {
$onoff = "onlinedot.png";
}
}
$profq = $mysqli->query("SELECT * FROM {$osmod}.userprofile WHERE useruuid = '{$uuid}' AND profileMaturePublish < '{$m}'");
$prow = $profq->fetch_array(MYSQLI_BOTH);
$show = $prow['profileAllowPublish'];
if ($show == "0") {
$MaturePublish = $prow['profileMaturePublish'];
$abouttext = $prow['profileAboutText'];
$fakepic = $prow['profileImage'];
$profq->free();
示例8: im_qq
echo im_qq($qq);
echo im_ali($ali);
echo im_msn($msn);
echo im_skype($skype);
?>
</td>
<td class="tl">会员名</td>
<td> <a href="<?php
echo $linkurl;
?>
" target="_blank"><?php
echo $username;
?>
</a>
[<?php
$ol = online($userid);
if ($ol == 1) {
?>
<span class="f_red">在线</span><?php
} else {
if ($ol == -1) {
?>
<span class="f_blue">隐身</span><?php
} else {
?>
<span class="f_gray">离线</span><?php
}
}
?>
]
</td>
示例9: online_users
break;
break;
case 'online_users':
$out = online_users(session::USER_REGULAR);
break;
default:
setStatus($out, 'fail', 'invalid type.');
break;
}
} else {
//get request
if (isset($_GET['query'])) {
$type = $_GET['query'];
switch ($type) {
case 'online':
$out = online();
break;
case 'online_doctors':
$out = online_users(session::USER_DOCTOR);
break;
case 'online_users':
$out = online_users(session::USER_REGULAR);
break;
case 'getHistory':
$out = getHistory();
break;
case 'getUpdates':
$out = getUpdates();
break;
default:
setStatus($out, 'fail', 'invalid type.');
示例10: skype_script
skype_script();
echo show_info($vol);
if (false) {
$status = skype_status($vol->skypeid);
if ($status != $vol->status) {
$vol->status = $status;
$vol->last_check = time();
if (online($vol->status)) {
$vol->last_online = time();
}
vol_update_status($vol);
}
$image = button_image($status);
echo "\n <script type=\"text/javascript\" src=\"http://download.skype.com/share/skypebuttons/js/skypeCheck.js\"></script>\n <img src=images/help/{$image}><p>\n ";
echo "<table class=box cellpadding=8 width=100%><tr><td width=40%>";
if (online($status)) {
live_contact($vol);
}
}
skype_call_button($vol);
email_contact($vol);
echo "</td></tr></table><p>\n";
echo "<table class=box cellpadding=8 width=100%><tr><td>";
$rating = rating_vol_auth($vol->id, $uid);
if (!$rating) {
$rating = new StdClass();
$rating->rating = -1;
$rating->comment = "";
}
show_rating($vol, $rating);
echo "</td></tr></table>\n";
示例11: while
$db->query("UPDATE {$DT_PRE}member SET chat={$chats} WHERE userid={$_userid}");
}
}
//发起的对话
$result = $db->query("SELECT * FROM {$table} WHERE fromuser='{$chatuser}' ORDER BY fgettime DESC LIMIT 50");
while ($r = $db->fetch_array($result)) {
if ($DT_TIME - $r['treadtime'] > $MOD['chat_poll'] * 3) {
$r['line'] = '<span class="f_gray"></span>';
//等待中
} else {
$r['line'] = '<span class="f_blue">对话中</span>';
}
$r['gettime'] = $r['fgettime'] ? timetodate($r['fgettime'], 5) : '';
$m = userinfo($r['touser']);
$r['linkurl'] = $m['linkurl'];
$r['online'] = online($m['userid']);
$r['from'] = $m['company'];
$r['truename'] = $m['truename'];
$F[] = $r;
}
$head_title = '在线对话';
$type = 3;
}
}
if ($type < 3) {
$faces = array();
$face = glob('face/*.gif');
if ($face) {
foreach ($face as $k => $v) {
$faces[$k] = basename($v, '.gif');
}
示例12: themeheader
}
themeheader();
global $cpgtpl, $ownpagetitle, $home;
$adminmenuitems = $admincssmenuitems = false;
if (!$home) {
if (defined('ADMIN_PAGES') && is_admin() && !(isset($_GET['op']) && $_GET['op'] == 'logout')) {
require_once 'includes/classes/cpg_adminmenu.php';
$adminmenuitems = $CLASS['adminmenu']->display('all', 'jsmenu');
$admincssmenuitems = $MAIN_CFG['global']['admingraphic'] & 4;
}
}
$cpgtpl->assign_vars(array('BASEHREF' => $BASEHREF, 'I18N' => 'enctype="multipart/form-data" accept-charset="utf-8"', 'IMPORTANT_MESSAGE' => $message, 'PAGE_TITLE' => $home || isset($ownpagetitle[$module_name]) ? '' : $pagetitle, 'S_TEXTDIR' => _TEXT_DIR, 'S_LANGCODE' => _BROWSER_LANGCODE, 'S_HEADER_TAGS' => $header, 'S_LEFTBLOCKS' => $Blocks->showblocks & 1, 'S_RIGHTBLOCKS' => $Blocks->showblocks & 2, 'S_SITENAME' => $sitename, 'S_PAGETITLE' => !empty($pagetitle) ? strip_tags($pagetitle) : '', 'S_DELIM' => _BC_DELIM, 'S_FILESERVER' => '', 'S_ADMIN_MENU' => $adminmenuitems, 'S_ADMIN_CSSMENU' => $admincssmenuitems, 'B_PAGETITLE' => 1 < strlen(strip_tags($pagetitle)), 'B_NEWSRSS' => is_active('News')));
unset($modheader);
}
if (empty($_SESSION['SECURITY']['banned'])) {
online();
}
global $home, $cpgtpl, $Blocks;
$Blocks->init();
head();
if (!defined('ADMIN_PAGES')) {
require_once 'includes/counter.php';
# 2-3 queries
if ($home) {
require_once 'includes/functions/messagebox.php';
message_box();
}
}
$Blocks->display('c');
$cpgtpl->set_filenames(array('cpgheader' => 'header.html'));
$cpgtpl->display('cpgheader');
示例13: anna_nyk_viikonp_suomeksi
require_once 'yhteiset/php_yhteiset.php';
require_once 'yhteiset/Parametrit.php';
require_once 'yhteiset/Palaute.php';
$kirjautumistieto = '';
if (isset($_SESSION['tiedot'])) {
$kirjautumistieto = "Kirjautunut: " . $_SESSION['tiedot']->etunimi;
}
$aika = anna_nyk_viikonp_suomeksi() . " " . date("d.m.Y");
$aikailmoitus = "Tänään on {$aika}";
// Yhdistetään tietokantaan:
$tietokantaolio = new Tietokantaolio($dbtyyppi, $dbhost, $dbuser, $dbsalis);
$tietokantaolio->yhdista_tietokantaan($dbnimi);
$omaid = $_SESSION['tiedot']->id;
// Tarkistetaan, ettei käyttäjää ole potkaistu ulos (sessiotiedot
// voivat olla vanhentuneita tai kopioituja):
if (!online($omaid, $tietokantaolio)) {
$kansiotaso = 1;
toteuta_kirjaudu_ulos($tietokantaolio, $dbnimi, $kansiotaso);
exit;
}
// Verkkosivujen hallitsijan totuusarvo:
$omat_valtuudet = $_SESSION['tiedot']->valtuudet;
$kuningas = on_kuningas_pika($omat_valtuudet);
// Luodaan parametri- ja palautusolio:
$kokoelmanimi = "";
// Tämä koskee kuvia. Ei tarvinne täällä, ellei
// tulevaisuudessa haluta kuvia laittaa.
$parametriolio = new Parametrit($kokoelmanimi, $omaid, $tietokantaolio);
$palauteolio = new Palaute();
// Lisätään ihmisen tiedot:
$etun = $parametriolio->etun;
示例14: if
} else { // only a is online - it comes first
return -1;
}
} else if ( $b['online'] ) { //only b is online - comes first
return 1;
} else {// both offline - the one that was most recently on comes first
return strtotime($b['time']) - strtotime($a['time']);
}
}
function getusers()
{
$tmp = $GLOBALS['users'];
uasort($tmp, 'cmp');
return $tmp;
}
// PARSE THE LOG
foreach ($logs as $l)
{
if (preg_match("/([0-9-]+ [0-9:]+) \[INFO\] \<([a-zA-Z0-9-_]+)\> (.*)/i", $l, $m))
online($m[2], $m[1]);
else if (preg_match("/([0-9-]+ [0-9:]+) \[INFO\] ([a-zA-Z0-9-_]+) \[.*logged in with entity/i", $l, $m))
online($m[2], $m[1]);
else if (preg_match("/([0-9-]+ [0-9:]+) \[INFO\] ([a-zA-Z0-9-_]+) lost connection/i", $l, $m))
offline($m[2], $m[1]);
else if (preg_match("/Stopping server/i", $l, $m))
server_quit();
}
示例15: db_select
$q = db_select("select distinct(brugernavn) from online where brugernavn != '" . db_escape_string($brugernavn) . "' and db = '{$db}' and session_id != '{$s_id}' and logtime > '{$udlob}'", __FILE__ . " linje " . __LINE__);
while ($r = db_fetch_array($q)) {
$x++;
$aktiv[$x] = $r['brugernavn'];
}
$y = $x + 1;
# if ($y > $bruger_max) {
# $headers = 'From: saldi@saldi.dk'."\r\n".'Reply-To: saldi@saldi.dk'."\r\n".'X-Mailer: PHP/' . phpversion();
# mail("saldi@saldi.dk", "Brugerantal ($x) overskredet for $regnskab / $db", "$brugernavn logget ind som bruger nr $y.", "$headers");
# print "<BODY onLoad=\"javascript:alert('Max antal samtidige brugere ($x) er overskredet.')\">";
# }
$q = db_select("select * from online where brugernavn = '" . db_escape_string($brugernavn) . "' and db = '{$db}' and session_id != '{$s_id}'", __FILE__ . " linje " . __LINE__);
if ($r = db_fetch_array($q)) {
$last_time = $r['logtime'];
if (!$fortsaet && $unixtime - $last_time < 3600) {
online($regnskab, $brugernavn, $password, $timestamp, $s_id);
exit;
} elseif (!$fortsaet) {
$tmp = date("d-m-y", $last_time) . " kl. " . date("H:i", $last_time);
print "<BODY onLoad=\"javascript:alert('Velkommen {$brugernavn}. Du har ikke logget korrekt af da du sidst var online d. {$tmp}')\">";
db_modify("delete from online where brugernavn = '" . db_escape_string($brugernavn) . "' and db = '{$db}' and session_id != '{$s_id}'", __FILE__ . " linje " . __LINE__);
}
}
}
db_modify("delete from online where session_id = '{$s_id}'", __FILE__ . " linje " . __LINE__);
if ($db && !file_exists("../temp/.ht_{$db}.log")) {
$fp = fopen("../temp/.ht_{$db}.log", "a");
fwrite($fp, "-- " . $brugernavn . " " . date("Y-m-d H:i:s") . ": " . $spor . "\n");
fwrite($fp, "\\connect {$db};\n");
fclose($fp);
}