Example #1
0
 function s2map($file)
 {
     global $config;
     $this->sql = db_init($config['sql']);
     $this->hash = md5_file($file);
     $this->file = $file;
 }
Example #2
0
function send_msg($sender, $message)
{
    if (!empty($sender) && !empty($message)) {
        $sender = mysql_real_escape_string($sender);
        $mesage = mysql_real_escape_string($message);
        $flag = 0;
        $db = db_init();
        $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
        // setting error mode for pdo
        $query = $db->prepare("INSERT INTO `chat2`.`chat` VALUES (null, :sender, :message )");
        $query->bindValue(':sender', $sender, PDO::PARAM_STR);
        $query->bindValue(':message', $message, PDO::PARAM_STR);
        try {
            // implementing try catch and handling exception
            $query->execute();
            $flag = 1;
        } catch (PDOException $e) {
            die($e->getMessage());
        }
        if ($flag == 1) {
            return true;
        } else {
            echo "not inserted";
            return false;
        }
    } else {
        return false;
    }
}
Example #3
0
function cs_price($itemName)
{
    $col = db_init('market_730', 'item_prices');
    //old query that worked: array( array( '$match' => array( 'name' =>$itemName ) ), array( '$group' => array( '_id'=>null,  'avgPrice' => array( '$avg'=> '$price' ) ) ) );
    $count = $col->count(array("name" => "{$itemName}"));
    if ($count == 0) {
        //$res = json_decode( get_data( 'http://steamcommunity.com/market/priceoverview/?appid=730&market_hash_name=' . urlencode( $itemName ) ), true );
        //if(isset($res['success'] ) && $res['success'] == true && (isset($res['lowest_price']) || isset($res['median_price']) ) ){
        // if (isset($res['median_price']))
        //  return substr($res['median_price'], 1);
        // if (isset($res['lowest_price']))
        //  return substr($res['lowest_price'], 1);
        //}
        return -1;
    }
    $item = $col->find(array("name" => "{$itemName}"))->sort(array("price" => 1))->skip($count / 2 - 1)->limit(1);
    $a = iterator_to_array($item);
    foreach ($a as $a) {
        return $a['price'];
    }
    //$query = array( 'name' =>$itemName );
    //$price = $col -> find( $query );
    //if ( isset( $price['result'][0]['avgPrice'] ) )
    //  $avgPrice = $price['result'][0]['avgPrice'];
    //else $avgPrice = 0;
    //return $avgPrice;
}
Example #4
0
function show_graph()
{
    require_once "../inc/db.inc";
    db_init();
    $xaxis = $_GET['xaxis'];
    $yaxis = $_GET['yaxis'];
    $granularity = $_GET['granularity'];
    $active = $_GET['active'];
    $inactive = $_GET['inactive'];
    $show_text = $_GET['show_text'];
    if (!$active && !$inactive) {
        echo "You must select at least one of (active, inactive)";
        exit;
    }
    $fields = 'host.id, user.create_time';
    if ($xaxis == 'active' || !$active || !$inactive) {
        $query = "select {$fields}, max(rpc_time) as max_rpc_time from host, user where host.userid=user.id group by userid";
    } else {
        $query = 'select $fields from user';
    }
    $result = mysql_query($query);
    $yarr = array();
    $now = time();
    $maxind = 0;
    $active_thresh = time() - 30 * 86400;
    while ($user = mysql_fetch_object($result)) {
        $val = $now - $user->max_rpc_time;
        if (!$active) {
            if ($user->max_rpc_time > $active_thresh) {
                continue;
            }
        }
        if (!$inactive) {
            if ($user->max_rpc_time < $active_thresh) {
                continue;
            }
        }
        $life = $user->max_rpc_time - $user->create_time;
        $ind = $life / $granularity;
        $ind = (int) $ind;
        $yarr[$ind]++;
        if ($ind > $maxind) {
            $maxind = $ind;
        }
    }
    $xarr = array();
    for ($i = 0; $i <= $maxind; $i++) {
        $xarr[$i] = $i;
        if (is_null($yarr[$i])) {
            $yarr[$i] = 0;
        }
    }
    if ($show_text) {
        show_text($xarr, $yarr);
    } else {
        draw_graph($xarr, $yarr);
    }
}
Example #5
0
/**
	Get username based on user id
	id = user id
**/
function user_name($id)
{
    $CI = db_init();
    $query = "SELECT username FROM flx_user WHERE id='{$id}' LIMIT 1";
    $record = $CI->db->query($query);
    if ($record->num_rows() > 0) {
        return $record->row()->username;
    } else {
        return false;
    }
}
Example #6
0
 function index()
 {
     if (is_installed()) {
         return info_page(__('INSTALL_FINISHED'));
     } elseif (intval(v('do')) == 1) {
         db_init();
     } else {
         $data['title'] = $data['top_title'] = __('INSTALL_PAGE_TITLE');
         return render($data, 'web', 'fullwidth');
     }
 }
Example #7
0
 function index()
 {
     if (is_installed()) {
         return info_page('API Server 已初始化完成,<a href="?c=guest">请使用管理账号登入</a>');
     } elseif (intval(v('do')) == 1) {
         db_init();
     } else {
         $data['title'] = $data['top_title'] = 'TeamToy安装页面';
         return render($data, 'web', 'fullwidth');
     }
 }
Example #8
0
function util_initEverything()
{
    // smarty < session_start/end : smarty caches the person's nickname.
    util_defineRootPath();
    util_defineWwwRoot();
    util_requireOtherFiles();
    util_defineConstants();
    db_init();
    session_init();
    mc_init();
    FlashMessage::restoreFromSession();
    SmartyWrap::init();
    DebugInfo::init();
}
Example #9
0
function util_initEverything()
{
    // smarty < session_start/end : smarty caches the person's nickname.
    util_defineRootPath();
    util_defineWwwRoot();
    // At this point the server preferences are loaded (when
    // util_requireOtherFiles() includes serverPreferences.php)
    util_requireOtherFiles();
    util_defineConstants();
    db_init();
    session_init();
    mc_init();
    FlashMessage::restoreFromSession();
    smarty_init();
}
Example #10
0
function bug_submit($bug_type, $bug_text)
{
    if (!is_numeric($bug_type) && $bug_type >= 2 && $bug_type <= 5) {
        echo 'invalid bug type, report not submitted.';
        return 0;
    }
    if (!isset($_SESSION['sid'])) {
        echo 'Not logged in, try again.';
        return 0;
    }
    $bug_text = (string) substr(htmlentities($bug_text), 0, 1000);
    $c = db_init('site_data', 'bugs');
    $c->insert(array('sid' => (int) $_SESSION['sid'], 'bug_type' => (int) $bug_type, 'bug_text' => $bug_text));
    echo '<h3>Report Submitted Successfully.</h3>';
}
Example #11
0
 function s2lbm($file)
 {
     global $config;
     $this->sql = db_init($config['sql']);
     $this->palette = new s2pal("");
     if (is_file($file)) {
         $this->hash = md5_file($file);
         $this->file = $file;
         $f = pathinfo($file);
         switch (strtolower($f['extension'])) {
             case 'lbm':
                 $this->_loadLBM($file);
                 break;
         }
     }
     echo $this->get_error();
 }
Example #12
0
function DISPLAY_show_torrent($torrent)
{
    if (!($link = db_init(true))) {
        break;
    }
    $result = mysqli_query($link, 'SELECT * FROM `users` WHERE `id`=' . mysqli_real_escape_string($link, $torrent['uploader']) . ';');
    $uploader = @mysqli_fetch_all($result, MYSQLI_ASSOC)[0];
    $uploader = is_array($uploader) ? $uploader['username'] : '******';
    mysqli_free_result($result);
    mysqli_close($link);
    unset($link);
    echo '<tr>';
    echo '<td><a href="info.php?id=' . $torrent['id'] . '"><b>' . $torrent['torrentname'] . '</b></a></td>';
    echo '<td><a href="user.php?id=' . $torrent['uploader'] . '"><i>' . $uploader . '</a></i></td>';
    echo '<td>' . getHumanDate(new DateTime($torrent['created']), new DateTime(date('Y-n-d H:i:s', time()))) . '</td>';
    echo '<td>' . getHumanFilesize(getTorrent(unserialize(_CONFIG)['torrents']['dir'] . DIRECTORY_SEPARATOR . $torrent['filename'] . '.torrent')->size()) . '</td>';
    echo '<td>' . $torrent['downloads'] . '</td>';
    echo '<td><font color="green">TBD</font></td>';
    echo '<td><font color="blue">TBD</font></td>';
    echo '</tr>';
}
Example #13
0
function get_100_users()
{
    $c = db_init('archive', 'items_730');
    $OOD = $c->find(array("recent" => array('$lt' => time() - 172800)), array('_id' => 1))->sort(array("recent" => 1))->limit(100);
    //get a list of the most out of date steamids in the database (returns steamids only)
    $sids = '';
    if ($OOD->count() > 100) {
        $is_additive = false;
        foreach ($OOD as $k => $usr) {
            $sids .= ',' . $usr['_id'];
        }
    } else {
        $steamid1 = db_load('start_steamid_730');
        if (empty($steamid1)) {
            $steamid1 = 76561197960287930;
        }
        $sc = 0;
        while ($sc <= 100 && $sc++) {
            $sids .= ',' . ($steamid1 + $sc);
        }
    }
    $playerData = json_decode(get_data('http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=' . AKey() . '&steamids=' . $sids . '&format=json'), true);
    return $playerData['response']['players'];
}
Example #14
0
}
$PlayerCount = intval($con->real_escape_string($_REQUEST["playercount"]));
$TTL = max(min(intval($con->real_escape_string($_REQUEST["ttl"])), $MAX_TTL), 1);
$Rev = $con->real_escape_string($_REQUEST["rev"]);
if (!CheckVersion($Rev)) {
    $con->close();
    die("Invalid revision");
}
$Coderev = $con->real_escape_string($_REQUEST["coderev"]);
$IsDedicated = intval($con->real_escape_string($_REQUEST["dedicated"]));
$OS = $con->real_escape_string($_REQUEST["os"]);
if ($Name === "" || $IP === "" || $Port === "" || $TTL === "" || $PlayerCount === "") {
    error_log("Incorrect parameters " . $Name . " " . $IP . " " . $Port . " " . $TTL . " " . $PlayerCount . " ");
    $con->close();
    die("Incorrect parameters");
}
//Don't allow buggy Linux server versions, Windows server (ICS) is ok
if (($Coderev == "r4179" || $Coderev == "r4185") && $_SERVER['HTTP_USER_AGENT'] != "Mozilla/4.0 (compatible; ICS)") {
    $con->close();
    die("Please download the server update");
}
$Pingable = intval(TestConnection($IP, $Port));
db_init($con);
Remove_Old_Servers($con);
$Expiry = date("Y-m-d H:i:s", time() + $TTL);
$query = "REPLACE INTO Servers (IP, Port, Name, Players, Pingable, Dedicated, OS, Rev, CodeRev, Expiry) VALUES ('{$IP}', {$Port}, '{$Name}', {$PlayerCount}, {$Pingable}, {$IsDedicated}, '{$OS}', '{$Rev}', '{$Coderev}', '{$Expiry}')";
if (!$con->query($query)) {
    error_log("Error adding server: " . mysqli_error($con));
}
$con->close();
die('success');
Example #15
0
<?php

include_once 'remora/settings.php';
include_once 'remora/lib.php';

print_info("Installing Remora Version ".VERSION);

// Establish a db connection
$conn = db_init();

print_info("Installation completed successfully");

?>
Example #16
0
 function parse($args, $page)
 {
     if ($this->done) {
         return '';
     }
     $this->page = $page;
     global $db_h;
     db_init();
     $this->db_h = $db_h;
     $this->form($_SERVER["PHP_SELF"] . '?page=' . rawurlencode($_REQUEST['page']), 0);
     if ($_REQUEST['br_user'] && $_REQUEST['br_datefrom'] && $_REQUEST['br_dateto']) {
         $this->do_bug_report();
     } else {
         $this->do_query_form();
     }
     $this->form_end();
     $this->done = true;
     return $this->outdata;
 }
Example #17
0
function db_test()
{
    echo 'Initialize database connection.';
    db_init();
}
Example #18
0
function delete_results()
{
    db_init();
    $f = fopen('dbc_out.dat', 'r');
    while (1) {
        $x = fgets($f);
        if (!$x) {
            break;
        }
        $n = sscanf($x, "%d", $resid);
        if ($n != 1) {
            echo "bad line: {$x}\n";
            continue;
        }
        $result = lookup_result($resid);
        if (!$result) {
            echo "no result {$resultid}\n";
            continue;
        }
        $wu = lookup_wu($result->workunitid);
        if ($wu) {
            echo "result has WU: {$resid}\n";
            continue;
        }
        echo "deleting {$resid}\n";
        // uncomment the following to actually delete
        die("edit script to enable deletion\n");
        //mysql_query("delete from result where id=$resid");
    }
}
Example #19
0
 private function connect($db_group = 'default')
 {
     $t1 = microtime(true);
     $this->db = db_init($db_group);
     $this->db_group = $db_group;
     $t2 = microtime(true);
     if (self::$show_sql) {
         $time = $this->timer($t1, $t2);
         echo "db group {$db_group} contructed!<br>\r\n", "db connection: {$time}<br>\n";
     }
     if (array_key_exists($db_group . '_slave', get_conf('db_conf'))) {
         $this->db_slave = db_init($db_group . '_slave');
     }
 }
// BOINC is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// BOINC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
//
// This file was modified by contributors of "BOINC Web Tweak" project.
require_once "../inc/util_ops.inc";
db_init();
admin_page_head("Result Failure Summary by Host");
$query_appid = $_GET['appid'];
$query_received_time = time() - $_GET['nsecs'];
$main_query = "\r\nSELECT\r\n\t   app_version_num AS App_Version,\r\n\t   hostid AS Host_ID,\r\n\t   case\r\n\t\t   when INSTR(host.os_name, 'Darwin') then 'Darwin'\r\n\t\t   when INSTR(host.os_name, 'Linux') then 'Linux'\r\n\t\t   when INSTR(host.os_name, 'Windows') then 'Windows'\r\n\t\t   when INSTR(host.os_name, 'SunOS') then 'SunOS'\r\n\t\t   when INSTR(host.os_name, 'Solaris') then 'Solaris'\r\n\t\t   when INSTR(host.os_name, 'Mac') then 'Mac'\r\n\t\t   else 'Unknown'\r\n\t   end AS OS_Name,\r\n\t   case\r\n\t\t   when INSTR(host.os_name, 'Linux') then \r\n\t\t\t   case\r\n\t\t\t\t   when INSTR(LEFT(host.os_version, 6), '-') then LEFT(host.os_version, (INSTR(LEFT(host.os_version, 6), '-') - 1))\r\n\t\t\t\t   else LEFT(host.os_version, 6)\r\n\t\t\t   end\r\n\t\t   else host.os_version\r\n\t   end AS OS_Version,\r\n\t   host.nresults_today AS Results_Today, \r\n\t   COUNT(*) AS error_count\r\nFROM   result\r\n\t\t   left join host on result.hostid = host.id \r\nWHERE\r\n\t   appid = '{$query_appid}' and\r\n\t   server_state = '5' and\r\n\t   outcome = '3' and \r\n\t   received_time > '{$query_received_time}'\r\nGROUP BY\r\n\t   app_version_num DESC,\r\n\t   hostid,\r\n\t   OS_Name,\r\n\t   OS_Version,\r\n\t   host.nresults_today\r\n";
$result = mysql_query($main_query);
echo "<table>\n";
echo "<tr><th>App Version</th><th>Host ID</th><th>OS Name</th><th>OS Version</th><th>Results Today</th><th>Error Count</th></tr>\n";
while ($res = mysql_fetch_object($result)) {
    echo "<tr>";
    echo "<td align=\"left\" valign=\"top\">";
    echo $res->App_Version;
    echo "</td>";
    echo "<td align=\"left\" valign=\"top\">";
    echo $res->Host_ID;
    echo "</td>";
Example #21
0
function db_changeDatabase($dbName)
{
    $dbName = addslashes($dbName);
    db_init();
    return db_execute("use {$dbName}");
}
Example #22
0
<?php

require_once 'config.php';
require_once 'dblibs.php';
$result = TRUE;
try {
    db_connect();
    $result = db_init();
} catch (PDOException $e) {
    $result = FALSE;
}
if ($result === TRUE) {
    header('Location: success.php');
} else {
    header('Location: error.php');
}
exit;
Example #23
0
/* 'Register' feature interface */
include './include/util.php';
include './include/check.php';
include './include/session.php';
include './include/exception.php';
try {
    $fieldValues = receive_json();
    if (!$fieldValues) {
        throw new Exceptioni("emptyRequest");
    }
    $fieldRules = ["email" => ["required" => 1, "length" => 254, "regex" => "/\\S+@\\S+\\.\\S+/"], "password" => ["required" => 1, "length" => 255], "password2" => ["required" => 1, "length" => 255], "captcha" => ["required" => 1, "length" => 5], "captchaUid" => ["required" => 1, "length" => 18], "phone" => ["length" => 20, "regex" => "/\\+?[\\d\\(\\)\\- ]{6,}\$/"], "phone2" => ["length" => 20, "regex" => "/\\+?[\\d\\(\\)\\- ]{6,}\$/"], "firstName" => ["required" => 1, "length" => 127], "lastName" => ["required" => 1, "length" => 127], "middleName" => ["length" => 127], "married" => ["typeBool" => 1], "year" => ["required" => 1, "length" => 4, "regex" => "/^\\d{4}\$/"], "city" => ["required" => 1, "length" => 127], "street" => ["required" => 1, "length" => 127], "house" => ["required" => 1, "length" => 5], "apartment" => ["length" => 5], "education" => ["required" => 1, "length" => 32768], "professionalExperience" => ["length" => 32768], "info" => ["length" => 32768], "image" => ["length" => 2 * pow(1024, 2) * 1.37]];
    $errors = check_field_rules($fieldValues, $fieldRules);
    if ($errors) {
        throw new Exceptioni("fieldErrors");
    }
    $dbLink = db_init();
    $uid = $fieldValues->captchaUid;
    $captcha = $fieldValues->captcha;
    if (!captcha_match($dbLink, $captcha, $uid)) {
        $errors["captcha"] = "mismatch";
        throw new Exceptioni("fieldErrors");
    }
    /* Checking if no already registered email */
    if (!email_unique($dbLink, $fieldValues->email)) {
        $errors["email"] = "notUnique";
        throw new Exceptioni("fieldErrors");
    }
    /* Checking userpic for correct mime, writing file */
    $image = $fieldValues->image;
    if ($image) {
        $imageBinary = base64_decode($image, true);
Example #24
0
# What else?
/*
 * general process is: createfolders, then use createfoldercontents to
 * associate folders with each other....
 */
require_once "FIXMETOBERELATIVE/pathinclude.php";
/* the items below no longer exist, my this code is old.... */
require_once "{$PHPDIR}/webcommon.h.php";
require_once "{$PHPDIR}/jobs.h.php";
require_once "{$PHPDIR}/db_postgres.h.php";
// if you do it yourself....use the lib...
#$_pg_conn = pg_connect(str_replace(";", " ",
#	   file_get_contents("{$SYSCONFDIR}/{$PROJECT}/Db.conf")));
$path = "{$SYSCONFDIR}/{$PROJECT}}/Db.conf";
$alpha_buckets = array('a-c', 'd-f', 'g-i', 'j-l', 'm-o', 'p-r', 's-u', 'v-z');
db_init($path);
if (!$_pg_conn) {
    echo "ERROR: could not connect to DB\n";
    exit(1);
}
/*
 * Steps are:
 * 1. create top folder
 * using value returned from cratefolder,
 * 2. use that in a loop to create the other folders.
 * 3. Other folders are created with
 * createrfolder, and then associated with parent folder with
 * createfoldercontents.
 */
$sql = 'select users.root_folder_fk from users';
// who is my parent?
Example #25
0
<?php

require "config/config.php";
require "lib/db.php";
$conn = db_init($config["host"], $config["duser"], $config["dpw"], $config["dname"]);
$title = mysqli_real_escape_string($conn, $_POST['title']);
$description = mysqli_real_escape_string($conn, $_POST['description']);
$sql = "UPDATE topic SET title='" . $title . "', description='" . $description . "', created=now() WHERE id='" . $_POST['id'] . "'";
$result = mysqli_query($conn, $sql);
header('Location: http://localhost:8080/list.php?id=' . $_POST['id'] . '');
Example #26
0
				</div>

				<br>
				<div align="center">
					<button
						class="btn waves-effect waves-light <?php 
                echo $_SESSION['USER_COLOUR'];
                ?>
"
						type="submit" name="action">Generate</button>
				</div>
			</form>
				<?php 
                break;
            case 'statistics':
                if (!($link = db_init(false))) {
                    dead(mysqli_error($link));
                }
                $result = mysqli_query($link, 'SELECT * FROM `meta`;');
                $meta = @mysqli_fetch_all($result, MYSQLI_ASSOC)[0];
                mysqli_free_result($result);
                mysqli_close($link);
                unset($link);
                ?>
            <h6>Server statistics</h6>
			<br>
			<div align="center">
			<?php 
                echo 'Atlas ' . INFO_ATLAS_VERSION . '-' . INFO_ATLAS_STAGE . '<br>' . PHP_EOL;
                echo 'Built ' . INFO_ATLAS_BUILDDATE . '<br>' . PHP_EOL;
                echo 'Installed ' . getHumanDate(new DateTime($meta['installed']), new DateTime(date('Y-n-d H:i:s', time()))) . '<br>' . PHP_EOL;
Example #27
0
    if ($status) {
        echo "<font color='green'>OK";
    } else {
        echo "<font color='yellow'>Hm...";
    }
    echo "</td><td>";
    if (!$status) {
        echo $comment;
    }
    echo "</td></tr>";
}
showCheck("Linking to config.php", file_exists("./config.php"), "config.php is missing - did you remember to copy from the sample?");
require_once "./config.php";
showCheck("Linking to BOINC serverside framework", file_exists("../inc/util.inc"), "Cannot find the BOINC framework - did you install the BT system in the html/-directory of your BOINC installation?");
require_once "../inc/util.inc";
showCheck("Database link", db_init() || true, "");
showCheck("bittorrent_files table", mysql_query("select * from bittorrent_files"), "Table inaccessible");
showCheck("bittorrent_ipbans table", mysql_query("select * from bittorrent_ipbans"), "Table inaccessible");
showCheck("bittorrent_peers table", mysql_query("select * from bittorrent_peers"), "Table inaccessible");
showCheck("bittorrent_statistics table", mysql_query("select * from bittorrent_statistics"), "Table inaccessible");
showCheck("Linking to download dir (" . $fileDirectory . ")", file_exists($fileDirectory), "Directory not accessible or present");
showCheck("Tracker present (" . $trackerURL . ")", fopen($trackerURL, "r"), "Either this webserver doesn't support URL-fopen-wrappers or the tracker is not available. In the first case you may safely ignore this warning.");
showCheck("Webseeds defined", sizeof($webseeds) > 0, "No webseeds defined");
foreach ($webseeds as $webseed) {
    showCheck("Seed present (" . $webseed . ")", fopen($webseed, "r"), "Either this webserver doesn't support URL-fopen-wrappers or the webseed is not present. If the first is the case this warning may safely be ignored.");
}
showCheck("Linking to logfile (" . TRACKER_LOGFILE . ")", file_exists(TRACKER_LOGFILE), "The logfile doesn't exist - this may be because the system hasn't been run yet or because the file couldn't be created.");
?>
	</table>
	<p>
	    Files used in this distribution:
Example #28
0
    if ($running) {
        echo "<td bgcolor=00ff00>Running</td>\n";
    } else {
        echo "<td bgcolor=ff0000>Not running</td>\n";
    }
}
function show_daemon_status($host, $progname, $pidname)
{
    $running = daemon_status($host, $pidname);
    show_status($host, $progname, $running);
}
###############################################
# BEGIN:
start_cache(1800);
$Nmin = $cached_max_age / 60;
$dbrc = db_init(1);
// 1=soft, remember that DB might be down
page_head(PROJECT . " - Server Status");
// Date stamp
echo "<br ALIGN=RIGHT> " . PROJECT . " server status as of " . date("g:i A T") . " on " . date("l, j F Y ") . " (updated every {$Nmin} minutes).\n";
$proc_uptime = exec("cat /proc/uptime | cut -d\" \" -f-1");
$days = (int) ($proc_uptime / 86400);
$hours = (int) ($proc_uptime / 3600);
$hours = $hours % 24;
$minutes = (int) ($proc_uptime / 60);
$minutes = $minutes % 60;
echo "<br ALIGN=RIGHT>The " . PROJECT . " main server has been continuously up for " . "{$days}" . " days " . "{$hours}" . " hours " . "{$minutes}" . " minutes.\n<P>";
// tables side by side
echo "<TABLE><TR><TD align=center> \n";
echo "\r\n\t<h2>Server status</h2>\r\n\t<table border=2 cellpadding=6>\r\n\t<tr><th>Program</th><th>Host</th><th>Status</th></tr>\r\n";
$web_running = !file_exists("../../stop_web");
<?php

require dirname(__FILE__) . '/setup.php';
require dirname(__FILE__) . '/db_init.php';
$pdo = new PDO('mysql:host=localhost; dbname=hermit_test', 'root', 'password');
db_init($pdo);
$test = new lime_test();
$test->diag(basename(__FILE__));
$dbmeta = new HermitMySQLDatabaseMeta($pdo);
$test->diag(basename(__FILE__) . '::parameter[in:out]');
$procedureInfo = $dbmeta->getProcedureInfo('PROC_IN_OUT');
$test->ok($procedureInfo !== null);
$parameters = array_map('strtolower', $procedureInfo->getParamNames());
$expect = array('sales', 'tax');
$test->is(count(array_diff($parameters, $expect)), 0);
$test->is($procedureInfo->typeofIn('sales'), true);
$test->is($procedureInfo->typeofOut('sales'), false);
$test->is($procedureInfo->typeofInOut('sales'), false);
$test->is($procedureInfo->typeofIn('tax'), false);
$test->is($procedureInfo->typeofOut('tax'), true);
$test->is($procedureInfo->typeofInOut('tax'), false);
$procedureInfo2 = $dbmeta->getProcedureInfo('PROC_IN_OUT');
$test->ok($procedureInfo === $procedureInfo2, 'same instance');
$test->diag(basename(__FILE__) . '::parameter[in:out:out]');
$procedureInfo = $dbmeta->getProcedureInfo('PROC_IN_OUT_OUT');
$parameters = array_map('strtolower', $procedureInfo->getParamNames());
$expect = array('sales', 'tax', 'total');
$test->is(count(array_diff($parameters, $expect)), 0);
$test->is($procedureInfo->typeofIn('sales'), true);
$test->is($procedureInfo->typeofOut('sales'), false);
$test->is($procedureInfo->typeofInOut('sales'), false);
Example #30
0
<?php

require "../lib/db.php";
require "../config/config.php";
$host = $config['host'];
$duser = $config['duser'];
$dpw = $config['dpw'];
$dname = $config['dname'];
$conn = db_init($host, $duser, $dpw, $dname);
$result = mysqli_query($conn, 'SELECT * FROM topic');
?>


<!DOCTYPE html>
<html>
<head>
     <meta charset="utf-8">
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
     <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="../css/style.css" media="screen" title="no title" charset="utf-8">
    <link href="../bootstrap-3.3.6-dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
  <div class="container">
    <header class="jumbotron text-center">
       <img src="https://s3-ap-northeast-1.amazonaws.com/opentutorialsfile/course/94.png" alt="생활코딩" class="img-circle" id="logo" class="img-circle">
        <h1><a href=".">JavaScript</a></h1>
    </header>

    <div class="row">
          <nav class="col-md-4">