本文整理汇总了PHP中db_get_value函数的典型用法代码示例。如果您正苦于以下问题:PHP db_get_value函数的具体用法?PHP db_get_value怎么用?PHP db_get_value使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了db_get_value函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: insert
function insert($table = NULL)
{
if (!$table) {
$table = $GLOBALS['table'];
}
db_insert($table, fields($table), values($table));
$_REQUEST['id'] = db_get_value($table, 'LAST_INSERT_ID()');
}
示例2: delCourse
function delCourse($id)
{
$ugroup_id = db_get_value("class", "FK_ugroup", "class_id='" . addslashes($id) . "'");
$query = "\n\t\t\tDELETE FROM\n\t\t\t\tclass\n\t\t\tWHERE\n\t\t\t\tclass_id='" . addslashes($id) . "'\n\t\t";
db_query($query);
$query = "\n\t\t\tDELETE FROM\n\t\t\t\tugroup_user\n\t\t\tWHERE\n\t\t\t\tFK_ugroup='" . addslashes($ugroup_id) . "'\n\t\t";
db_query($query);
$query = "\n\t\t\tDELETE FROM\n\t\t\t\tugroup\n\t\t\tWHERE\n\t\t\t\tugroup_id='" . addslashes($ugroup_id) . "'\n\t\t";
db_query($query);
}
示例3: showRawPrint
function showRawPrint($subaction = null)
{
global $gbl, $sgbl, $login, $ghtml;
$parent = $this->getParentO();
$v = lfile_get_contents("htmllib/filecore/sshterm-applet.htm");
if ($parent->is__table('pserver')) {
$v = str_replace("%username%", "root", $v);
$ip = getFQDNforServer($parent->nname);
$sshport = db_get_value("sshconfig", $parent->nname, "ssh_port");
if (!$sshport) {
$sshport = "22";
}
$v = str_replace("%host%", $ip, $v);
$v = str_replace("%port%", $sshport, $v);
$v = str_replace("%connectimmediately%", "true", $v);
} else {
if ($parent->is__table('client')) {
if ($parent->isDisabled('shell') || !$parent->shell) {
$ghtml->print_information("pre", "updateform", "sshclient", "disabled");
exit;
}
$sshport = db_get_value("sshconfig", $parent->websyncserver, "ssh_port");
if (!$sshport) {
$sshport = "22";
}
$ghtml->print_information("pre", "updateform", "sshclient", "warning");
$ip = getFQDNforServer("localhost");
$v = str_replace("%username%", $parent->username, $v);
$v = str_replace("%host%", $ip, $v);
$v = str_replace("%port%", $sshport, $v);
$v = str_replace("%connectimmediately%", "true", $v);
} else {
$v = str_replace("%username%", "root", $v);
$ip = $parent->getOneIP();
$sshport = db_get_value("sshconfig", $parent->syncserver, "ssh_port");
if (!$ip) {
throw new lxException("need_to_add_at_least_one_ip_to_the_vps_for_logging_in");
}
if (!$sshport) {
$sshport = "22";
}
$v = str_replace("%host%", $ip, $v);
$v = str_replace("%port%", $sshport, $v);
$v = str_replace("%connectimmediately%", "true", $v);
}
}
print $v;
}
示例4: serverCopySite
function serverCopySite($orig, $dest)
{
$sections = decode_array(db_get_value("sites", "sections", "name='{$orig}'"));
$nsections = array();
foreach ($sections as $s) {
$sa = db_get_line("sections", "id={$s}");
$squery = "insert into sections set addedby='" . addslashes($_SESSION['auser']) . "', addedtimestamp=NOW()";
$squery .= ",title='{$sa['title']}', active={$sa['active']}, type='{$sa['type']}', url='{$sa['url']}'";
$pages = decode_array($sa[pages]);
$npages = array();
foreach ($pages as $p) {
$pa = db_get_line("pages", "id={$p}");
$pquery = "insert into pages set addedby='" . addslashes($_SESSION['auser']) . "', addedtimestamp=NOW()";
$pquery .= ",ediscussion=1,archiveby='{$pa['archiveby']}',url='{$pa['url']}',type='{$pa['type']}',title='{$pa['title']}', showcreator={$pa['showcreator']}, showdate={$pa['showdate']}, locked={$pa['locked']}, active={$pa['active']}";
$stories = decode_array($pa[stories]);
$nstories = array();
foreach ($stories as $st) {
$sta = db_get_line("stories", "id={$st}");
$stquery = "insert into stories set addedby='" . addslashes($_SESSION['auser']) . "', addedtimestamp=NOW()";
$stquery .= ",type='{$sta['type']}',texttype='{$sta['texttype']}',category='{$sta['category']}',title='{$sta['title']}', discuss={$sta['discuss']}, discusspermissions='{$sta['discusspermissions']}', shorttext='{$sta['shorttext']}', longertext='{$sta['longertext']}', locked={$sta['locked']}, url='{$sa['url']}'";
db_query($stquery);
// print "$stquery<br />";
$nstories[] = lastid();
}
$stories = encode_array($nstories);
$pquery .= ",stories='{$stories}'";
db_query($pquery);
$npages[] = lastid();
// print "$pquery<br />";
}
$pages = encode_array($npages);
$squery .= ",pages='{$pages}'";
db_query($squery);
$nsections[] = lastid();
// print "$squery<br />";
}
$sections = encode_array($nsections);
$query = "update sites set sections='{$sections}' where name='{$dest}'";
db_query($query);
// print "$query<br />";
}
示例5: showRawPrint
function showRawPrint($subaction = null)
{
global $gbl, $sgbl, $login, $ghtml;
$parent = $this->getParentO();
$parent->makeSureTheUserExists();
$lgg = $parent->getLogin();
$sshport = db_get_value("sshconfig", $parent->syncserver, "ssh_port");
if (!$sshport) {
$sshport = "22";
}
$v = lfile_get_contents("htmllib/filecore/sshterm-applet.htm");
$ip = $lgg[1];
$v = str_replace("%username%", $lgg[0], $v);
$v = str_replace("%host%", $ip, $v);
$v = str_replace("%port%", $sshport, $v);
$v = str_replace("%connectimmediately%", "true", $v);
$string = $login->getKeyword("console_message");
$string = str_replace("%username%", "<font style='font-weight:bold'>{$lgg['0']}@{$ip}:{$sshport} </font>", $string);
print " <table cellpadding=0 cellspacing=0 width=80%> <tr> <td > {$string} <br> </td> </tr> </table> \n";
print $v;
}
示例6: tile_get_32
function tile_get_32($url)
{
$tile = db_get_value('tiles', 't32', 'where url=%"', $url);
if ($tile === false) {
#return false;
return str_repeat("", 32 * 32 / 8);
}
#$debug_binary = true;
if ($debug_binary) {
$GLOBALS['debug_tiles'] = true;
tile_get_128($url);
# because it prints now
tile_get_64($url);
# because it prints now
print_full_table($tile, 32, 32 / 8);
exit;
}
if ($GLOBALS['debug_tiles']) {
print_full_table($tile, 32, 32 / 8);
}
return $tile;
}
示例7: getAnyErrorMessage
function getAnyErrorMessage()
{
global $gbl, $sgbl, $login, $ghtml;
if ($sgbl->isKloxo() && $this->isAdmin()) {
if (!is_unlimited($this->priv->maindomain_num) && $this->priv->maindomain_num - $this->used->maindomain_num < 6) {
$ghtml->__http_vars['frm_smessage'] = 'warn_license_limit';
$ghtml->__http_vars['frm_m_smessage_data'] = 'maindomain_num';
}
}
if ($this->isAdmin()) {
$v = db_get_value("sshconfig", "localhost", "without_password_flag");
$vv = db_get_value("sshconfig", "localhost", "config_flag");
$this->__t_check_var = $v;
$this->__t_check_vvar = $vv;
if (!$this->isOn('__t_check_var') && !$this->isOn('__t_check_vvar')) {
//$ghtml->__http_vars['frm_emessage'] = "ssh_root_password_access";
}
if ($sgbl->isKloxo()) {
$v = db_get_value("servermail", "localhost", "myname");
if ($sgbl->isKloxo() && !$v) {
$ghtml->__http_vars['frm_emessage'] = "mail_server_name_not_set";
}
}
if (!$gbl->getSessionV('__v_error_not_first_time')) {
$v = db_get_value("lxguard", "localhost", "configure_flag");
$this->__t_check_var = $v;
if (!$this->isOn('__t_check_var')) {
$ghtml->__http_vars['frm_emessage'] = "lxguard_not_configured";
}
}
}
parent::getAnyErrorMessage();
$gbl->setSessionV('__v_error_not_first_time', 1);
}
示例8: get_story_title
function get_story_title($story_id)
{
$story_title = db_get_value("story", "story_title", "story_id ='" . addslashes($story_id) . "'");
return $story_title;
}
示例9: doUpdateExtraStuff
function doUpdateExtraStuff()
{
global $gbl, $sgbl, $login, $ghtml;
lxfile_mkdir("__path_program_etc/flag");
print "Check database password\n";
$a = null;
fix_mysql_root_password('localhost');
$dbadmin = new Dbadmin(null, 'localhost', "mysql___localhost");
$dbadmin->get();
$pass = $dbadmin->dbpassword;
$a['mysql']['dbpassword'] = $pass;
slave_save_db("dbadmin", $a);
print "Check the core database\n";
parse_sql_data();
if (call_with_flag("convertIpaddressToComa")) {
print "Converted IP addresses in database\n";
}
if (call_with_flag("fixExtraDB")) {
print "- Fixed\n";
}
print "Set OS template permissions\n";
if (is_openvz()) {
lxfile_unix_chmod_rec("/vz/template/cache/", "0755");
} else {
lxfile_unix_chmod_rec("/home/hypervm/xen/template/", "0755");
}
call_with_flag("dofixParentClname");
print "Get License\n";
// ToDo: Why is this called this way....
passthru("{$sgbl->__path_php_path} htmllib/lbin/getlicense.php");
if (is_openvz()) {
print "Check OpenVZ resources\n";
if (call_with_flag("fixOpenVZResource")) {
print "- Fixed\n";
}
}
if (move_clients_to_client()) {
print "Renamed clients directory to client.\n";
}
print "Checking backup dirs\n";
if (!add_vps_backup_dir()) {
print "- Everything is fine.\n";
}
print "Fix IP POOL\n";
lxshell_return("__path_php_path", "../bin/fix/fixippool.php");
if (call_with_flag("fix_ipaddress_column_type")) {
print "Fixed IP address column in database\n";
}
if (call_with_flag("fix_vmipaddress")) {
print "Fixed VM IP addresses in database\n";
}
print "Checking HIB template\n";
get_kloxo_ostemplate();
if (db_get_value("client", "admin", "contactemail")) {
print "Set admin email\n";
save_admin_email();
}
// Unknown usage within HyperVM, anyone can tell what this is doing?
$file = "__path_program_root/etc/fixed_interface_template_sql";
if (lxfile_exists($file)) {
lxfile_touch($file);
print "Check Interface Template (database)\n";
system("mysql -u hypervm -p`cat ../etc/conf/hypervm.pass` hypervm1_0 < ../file/interface/interface_template.sql");
}
if (lxfile_exists("/etc/init.d/libvirtd")) {
print "Make sure libvirtd is not started after reboot\n";
system("chkconfig libvirtd off 2>/dev/null");
}
if (is_openvz()) {
print "Checking for Base default OS template\n";
$OSTemplateDir = "/vz/template/cache";
$defaultOSTemplate = "centos-6-x86.tar.gz";
$defaultOSTemplateName = "centos-6-x86";
if (!lxfile_exists($OSTemplateDir)) {
lxfile_mkdir($OSTemplateDir);
}
if (!lxfile_real("{$OSTemplateDir}/{$defaultOSTemplate}")) {
lxfile_rm("{$OSTemplateDir}/{$defaultOSTemplate}");
system("cd {$OSTemplateDir}/ ; wget http://download.hypervm-ng.org/download/openvztemplates/base/{$defaultOSTemplate}");
system("rm {$OSTemplateDir}/index.html* 2>/dev/null");
system("rm {$OSTemplateDir}/robots.txt* 2>/dev/null");
}
// Added in HyperVM 2.1.0
if (lxfile_exists("/usr/sbin/vztmpl-dl")) {
print "Checking for latest version of {$defaultOSTemplateName} at OpenVZ.org website\n";
$res = system("/usr/sbin/vztmpl-dl --update {$defaultOSTemplateName} 2>/dev/null");
dprint("res: {$res}\n");
}
} else {
if (!lxfile_real("/home/hypervm/xen/template/centos-6-x86-pygrub-sda-latest.tar.gz")) {
system("mkdir -p /home/hypervm/xen/template ; cd /home/hypervm/xen/template/ ; rm centos-6-i386.tar.gz; rm centos-5-i386.tar.gz; rm centos-5-i386-afull.tar.gz; rm centos-6-x86-pygrub-sda-latest.tar.gz; wget http://download.hypervm-ng.org/download/xentemplates/base/centos-6-x86-pygrub-sda-latest.tar.gz");
system("rm /home/hypervm/xen/template/index.html* 2>/dev/null");
system("rm /home/hypervm/xen/template/robots.txt* 2>/dev/null");
}
}
print "Check for old critical database password bug\n";
if (critical_change_db_pass()) {
print "- Fixed critical database password bug!!!\n";
} else {
print "- Good! Already bug free :-)\n";
//.........这里部分代码省略.........
示例10: createExtraVariables
function createExtraVariables()
{
global $gbl, $sgbl, $login, $ghtml;
$gen = $login->getObject('general');
$kloxo = $gen->kloxoconfig_b;
$gen = $gen->generalmisc_b;
if ($gen->xeninitrd_flag === 'off') {
$this->__var_xeninitrd_flag = 'off';
} else {
$this->__var_xeninitrd_flag = 'on';
}
if ($this->dbaction === 'add' || ($this->subaction === 'reboot' || $this->subaction === 'boot' || $this->subaction === 'rebuild')) {
if ($this->isOn('rootpassword_changed')) {
$this->rootpassword_changed = 'off';
$this->__var_rootpassword_changed = 'on';
}
}
$this->__var_kloxo_remote_i_flag = $kloxo->remoteinstall_flag;
$this->__var_kloxo_iapp_url = $kloxo->installapp_url;
$this->__var_tmp_base_dir = db_get_value("pserver", $this->syncserver, "tmpdir");
if (!$this->__var_tmp_base_dir) {
$this->__var_tmp_base_dir = "/tmp";
}
$sq = new Sqlite(null, 'vps');
$winip = null;
if ($this->isWindows()) {
$res = $sq->getRowsWhere("syncserver = '{$this->syncserver}' AND ostemplate LIKE 'windows%'", array('nname', 'hostname', 'coma_vmipaddress_a', 'macaddress', "networkgateway", "networknetmask", "nameserver"));
if ($res) {
foreach ($res as $r) {
foreach ($r as $k => $v) {
if ($k === 'coma_vmipaddress_a') {
$value['iplist'] = explode(",", $r['coma_vmipaddress_a']);
} else {
$value[$k] = $r[$k];
}
}
$winip[] = $value;
}
}
}
$this->__var_win_iplist = $winip;
if ($this->isXen()) {
return;
}
$res = $sq->getRowsWhere("syncserver = '{$this->syncserver}' AND priv_q_uplink_usage != 'Unlimited'", array('nname', 'vpsid', 'coma_vmipaddress_a', 'priv_q_uplink_usage'));
$return = null;
if ($res) {
foreach ($res as $r) {
$value['vpsid'] = $r['vpsid'];
$value['nname'] = $r['nname'];
if ($r['coma_vmipaddress_a']) {
$value['ipaddress'] = explode(",", $r['coma_vmipaddress_a']);
} else {
$value['ipaddress'] = null;
}
$value['uplink_usage'] = $r['priv_q_uplink_usage'];
$return[] = $value;
}
}
$this->__var_uplink_list = $return;
}
示例11: while
while ($a = db_fetch_assoc($r)) {
print "\t\t<item>\n";
$title = $a["discussion_subject"];
print "\t\t\t<title>" . htmlspecialchars(urldecode($title), ENT_QUOTES, 'utf-8') . "</title>\n";
$storylink = "&story=" . $story_id . "&detail=" . $story_id . "#" . $a["discussion_id"];
$storylink = $storylink = htmlspecialchars($storylink, ENT_QUOTES);
$discusslink = $a["discussion_id"];
print "\t\t\t<link>" . $link . $sectionlink . $pagelink . $storylink . "</link>\n";
print "\t\t\t<guid isPermaLink=\"true\">" . $link . $sectionlink . $pagelink . $storylink . "</guid>\n";
print "\t\t\t<pubDate>";
print date("D, j M Y G:i:s O", strtotime(timestamp2usdate($a["discussion_tstamp"])));
print "</pubDate>\n";
print "\t\t\t<author>";
print $a["user_fname"];
$user_uname = $a["user_uname"];
$user_email = db_get_value("user", "user_email", "user_uname='" . addslashes($user_uname) . "'");
print " " . $user_email . "";
print "</author>\n";
print "\t\t\t<comments>";
print $link . $sectionlink . $pagelink . $storylink;
print "</comments>\n";
$description = $a["discussion_content"];
$description = convertTagsToInteralLinks($_REQUEST[site], $description);
$description = str_replace("\n", "", $description);
$description = str_replace("\r", "", $description);
$description = htmlspecialchars(urldecode($description), ENT_QUOTES, 'utf-8');
print "<description>";
print $description;
print "</description>\n";
//if ($a["FK_media"]) {
$b = db_get_line("media INNER JOIN slot ON media.FK_site=slot.FK_site", "media_id='" . addslashes($a["FK_media"]) . "'");
示例12: save_admin_email
function save_admin_email()
{
$a = null;
$email = db_get_value("client", "admin", "contactemail");
$a['admin']['contactemail'] = $email;
slave_save_db("contactemail", $a);
}
示例13: db_get_line
font-size: 10px;
}
</style>
<?php
print $content;
$sa = db_get_line("sites", "name='" . addslashes($site) . "'");
$sections = decode_array($sa['sections']);
$nl = '';
if (!$user) {
$user = $_SESSION['auser'];
} else {
$nl = 'disabled';
}
$site_owner = db_get_value("sites", "addedby", "name='" . addslashes($site) . "'");
if ($_SESSION['auser'] == $site_owner) {
// print $sa[editors]; // Debug
$editors = explode(",", $sa[editors]);
$total_columns = count($editors) * 3 + 1;
print "<table cellspacing='1' width='100%'>";
print "<tr>";
print "<td colspan='{$total_columns}' style='font-variant: small-caps'>";
print "Editor permissions for <b>{$sa['title']}</b>";
print "</td>";
print "</tr>";
print "<tr>";
print "<th> </th>";
foreach ($editors as $editor) {
print "<th colspan='3' style='border-left: 2px solid #fff;'>{$editor}</th>";
}
示例14: error
if (!ereg("^[a-zA-Z]{1,}\$", $_REQUEST['department'])) {
error("You must enter a department. Only charactors \"a-z\" and \"A-Z\" are allowed.");
}
if (!ereg("^[0-9]{1,}\$", $_REQUEST['number'])) {
error("You must enter a numeric number.");
}
if (!ereg("^[a-zA-Z0-9]{0,}\$", $_REQUEST['section'])) {
error("Your course section must be letters \"a-z\" and \"A-Z\" only");
}
if (!array_key_exists($_REQUEST['semester'], $cfg['semesters'])) {
error("You must enter a semester.");
}
if (!ereg("^[0-9]{4}\$", $_REQUEST['year'])) {
error("You must enter a valid 4-digit year.");
}
$owner_id = db_get_value("user", "user_id", "user_uname='" . addslashes($_REQUEST['owner']) . "'");
if (!$owner_id) {
error("The class owner you selected is not a register Segue user.");
}
if (!$error) {
$obj =& new course();
$obj->fetchCourseID($_REQUEST['id']);
$obj->external_id = $_REQUEST['external_id'];
$obj->department = $_REQUEST['department'];
$obj->number = $_REQUEST['number'];
$obj->section = $_REQUEST['section'];
$obj->semester = $_REQUEST['semester'];
$obj->year = $_REQUEST['year'];
$obj->name = $_REQUEST['name'];
$obj->owner = $owner_id;
// $obj->ugroup = $ugroup_id;
示例15: link_log
print "<div class='error'>You must be logged into Segue to use this link...</div>";
print "</body</html>";
link_log($auth_id, 0, $category = "errors", $description = "No Segue user authenticated");
exit;
}
/******************************************************************************
* Make sure a slot name is passed
******************************************************************************/
if (!isset($_REQUEST[site]) || !$_REQUEST[site]) {
print "<div class='error'>No Segue site name or id passed...</div>";
print "</body</html>";
link_log($_SESSION[aid], 0, $category = "errors", $description = "No Segue site id passed");
exit;
} else {
$site_slot = $_REQUEST[site];
$segue_site_id = db_get_value("slot", "FK_site", "slot_name='" . addslashes($site_slot) . "'");
$node_id = $_REQUEST[node];
}
print "</div>";
//exit;
/******************************************************************************
* Get Segue user information from Segue session array
******************************************************************************/
$segue_user_id = $_SESSION[aid];
$username = $_SESSION[auser];
$useremail = $_SESSION[aemail];
$userfname = $_SESSION[afname];
$names = split(" ", $userfname);
preg_match('/^(.*)\\s([^\\s]+)$/', $userfname, $matches);
$firstname = trim($matches[1]);
$lastname = trim($matches[2]);