本文整理汇总了PHP中is_connected函数的典型用法代码示例。如果您正苦于以下问题:PHP is_connected函数的具体用法?PHP is_connected怎么用?PHP is_connected使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_connected函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_exchange_rates
public function get_exchange_rates()
{
// \Cache::forget('money_exchange_rates');
if (\Cache::has('money_exchange_rates')) {
$data = \Cache::get('money_exchange_rates');
} elseif (is_connected("openexchangerates.org")) {
$api_key = "bbc128aa6f3645d78b098f0eef3dd533";
$json = file_get_contents("http://openexchangerates.org/api/latest.json?app_id={$api_key}");
$json = json_decode($json, true);
$data['rates'] = $json['rates'];
$data['base'] = $json['base'];
// $data['json_rates'] = json_encode($json['rates']);
\Cache::add('money_exchange_rates', $data, 360);
\Cache::add('money_exchange_rates_default', $data, 50000);
} else {
$data = \Cache::get('money_exchange_rates_default');
}
$currency_list = \Lst::common('currency1');
$arr["site_name"] = "Ahmed-Badawy.com";
$arr["base"] = $data['base'];
foreach ($currency_list as $key => $val) {
$n = ['short' => $key, "name" => $val, "value" => $data['rates'][$key]];
$arr['rates'][$key] = $n;
}
return $arr;
}
示例2: printNews
function printNews($side)
{
$pos = zp_filter_slot('admin_overview', 'comment_form_print10Most') !== false;
if ($pos && $side == 'left' || !$pos && $side == 'right') {
if ($connected = is_connected()) {
require_once dirname(__FILE__) . '/zenphoto_news/rsslib.php';
}
?>
<div class="box" id="overview-news">
<h2 class="h2_bordered"><?php
echo gettext("News from Zenphoto.org");
?>
</h2>
<?php
if ($connected) {
echo RSS_Display("http://www.zenphoto.org/index.php?rss-news&withimages", 5);
} else {
?>
<ul>
<li><?php
echo gettext('A connection to <em>Zenphoto.org</em> could not be established.');
?>
</li>
</ul>
<?php
}
?>
</div>
<?php
}
return $side;
}
示例3: index
public function index()
{
$data = array();
$data['title'] = $this->lang->line('home');
$this->load->model('message_model');
if (!is_connected()) {
$language = $this->config->item('language');
} else {
$language = $this->session->userdata['user']->language;
}
$data['home_message'] = $this->message_model->get_message('home-message');
if ($data['home_message'] !== '') {
$data['home_message'] = $data['home_message'][0]->{$language . '_content'};
}
$data['home_message'] = html_entity_decode($data['home_message']);
$data['yesterday_matches'] = matches_of_day(date('d/m/Y', time() - 60 * 60 * 24));
$data['today_matches'] = matches_of_day();
$data['tomorrow_matches'] = matches_of_day(date('d/m/Y', time() + 60 * 60 * 24));
if (!$data['yesterday_matches'] && !$data['today_matches'] && !$data['tomorrow_matches']) {
$data['last_matches'] = last_matches();
$data['next_matches'] = next_matches();
}
$this->load->view('templates/header', $data);
$this->load->view('templates/nav', $data);
$this->load->view('index', $data);
$this->load->view('templates/footer', $data);
}
示例4: pics
function pics($post, $connect)
{
if ($post['bool'] === "false") {
$sql = "SELECT * FROM pics ORDER BY id DESC LIMIT " . intval($post['nbr']) . ", 2";
$result = $connect->query($sql);
$fetch1['data'] = $result->fetchAll(PDO::FETCH_ASSOC);
foreach ($fetch1['data'] as $key => $value) {
$sql = "SELECT COUNT(*) AS 'count' FROM likes WHERE pic='" . $value['id'] . "'";
$result = $connect->query($sql);
$fetch2 = $result->fetch(PDO::FETCH_ASSOC);
$fetch1['data'][$key]['likes'] = $fetch2['count'];
if (is_connected()) {
$sql = "SELECT * FROM likes WHERE pic='" . intval($value['id']) . "' AND user='" . htmlspecialchars($_SESSION['user']) . "'";
$result = $connect->query($sql);
if ($result->fetch()) {
$fetch1['data'][$key]['islike'] = 1;
} else {
$fetch1['data'][$key]['islike'] = 0;
}
}
$sql = "SELECT user, comment FROM comments WHERE pic='" . $value['id'] . "' ORDER BY id ASC";
$result = $connect->query($sql);
$fetch3 = $result->fetchAll(PDO::FETCH_ASSOC);
$fetch1['data'][$key]['comments'] = $fetch3;
}
$fetch1['end'] = true;
$res = json_encode($fetch1);
return $res;
} else {
$sql = "SELECT * FROM pics WHERE id='" . intval($post['nbr']) . "'";
$result = $connect->query($sql);
if ($result->rowCount() > 0) {
$fetch1 = $result->fetch(PDO::FETCH_ASSOC);
$sql = "SELECT COUNT(*) AS 'count' FROM likes WHERE pic='" . intval($fetch1['id']) . "'";
$result = $connect->query($sql);
$fetch2 = $result->fetch(PDO::FETCH_ASSOC);
$fetch1['likes'] = $fetch2['count'];
if (is_connected()) {
$sql = "SELECT * FROM likes WHERE pic='" . intval($fetch1['id']) . "' AND user='" . htmlspecialchars($_SESSION['user']) . "'";
$result = $connect->query($sql);
if ($result->fetch()) {
$fetch1['islike'] = 1;
} else {
$fetch1['islike'] = 0;
}
}
$sql = "SELECT user, comment FROM comments WHERE pic='" . intval($fetch1['id']) . "' ORDER BY id ASC";
$result = $connect->query($sql);
$fetch3 = $result->fetchAll(PDO::FETCH_ASSOC);
$fetch1['comments'] = $fetch3;
$fetch1['end'] = true;
$res = json_encode($fetch1);
return $res;
} else {
$res['end'] = false;
$res['info'] = "Cette photo n'existe pas.";
return json_encode($res);
}
}
}
示例5: __construct
public function __construct()
{
parent::__construct();
if (!is_connected()) {
$this->lang->load('12parfait', $this->config->item('language'));
} else {
$this->lang->load('12parfait', $this->session->userdata['user']->language);
}
}
示例6: __construct
public function __construct()
{
$this->load->helper('memberspace/connection');
if (!is_connected()) {
die(translate('Vous ne pouvez pas accéder à vos fichiers si vous n\'êtes pas connecté.'));
}
parent::__construct();
$this->load->library('layout/layout');
$this->load->helper('memberspace/authorization');
$this->load->helper('images/image');
$this->load->database();
}
示例7: __construct
public function __construct()
{
parent::__construct();
// Authentification de l'utilisateur
if (!is_connected()) {
// Redirige l'utilisateur vers la page de connexion s'il n'est pas authentifié
$this->lang->load('12parfait', $this->config->item('language'));
redirect(site_url(), 'location');
} else {
$this->lang->load('12parfait', $this->session->userdata['user']->language);
}
// on n'active le profiler qu'en dev
if (ENVIRONMENT === 'development') {
// $this->output->enable_profiler(true);
}
}
示例8: checkForUpdate
/**
* Searches the zenphoto.org home page for the current zenphoto download
* locates the version number of the download and compares it to the version
* we are running.
*
* @return string If there is a more current version on the WEB, returns its version number otherwise returns FALSE
* @since 1.1.3
*/
function checkForUpdate()
{
$webVersion = false;
if (is_connected() && class_exists('DOMDocument')) {
require_once dirname(__FILE__) . '/zenphoto_news/rsslib.php';
$recents = RSS_Retrieve("http://www.zenphoto.org/index.php?rss=news&category=changelog");
if ($recents) {
array_shift($recents);
$article = array_shift($recents);
// most recent changelog article
$v = trim(str_replace('zenphoto-', '', basename($article['link'])));
$c = explode('-', ZENPHOTO_VERSION);
$c = array_shift($c);
if ($v && version_compare($c, $v, "<")) {
$webVersion = $v;
}
}
}
return $webVersion;
}
示例9: mailInfo
function mailInfo()
{
if (is_connected()) {
$CI = get_instance();
// You may need to load the model if it hasn't been pre-loaded
$CI->load->model('account/mailbox_model');
// Call a function of the model
//$CI->mailbox->do_something();
$mailbox_settings = $CI->mailbox_model->get();
if (!empty($mailbox_settings)) {
$address = "{" . $mailbox_settings->mail_server . "}" . $mailbox_settings->mailbox;
$email = $mailbox_settings->email;
$password = $mailbox_settings->password;
if ($inbox = imap_open($address, $email, $password, OP_READONLY)) {
// Get general mailbox information.
$info = imap_status($inbox, $address, SA_ALL);
$mailInfo = array('unread' => $info->unseen, 'recent' => $info->recent, 'total' => $info->messages);
return $mailInfo;
}
}
}
}
示例10: restore
function restore($pdo)
{
if (isset($_GET['type'], $_GET['file']) && !empty($_GET['type']) && !empty($_GET['file'])) {
$type = $_GET['type'];
$file = trim($_GET['file']);
$internet = false;
if ($type == 'cloud') {
if (is_connected()) {
$internet = true;
$drop_sql = dropboxDBfiles();
if (in_array($file, $drop_sql)) {
if (dropboxRestore($file)) {
import_to_db('dbbackup' . DS . 'dropbox' . DS . $file);
}
}
}
} else {
if ($type == 'local') {
if (file_exists('dbbackup' . DS . $file)) {
import_to_db('dbbackup' . DS . $file);
}
}
}
}
redirect(BASE_PATH . '/backup/?token=' . $_SESSION['token'], 1);
}
示例11: gettext
<?php
$button_text = gettext("Check for update");
$button_action = WEBPATH . '/' . ZENFOLDER . '/admin.php?action=check_for_update';
$button_icon = 'images/accept.png';
$button_title = gettext("Queries the Zenphoto web site for the latest version and compares that with the one that is running.");
$button_alt = gettext('Check for update');
$button_hidden = '<input type="hidden" name="action" value="check_for_update" />';
$button_rights = ADMIN_RIGHTS;
$button_enable = is_connected();
示例12: is_connected
//make sure this is set to what you want vlans to start with, e.g. vlan3309
if (!isset($_POST) || $_POST != '') {
?>
<html>
<body style="background-color: e0e7f7";>
<form action="fast_config.php" method="POST"/>
<table border="0">
<tr><td style="border-left: dashed 1px; border-top: dashed 1px;">VLAN:</td><td style="border-right: dashed 1px; border-top: dashed 1px;"><input type="text" name="vlan"/></td></tr>
<tr><td style="border-left: dashed 1px; border-bottom: dashed 1px;">Interface: </td><td style="border-right: dashed 1px; border-bottom: dashed 1px;"><input type="text" name="interface"/></td></tr>
<tr><td>Subnet:</td><td><input type="text" name="subnet"/></td><td><input value="Apply" type="submit"/></td>
</table>
<?php
}
if (isset($_POST['subnet']) && $_POST['subnet'] != '') {
do {
is_connected();
} while (is_connected() != '1');
if ($_POST['vlan'] != '') {
make_vlan($_POST['vlan'], $_POST['interface']);
}
set_addr($_POST['subnet'], $_POST['vlan']);
}
function is_connected()
{
$connected = @fsockopen("192.168.88.1", "80");
//website and port
if ($connected) {
$is_conn = true;
//action when connected
fclose($connected);
} else {
示例13: second_connected
function second_connected()
{
for ($i = 5; $i > 0; $i--) {
if (is_connected(1) != '1') {
if ($i == 1) {
logthis('no more mikrotiks. killing myself. ');
sleep(4);
} else {
logthis('dying in : ' . ($i - 1) . ' cycles');
}
} else {
return 1;
}
}
header('Location: ' . $GLOBALS['finished_location'] . '');
exit;
}
示例14: sendMailAutomatically
function sendMailAutomatically()
{
$currentDate = date("Y/m/d");
$dueDate = date('Y-m-d', strtotime($currentDate . ' + 1 days'));
$conn = mysqli_connect('localhost', 'root', 'phenol69', 'LibraryNotifier');
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "select *from book where DueDate='" . $dueDate . "'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
$sId = array();
$bName = array();
while ($row = $result->fetch_assoc()) {
$sId[] = $row["StudentId"];
$bName[] = $row['BookName'];
}
$mailNumber = count($sId);
foreach ($sId as $value) {
$queryStudent = "select *from student WHERE Rollno = '" . $value . "'";
$result1 = $conn->query($queryStudent);
while ($row1 = $result1->fetch_assoc()) {
$emailId[] = $row1["Email"];
}
}
//
require_once '../CommonPage/initializer.php';
$connection = is_connected();
if ($connection == true) {
require_once '../control/phpMailer/class.phpmailer.php';
require_once "../control/phpMailer/class.smtp.php";
require '../control/phpMailer/PHPMailerAutoload.php';
$mailer = new PHPMailer();
$mailer->IsSMTP();
$mailer->SMTPSecure = 'tls';
$mailer->Host = 'smtp.gmail.com';
$mailer->Port = 587;
$mailer->Username = 'sachin.aryal@deerwalk.edu.np';
$mailer->Password = 'majuwasachin69';
$mailer->SMTPAuth = true;
$mailer->From = 'sachin.aryal@deerwalk.edu.np';
$mailer->FromName = 'Library';
$mailer->Subject = 'Book Due Date Tomorrow';
for ($i = 0; $i < $mailNumber; $i++) {
$studentMail = $emailId[$i];
$bookName = $bName[$i];
$mailer->Body = 'Hello You have to return ' . $bookName . " Tomorrow";
$mailer->ClearAddresses();
$mailer->AddAddress($studentMail);
$mailCount = 1;
if ($mailer->Send()) {
$sql = "UPDATE mailservice SET EmailCount = {$mailCount} WHERE id = 1";
$conn->query($sql);
$mailCount++;
}
}
} else {
redirect_to('admin.php');
}
} else {
}
}
示例15: substr
$base = substr($clone, strlen($base));
$link = $base . '/' . ZENFOLDER . '/admin.php';
$source = '<a href="' . $link . '">' . $clone . '</a>';
} else {
$source = $clone;
}
$source = '<br /> ' . sprintf(gettext('source: %s'), $source);
}
$graphics_lib = zp_graphicsLibInfo();
?>
<li>
<?php
printf(gettext('Zenphoto version <strong>%1$s [%2$s] (%3$s)</strong>'), ZENPHOTO_VERSION, '<a title="' . ZENPHOTO_FULL_RELEASE . '">' . ZENPHOTO_RELEASE . '</a>', $official);
echo $source;
if (extensionEnabled('check_for_update') && TEST_RELEASE) {
if (is_connected() && class_exists('DOMDocument')) {
require_once SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/zenphoto_news/rsslib.php';
$recents = RSS_Retrieve("http://www.zenphoto.org/index.php?rss=news&category=changelog");
if ($recents) {
array_shift($recents);
$article = array_shift($recents);
// most recent changelog article
$v = trim(str_replace('zenphoto-', '', basename($article['link'])));
$c = explode('-', ZENPHOTO_VERSION);
$c = array_shift($c);
if ($v && version_compare($c, $v, '>')) {
?>
<p class="notebox">
<a href="http://www.zenphoto.org/news/zenphoto-<?php
echo $c;
?>