本文整理汇总了PHP中check_db函数的典型用法代码示例。如果您正苦于以下问题:PHP check_db函数的具体用法?PHP check_db怎么用?PHP check_db使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了check_db函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: callObj
function callObj($agi)
{
global $db;
$this->agiVars = $agi;
$this->callerId = trim(preg_replace('/.*<(\\d+)>.*/i', '${1}', $this->agiVars["callerid"]));
$this->extension = $this->agiVars["extension"];
$query = "select count(*) from People " . "where Extension = '" . $this->callerId . "}'";
$query = $db->query($query);
check_db($query);
if ($row = $query->fetchRow(DB_FETCHMODE_ORDERED)) {
$this->isLocalPep = true;
} else {
$this->isLocalPep = false;
// recherche du responsable
$query = "Select Responsable_Extension " . "from Extension " . "where ((ext_end is not null and " . "extension_type_comp(extension, '" . $this->callerId . ") <= 0 " . "and extension_type_comp(ext_end, '" . $this->extension . "') >= 0) or " . " (ext_end is null and extension = '" . $this->extension . "')) and " . " Responsable_Extension is not null";
$query = $db->query($query);
check_db($query);
if (!($row = $query->fetchRow(DB_FETCHMODE_ORDERED))) {
// responsable non trouvé :
$this->responsable = '';
} else {
$this->responsable = $row[0];
}
}
$this->lastTryStatus = NULL;
}
示例2: step
function step($is_submit)
{
if ($is_submit) {
return check_db();
}
$result = array('html' => render('step_database', array()));
return $result;
}
示例3: people_dial
function people_dial(&$call)
{
global $db;
$extension = $call->get_extension();
$callerId = $call->get_cid();
$callerIdFull = $call->get_cidFull();
$query = "select Context " . " from AsteriskGoto " . " where Extension = {$extension} ";
$query = $db->query($query);
check_db($query);
if ($row = $query->fetchRow(DB_FETCHMODE_ORDERED)) {
// ceci boycott complètement le fonctionnement d'obelisk
agi_goto($row[0]);
}
return agi_notFound($call);
}
示例4: geo_dial
function geo_dial(&$call)
{
global $db;
$extension = $call->get_extension();
$callerId = $call->get_cid();
$callerIdFull = $call->get_cidFull();
$query = "select destination.People_Extension " . "from Geographical_Alias as caller, " . " \tGeographical_Alias as destination, " . "\tGeographical_Group as grp " . "where caller.People_Extension = '" . $callerId . "' " . " and caller.Geographical_Group_ID = grp.ID " . " and grp.ID = destination.Geographical_Group_ID " . " and destination.Extension = '" . $extension . "' ";
$query = $db->query($query);
check_db($query);
if (!($row = $query->fetchRow(DB_FETCHMODE_ORDERED))) {
agi_log(DEBUG_ERR, "geo/dial.inc.php: extension : " . $extension . " not found");
return agi_notFound($call);
}
agi_log(DEBUG_INFO, "geo/dial.inc.php: {$extension} -> " . "People : " . $row[0]);
$call->set_extension($row[0]);
include_once 'modules/people/dial.inc.php';
return people_dial($call);
}
示例5: App
<?php
/**
* @package util
*/
/*
* require boot.php
*/
require_once "boot.php";
$a = new App();
@(include ".htconfig.php");
$lang = get_browser_language();
load_translation_table($lang);
require_once "include/dba.php";
$db = new dba($db_host, $db_user, $db_pass, $db_data, false);
unset($db_host, $db_user, $db_pass, $db_data);
$build = get_config('system', 'build');
echo "Old DB VERSION: " . $build . "\n";
echo "New DB VERSION: " . DB_UPDATE_VERSION . "\n";
if ($build != DB_UPDATE_VERSION) {
echo "Updating database...";
check_db($a);
echo "Done\n";
}
示例6: install_check
function install_check()
{
global $lockfile;
$dbname = $_SESSION['dbinfo']['dbname'];
$dbinfo = $_SESSION['dbinfo'];
$multitable = $_SESSION['multitable'];
extract($dbinfo);
if (!check_db($dbhost, $dbuser, $dbpw, $dbname, $multitable)) {
show_msg('tablepre_not_exists', 0);
} else {
@touch($lockfile);
session_destroy();
echo '<div class="btnbox marginbot"><input type="button" name="submit" value="' . lang('step_install_check_desc') . '" style="height: 25" onclick="window.location.href=\'../index.php/passport/login\'"></div>';
//echo '<script>window.location.href="/index.php";</script>';
}
}
示例7: die
<head>
\t<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
\t<title>phpSQLiteAdmin</title>
\t<meta http-equiv="expires" content="0">
\t<script language="javascript" src="javascript.txt" type="text/javascript"></script>
\t<link href="phpsla.css" rel="stylesheet" type="text/css">
\t<base target="mainframe">
</head>
<body class=right>
<div id="currentdb">Database: {$_SESSION['phpSQLiteAdmin_currentdb']}</div>
EOT;
if (check_db()) {
print "<p class=\"sqliteversion\">SQLite version: " . $sqliteversion . "</p>\n";
}
print "<h3>phpSQLiteAdmin 0.2</h3>\n";
if (!check_db()) {
die("<p>The selected database is either read-only or does not exist</p>\n");
}
$dbinfo = $userdbh->dbInfo();
print "<table id=\"dbinfotable\">\n";
print "<tr><th colspan=2>Database file information</th></tr>\n";
print "<tr><td>Size:</td><td>" . $dbinfo['size'] / 1024 . "KB</td></tr>\n";
print "<tr><td>Last modification:</td><td>" . $dbinfo['last_mod'] . "</td></tr>\n";
if (function_exists("posix_getpwuid")) {
$user = posix_getpwuid($dbinfo['owner']);
$group = posix_getgrgid($user['gid']);
print "<tr><td>Owner:</td><td>" . $user['name'] . "</td></tr>\n";
print "<tr><td>Group:</td><td>" . $group['name'] . "</td></tr>\n";
}
print "</table><br>\n";
print "<h3>Tables:</h3>\n";
示例8: array
}
if (!x($_SESSION, 'sysmsg_info')) {
$_SESSION['sysmsg_info'] = array();
}
/*
* check_config() is responsible for running update scripts. These automatically
* update the DB schema whenever we push a new one out. It also checks to see if
* any plugins have been added or removed and reacts accordingly.
*/
if ($install) {
$a->module = 'install';
} elseif ($maintenance) {
$a->module = 'maintenance';
} else {
check_url($a);
check_db();
check_plugins($a);
}
nav_set_selected('nothing');
$arr = array('app_menu' => $a->apps);
call_hooks('app_menu', $arr);
$a->apps = $arr['app_menu'];
/**
*
* We have already parsed the server path into $a->argc and $a->argv
*
* $a->argv[0] is our module name. We will load the file mod/{$a->argv[0]}.php
* and use it for handling our URL request.
* The module file contains a few functions that we call in various circumstances
* and in the following order:
*
示例9: outside_getNetworkId
/**
* outside_getNetworkId - return the networkId for an extension
*
* PRE: $call is a valid CallObj where $extension is defined
*
* POST: retrun a positive number which is the network Id or a negative number
* which means 'unknown'
*
* I/O: dowsnload the primary networkId and execute the phpfunction in order to
* get the secondary network ID.
*/
function outside_getNetworkId(&$call)
{
global $db;
$query = "select N.ID, N.SubNetwork_function " . " from Network as N, NetworkMask as M " . " where N.ID = M.Network_ID " . " and extension_type_comp('" . $call->get_extension() . "', M.extStart) >= 0 " . " and extension_type_comp('" . $call->get_extension() . "', M.extEnd) <= 0 ";
$query = $db->query($query);
check_db($query);
if (!($row = $query->fetchRow(DB_FETCHMODE_ORDERED))) {
return -1;
}
if ($row[1] != '') {
// fonction de sous-séledtion
$fct = "outside_select_" . $row[1];
return $fct();
}
return $row[0];
}
示例10: fix_adminpath
// currently, only JME and JME are supported
if ($editor != "jme") {
$editor = "jme";
}
if ($editor == "jme") {
$edtag = "applet";
// "applet" (for JME) or "div" (for JME)
} else {
$edtag = "div";
// "applet" (for JME) or "div" (for JME)
$jme_path = fix_adminpath($jme_path);
}
$link = mysql_pconnect($hostname, "{$rw_user}", "{$rw_password}") or die("Could not connect to database server!");
mysql_select_db($database) or die("Could not select database!");
mysql_query("SET NAMES {$mysql_charset}");
$db_id = check_db($db_id);
if ($db_id < 0) {
$db_id = $default_db;
$db_id = check_db_all($db_id);
if ($db_id < 0) {
$db_id = get_lowestdbid();
}
}
$mydb = get_dbproperties($db_id);
$dbtype = $mydb['type'];
if ($dbtype == 1 && $datatype != 1) {
$datatype = 1;
}
if ($dbtype == 2 && $datatype != 2) {
$datatype = 2;
}
示例11: displayError
displayError("--sircrit needs to be bigger than --sirwarn");
}
$iCurrentEpoch = date('U');
$iDiffEpoch = $iCurrentEpoch - $data['SearchIndexRebuildLast'];
if (empty($data['SearchIndexRebuildLast'])) {
update_err_state(3, "Search Index never built");
} elseif ($data['SearchIndexRebuildLast'] < $iCurrentEpoch - $crit) {
update_err_state(1, "Search Index older than {$crit} sec|time=" . $iDiffEpoch . "s;;;0");
} elseif ($data['SearchIndexRebuildLast'] < $iCurrentEpoch - $warn) {
update_err_state(1, "Search Index older than {$warn} sec|time=" . $iDiffEpoch . "s;;;0");
} elseif ($data['SearchIndexRebuildLast'] > $iCurrentEpoch - $warn) {
update_err_state(0, "Search Index is fresh|time=" . $iDiffEpoch . "s;;;0");
} else {
update_err_state(3, "Search index state unknown");
}
}
$options = get_opts();
if (empty($options) or isset($options['h'])) {
help();
exit(1);
}
$data = get_data($options);
if (isset($options['c'])) {
$check = 'check_' . $options['c'];
$check($data, $options);
} else {
check_bcc($data, $options);
check_db($data, $options);
check_searchindex($data, $options);
}
report();
示例12: isset
$error_msg[$key][$k] = 1;
}
}
}
} else {
$submit = false;
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if ($password != $password2) {
$error_msg['admininfo']['password2'] = 1;
$submit = false;
}
$forceinstall = isset($_POST['dbinfo']['forceinstall']) ? $_POST['dbinfo']['forceinstall'] : '';
$dbname_not_exists = true;
if (!empty($dbhost) && empty($forceinstall)) {
$dbname_not_exists = check_db($dbhost, $dbuser, $dbpw, $dbname, $tablepre, $dbport);
if (!$dbname_not_exists) {
$form_db_init_items['dbinfo']['forceinstall'] = array('type' => 'checkbox', 'required' => 0, 'reg' => '/^.*+/');
$error_msg['dbinfo']['forceinstall'] = 1;
$submit = false;
$dbname_not_exists = false;
}
}
}
if ($submit) {
$step = $step + 1;
if (empty($dbname)) {
show_msg('dbname_invalid', $dbname, 0);
} else {
if (!@mysql_connect($dbhost . ":" . $dbport, $dbuser, $dbpw)) {
$errno = mysql_errno();
示例13: session_start
<?php
//file: process.php
session_start();
require_once '../config.php';
$email = $_POST['email'];
$pass = $_POST['pass'];
/*
echo "email:";
echo $email;
echo "<br />";
echo "password:";
echo $pass;
echo "<br />";
*/
$result = check_db($email, $pass);
function check_db($email, $pass)
{
//check db
//need: host, user, password, database
$link = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_DATABASE);
if (!$link) {
echo "Error: Unable to connect to MySQL." . PHP_EOL;
echo "Debugging error: " . mysqli_connect_errno() . PHP_EOL;
echo "Debugging error: " . mysqli_connect_error() . PHP_EOL;
exit;
}
/*
//connect & show connection info
echo "Success: A proper connection to MySQL was made! The my_db database is great." . PHP_EOL;
echo "Host information: " . mysqli_get_host_info($link) . PHP_EOL;
示例14: error_reporting
<?php
error_reporting(E_ALL & ~E_NOTICE);
if ($_REQUEST[action] == 'install') {
save_db_config();
require "../config.php";
if ($conn = check_connection($_REQUEST[mysql_user], $_REQUEST[mysql_pass], $_REQUEST[mysql_host])) {
if (check_db($_REQUEST[mysql_db], $conn)) {
install_db();
} else {
echo "<p><font color='red'><b>Install failed: Cannot select database. " . mysql_error() . "</b></font></p>";
}
} else {
echo "<p><font color='red'><b>Install failed: Cannot connect to database. " . mysql_error() . "</b></font></p>";
}
} else {
require "../config.php";
}
$sql = "select * from users";
$result = @mysql_query($sql);
if ($result) {
echo "<h3>Database successfully Installed.</h3>";
echo "<p>";
echo "Next Steps:<br>";
echo "1. Delete this file (install.php) from the server<br>";
echo "2. Note: You must go to Admin->Main Config now and set up the rest of the script.<br>";
echo " <a href='" . BASE_HTTP_PATH . "admin/'>Go to Admin</a>. <b>(The default admin password is 'ok'. Please don't forget to change the default password.)</b><br>";
die;
}
function check_connection($user, $pass, $host)
{
示例15: table_users
echo "<b>{$strDeleteUserMessage} <font color=#002E80>{$delete_user}@{$delete_host}</font><br>{$strRememberReload}</b>";
} else {
echo "<b>{$strDeleteFailed}</b>";
}
}
if (isset($edit) && $edit) {
# Edit an user
table_users($host, $user);
edit_operations($host, $user);
} elseif (isset($grants) && $grants) {
# Revoke/Grant Privileges
table_grants($host, $user);
grant_operations();
} elseif (isset($check) && $check) {
# Check Database Privileges
check_db($db);
check_operations();
} else {
# Users actions
if (!isset($host)) {
$host = FALSE;
}
if (!isset($user)) {
$user = FALSE;
}
table_users($host, $user) || mysql_die($strNoUsersFound);
normal_operations();
}
require './footer.inc.php';
?>
</html>