当前位置: 首页>>代码示例>>PHP>>正文


PHP sql_db::query方法代码示例

本文整理汇总了PHP中sql_db::query方法的典型用法代码示例。如果您正苦于以下问题:PHP sql_db::query方法的具体用法?PHP sql_db::query怎么用?PHP sql_db::query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sql_db的用法示例。


在下文中一共展示了sql_db::query方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: time

 }
 if (!isset($_POST['currency'])) {
     $errors[] = 'currency';
 }
 if (count($errors) > 0) {
     if ($is_ajax) {
         echo json_encode($errors);
         die;
     } else {
         include "form.php";
         exit;
     }
 }
 $db = new sql_db(DB_HOST, DB_USER, DB_PASS, DB_NAME);
 $created = time();
 $db->query("INSERT INTO members_changes SET\n\t\t\t\t            m_created = " . $created . ",\n\t\t\t\t            m_type = 'add',\n\t\t\t\t            m_state = 'awaiting',\n\t\t\t\t            m_nick = '" . $db->check($_POST["nick"]) . "',\n\t\t\t\t            m_name = '" . $db->check($_POST["name"] . " " . $_POST["surname"]) . "',\n\t\t\t\t            m_mail = '" . $db->check($_POST["email"]) . "',\n\t\t\t\t            m_address = '" . $db->check($_POST["address"] . ", " . $_POST["zip"] . " " . $_POST["city"] . ", " . $_POST["country"]) . "',\n\t\t\t\t            m_year = '" . $db->check($_POST["birth"]) . "',\n\t\t\t\t            m_jabber = '',\n\t\t\t\t            m_how = '" . $db->check($_POST["how"]) . "',\n\t\t\t\t            m_note = '" . $db->check($_POST["note"]) . "',\n\t\t\t\t            m_distribution = '" . $db->check($_POST["distribution"]) . "',\n\t\t\t\t            m_location = '" . $db->check($_POST["location"]) . "',\n\t\t\t\t            m_currency = '" . $db->check($_POST["currency"]) . "',\n\t\t\t\t            m_reason = '',\n\t\t\t\t            m_addr = '" . $db->check($_SERVER["REMOTE_ADDR"]) . "',\n\t\t\t\t            m_addr_reverse = '" . $db->check(gethostbyaddr($_SERVER["REMOTE_ADDR"])) . "',\n\t\t\t\t            m_last_mail_id = 1\n\t\t\t\t            ");
 $request_id = $db->insert_id();
 // Mail admins
 $admins = explode(",", cfg_get("mailer_requests_sendto"));
 $subject = cfg_get("mailer_requests_admin_sub");
 $text = cfg_get("mailer_requests_admin_text");
 $subject = str_replace("%request_id%", $request_id, $subject);
 $subject = str_replace("%type%", "add", $subject);
 $subject = str_replace("%state%", "awaiting", $subject);
 $subject = str_replace("%member_id%", "-", $subject);
 $subject = str_replace("%member%", "-", $subject);
 $subject = str_replace("%name%", $_POST["name"] . " " . $_POST["surname"], $subject);
 $text = str_replace("%created%", strftime("%Y-%m-%d %H:%M", $created), $text);
 $text = str_replace("%changed_at%", "-", $text);
 $text = str_replace("%request_id%", $request_id, $text);
 $text = str_replace("%type%", "add", $text);
开发者ID:Jakuje,项目名称:www.vpsfree.cz,代码行数:31,代码来源:prihlaska.php

示例2:

while ($tpl = $db->findByColumn("cfg_templates", "templ_supported", "1", "templ_order, templ_label")) {
    echo '<option value="' . $tpl["templ_id"] . '">' . $tpl["templ_label"] . '</option>';
}
?>
		 	 </select>

			 <span>Preferovaná lokace pro VPS:</span>
			 <select name="location" id="location">
				<?php 
$sql = 'SELECT location_id, location_label
						FROM locations l
						INNER JOIN servers s ON l.location_id = s.server_location
						WHERE s.environment_id = ' . $db->check(ENVIRONMENT_ID) . '
						GROUP BY location_id
						ORDER BY location_id';
$rs = $db->query($sql);
while ($loc = $db->fetch_array($rs)) {
    echo '<option value="' . $loc["location_id"] . '">Master Internet ' . $loc["location_label"] . '</option>';
}
?>
			 </select>
			 <span>Měna platby:</span>
			 <select name="currency" id="currency">
 			   <option value="CZK">členský poplatek 900&nbsp;Kč na tři měsíce</option>
 			   <option value="EUR">členský poplatek 36&nbsp;eur na tři měsíce</option>			 
			 </select>
			 
			 <input type="submit" name="send" id="send" class="largeButton" value="Odeslat" onclick="signup(); return false;">
			</form>
		</div>
	</section>
开发者ID:jandanielcz,项目名称:www.vpsfree.cz,代码行数:31,代码来源:index.php

示例3: strftime

include WWW_ROOT . 'lib/members.lib.php';
include WWW_ROOT . 'lib/networking.lib.php';
include WWW_ROOT . 'lib/version.lib.php';
include WWW_ROOT . 'lib/cluster.lib.php';
include WWW_ROOT . 'lib/mail.lib.php';
$db = new sql_db(DB_HOST, DB_USER, DB_PASS, DB_NAME);
$whereCond = "m_mailer_enable = 1 AND m_state != 'deleted'";
while ($m = $db->find("members", $whereCond)) {
    $member = member_load($m["m_id"]);
    if ($member->m["m_paid_until"] - time() <= 604800) {
        $subject = $cluster_cfg->get("mailer_tpl_payment_warning_subj");
        $subject = str_replace("%member%", $m["m_nick"], $subject);
        $content = $cluster_cfg->get("mailer_tpl_payment_warning");
        $content = str_replace("%member%", $m["m_nick"], $content);
        $content = str_replace("%memberid%", $m["m_id"], $content);
        $content = str_replace("%expiredate%", $m["m_paid_until"] ? strftime("%Y-%m-%d", $m["m_paid_until"]) : '---', $content);
        $content = str_replace("%monthly%", $m["m_monthly_payment"], $content);
        send_mail($m["m_mail"], $subject, $content, $cluster_cfg->get("mailer_admins_in_cc") ? explode(",", $cluster_cfg->get("mailer_admins_cc_mails")) : array());
    }
}
$rs = $db->query("SELECT v.vps_id, vps_expiration, m_nick, m_mail FROM vps v\n                  INNER JOIN members m ON v.m_id = m.m_id\n                  WHERE m_mailer_enable = 1\n                    AND vps_expiration IS NOT NULL\n                    AND vps_deleted IS NULL\n                    AND DATE_SUB(FROM_UNIXTIME(vps_expiration), INTERVAL 7 DAY) < NOW()\n                    AND FROM_UNIXTIME(vps_expiration) > NOW()");
while ($row = $db->fetch_array($rs)) {
    $subject = $cluster_cfg->get("mailer_tpl_vps_expiration_subj");
    $subject = str_replace("%member%", $row["m_nick"], $subject);
    $subject = str_replace("%vpsid%", $row["vps_id"], $subject);
    $content = $cluster_cfg->get("mailer_tpl_vps_expiration");
    $content = str_replace("%member%", $row["m_nick"], $content);
    $content = str_replace("%vpsid%", $row["vps_id"], $content);
    $content = str_replace("%datetime%", strftime("%Y-%m-%d %H:%M", $row["vps_expiration"]), $content);
    send_mail($row["m_mail"], $subject, $content);
}
开发者ID:whedro,项目名称:vpsadmin,代码行数:31,代码来源:cron_mailer.php

示例4: NOW

define('DEMO_MODE', false);
// Include libraries
include WWW_ROOT . 'lib/db.lib.php';
include WWW_ROOT . 'lib/functions.lib.php';
include WWW_ROOT . 'lib/transact.lib.php';
include WWW_ROOT . 'lib/vps.lib.php';
include WWW_ROOT . 'lib/members.lib.php';
include WWW_ROOT . 'lib/networking.lib.php';
include WWW_ROOT . 'lib/version.lib.php';
include WWW_ROOT . 'lib/cluster.lib.php';
include WWW_ROOT . 'lib/nas.lib.php';
include WWW_ROOT . 'lib/mail.lib.php';
$db = new sql_db(DB_HOST, DB_USER, DB_PASS, DB_NAME);
// First delete members
$member_timeout = $cluster_cfg->get("general_member_delete_timeout") * 24 * 60 * 60;
$rs = $db->query("SELECT m_id FROM members WHERE m_state = 'deleted' AND m_deleted < " . $db->check(time() - $member_timeout));
while ($row = $db->fetch_array($rs)) {
    $m = new member_load($row["m_id"]);
    $m->delete_all_vpses(false);
    $m->destroy(false);
}
// Mark expired VPSes for lazy deletion
$rs = $db->query("SELECT vps_id FROM vps WHERE vps_expiration IS NOT NULL AND vps_deleted IS NULL AND FROM_UNIXTIME(vps_expiration) < NOW()");
while ($row = $db->fetch_array($rs)) {
    $vps = new vps_load($row["vps_id"]);
    $vps->stop();
    $vps->destroy(true);
}
// Delete lazy deleted VPSes
$vps_timeout = $cluster_cfg->get("general_vps_delete_timeout") * 24 * 60 * 60;
$rs = $db->query("SELECT vps_id FROM vps WHERE vps_deleted IS NOT NULL AND vps_deleted > 0 AND vps_deleted < " . $db->check(time() - $vps_timeout));
开发者ID:whedro,项目名称:vpsadmin,代码行数:31,代码来源:cron_delete.php

示例5: sprintf

     $error = sprintf($lang_module['account_deny_name'], '<strong>' . $array_data['nv_login'] . '</strong>');
 } elseif (!empty($check_email)) {
     $error = $check_email;
 } elseif (!empty($check_pass)) {
     $error = $check_pass;
 } elseif ($array_data['nv_password'] != $array_data['re_password']) {
     $error = sprintf($lang_global['passwordsincorrect'], $array_data['nv_password'], $array_data['re_password']);
 } elseif (empty($array_data['question'])) {
     $error = $lang_module['your_question_empty'];
 } elseif (empty($array_data['answer_question'])) {
     $error = $lang_module['answer_empty'];
 } elseif (empty($error)) {
     $password = $crypt->hash_password($array_data['nv_password'], $global_config['hashprefix']);
     define('NV_CONFIG_GLOBALTABLE', $db_config['prefix'] . '_config');
     $userid = 1;
     $db->query('TRUNCATE TABLE ' . $db_config['prefix'] . '_users');
     $db->query('TRUNCATE TABLE ' . $db_config['prefix'] . '_authors');
     $sth = $db->prepare("INSERT INTO " . $db_config['prefix'] . "_users\n\t\t\t\t(userid, username, md5username, password, email, first_name, last_name, gender, photo, birthday, sig,\tregdate, question, answer, passlostkey, view_mail, remember, in_groups, active, checknum, last_login, last_ip, last_agent, last_openid, idsite)\n\t\t\t\tVALUES(" . $userid . ", :username, :md5username, :password, :email, :first_name, '', '', '', 0, '', " . NV_CURRENTTIME . ", :question, :answer_question, '', 0, 1, '', 1, '', " . NV_CURRENTTIME . ", '', '', '', 0)");
     $sth->bindParam(':username', $array_data['nv_login'], PDO::PARAM_STR);
     $sth->bindValue(':md5username', nv_md5safe($array_data['nv_login']), PDO::PARAM_STR);
     $sth->bindParam(':password', $password, PDO::PARAM_STR);
     $sth->bindParam(':email', $array_data['nv_email'], PDO::PARAM_STR);
     $sth->bindParam(':first_name', $array_data['nv_login'], PDO::PARAM_STR);
     $sth->bindParam(':question', $array_data['question'], PDO::PARAM_STR);
     $sth->bindParam(':answer_question', $array_data['answer_question'], PDO::PARAM_STR);
     $ok1 = $sth->execute();
     $ok2 = $db->exec("INSERT INTO " . $db_config['prefix'] . "_authors (admin_id, editor, lev, files_level, position, addtime, edittime, is_suspend, susp_reason, check_num, last_login, last_ip, last_agent) VALUES(" . $userid . ", 'ckeditor', 1, 'adobe,application,archives,audio,documents,flash,images,real,video|1|1|1', 'Administrator', 0, 0, 0, '', '', 0, '', '')");
     if ($ok1 and $ok2) {
         try {
             $db->query('INSERT INTO ' . $db_config['prefix'] . '_users_info (userid) VALUES (' . $userid . ')');
             $db->query("INSERT INTO " . $db_config['prefix'] . "_groups_users (group_id, userid, data) VALUES(1, " . $userid . ", '0')");
开发者ID:anhtunguyen,项目名称:vietnamguide,代码行数:31,代码来源:index.php

示例6: foreach

}
unset($nv_check_update);
define('PCLZIP_TEMPORARY_DIR', NV_ROOTDIR . '/' . NV_TEMP_DIR . '/');
if (isset($nv_plugin_area[2])) {
    // Kết nối với các plugin Trước khi gọi các module
    foreach ($nv_plugin_area[2] as $_fplugin) {
        include NV_ROOTDIR . '/includes/plugin/' . $_fplugin;
    }
}
$cache_file = NV_LANG_DATA . '_sitemods_' . NV_CACHE_PREFIX . '.cache';
if (($cache = nv_get_cache('modules', $cache_file)) != false) {
    $sys_mods = unserialize($cache);
} else {
    $sys_mods = array();
    try {
        $result = $db->query('SELECT * FROM ' . NV_MODULES_TABLE . ' m LEFT JOIN ' . NV_MODFUNCS_TABLE . ' f ON m.title=f.in_module WHERE m.act = 1 ORDER BY m.weight, f.subweight');
        while ($row = $result->fetch()) {
            $m_title = $row['title'];
            $f_name = $row['func_name'];
            $f_alias = $row['alias'];
            if (!isset($sys_mods[$m_title])) {
                $sys_mods[$m_title] = array('module_file' => $row['module_file'], 'module_data' => $row['module_data'], 'module_upload' => $row['module_upload'], 'custom_title' => $row['custom_title'], 'admin_title' => empty($row['admin_title']) ? $row['custom_title'] : $row['admin_title'], 'admin_file' => $row['admin_file'], 'main_file' => $row['main_file'], 'theme' => $row['theme'], 'mobile' => $row['mobile'], 'description' => $row['description'], 'keywords' => $row['keywords'], 'groups_view' => $row['groups_view'], 'is_modadmin' => false, 'admins' => $row['admins'], 'rss' => $row['rss'], 'gid' => $row['gid'], 'funcs' => array());
            }
            $sys_mods[$m_title]['funcs'][$f_alias] = array('func_id' => $row['func_id'], 'func_name' => $f_name, 'show_func' => $row['show_func'], 'func_custom_name' => $row['func_custom_name'], 'in_submenu' => $row['in_submenu']);
            $sys_mods[$m_title]['alias'][$f_name] = $f_alias;
        }
        $cache = serialize($sys_mods);
        nv_set_cache('modules', $cache_file, $cache);
        unset($cache, $result);
    } catch (PDOException $e) {
        //trigger_error( $e->getMessage() );
开发者ID:anhtunguyen,项目名称:vietnamguide,代码行数:31,代码来源:mainfile.php

示例7: header

include '/etc/vpsadmin/config.php';
session_start();
$_SESSION["is_admin"] = true;
define('CRON_MODE', true);
define('DEMO_MODE', false);
// Include libraries
include WWW_ROOT . 'lib/db.lib.php';
include WWW_ROOT . 'lib/functions.lib.php';
include WWW_ROOT . 'lib/version.lib.php';
include WWW_ROOT . 'lib/cluster.lib.php';
$db = new sql_db(DB_HOST, DB_USER, DB_PASS, DB_NAME);
if ($cluster_cfg->get("maintenance_mode")) {
    echo "MAINTENANCE";
    exit;
}
$rs = $db->query("SELECT server_id, server_name\n                  FROM locations l\n                  INNER JOIN servers s ON l.location_id = s.server_location\n                  WHERE server_maintenance = 0\n                  ORDER BY l.location_id, s.server_id");
$bad = false;
while ($row = $db->fetch_array($rs)) {
    $sql = 'SELECT * FROM servers_status WHERE server_id ="' . $row["server_id"] . '"';
    if ($result = $db->query($sql)) {
        $status = $db->fetch_array($result);
    }
    if (time() - $status["timestamp"] > 150) {
        if (!$bad) {
            $bad = true;
            header('HTTP/1.1 503 Service Unavailable');
        }
        echo $row["server_name"] . "\n";
    }
}
if (!$bad) {
开发者ID:whedro,项目名称:vpsadmin,代码行数:31,代码来源:cluster_status.php


注:本文中的sql_db::query方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。