示例#1
0
function _getPasscode($refcode)
{
    $initDB = new hnSQL(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME, false);
    $query = $initDB->query("SELECT * FROM ilink WHERE refcode='{$refcode}'");
    $row = $initDB->fetch_array($query);
    if ($row) {
        return $row['passcode'];
    } else {
        return '';
    }
    $initDB->close();
}
示例#2
0
文件: check.php 项目: heiswayi/ilink
<?php

require_once 'db_config.php';
require_once 'database.class.php';
$db = new hnSQL(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME, false);
if (isset($_GET['id'])) {
    $sharerLinkID = $_GET['id'];
    $db->query("SELECT * FROM ilink WHERE id='{$sharerLinkID}'");
    if ($sls = $db->fetch_array()) {
        $url = $sls['linkaddr'];
        $removehttp = str_replace('http://', '', $url);
        $removeslash = rtrim($removehttp, '/');
        if (strpos($removeslash, ':') !== false) {
            list($ip, $port) = explode(":", $removeslash);
        } else {
            $ip = $removeslash;
            $port = 80;
        }
    }
    if (fsockopen($ip, $port, $errno, $errstr, 5) !== false) {
        echo '1';
    } else {
        echo '0';
    }
}
$db->close();
示例#3
0
文件: links.php 项目: heiswayi/ilink
$db2 = new hnSQL(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME, false);
$querydb2 = $db2->query("SELECT * FROM ilink ORDER BY id");
while ($row2 = $db2->fetch_assoc($querydb2)) {
    $linkID2 = $row2['id'];
    echo '
  <script>
  $(document).ready(function () {

  checkStatus' . $linkID2 . '(' . $linkID2 . ');
  setInterval(function(){checkStatus' . $linkID2 . '(' . $linkID2 . ');}, 900000);
  
  });

  function checkStatus' . $linkID2 . '(sharerID) {
    $("#indicator-' . $linkID2 . '").html("<span class=\\"label label-warning\\">Checking</span>");
    $.ajax({
      type: "GET", url: "check.php?id=" + sharerID + "&i=" + Math.random(),
      success: function(data){
        if (data == 1) {
          $("#indicator-' . $linkID2 . '").html("<span class=\\"label label-success\\">Online</span>");
        } else {
          $("#indicator-' . $linkID2 . '").html("<span class=\\"label label-danger\\">Offline</span>");
        }
      }
    });
  }
  </script>
  ';
}
$db2->close();