本文整理汇总了PHP中Main::db_query方法的典型用法代码示例。如果您正苦于以下问题:PHP Main::db_query方法的具体用法?PHP Main::db_query怎么用?PHP Main::db_query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Main
的用法示例。
在下文中一共展示了Main::db_query方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Mail
if (Main::db_rows($query) == 1) {
$recover_account = Main::db_result($query, 0);
if (Account::recover_check($recover_account)) {
$query = Main::db_query(sprintf($GLOBALS['DBQUERY_CHECK_ACCOUNT'], 'mail_check', 'user', Main::db_escape_string($recover_account, $GLOBALS['DB_LOGIN_SERVER'])), $GLOBALS['DB_LOGIN_SERVER']);
$query2 = Main::db_query(sprintf($GLOBALS['DBQUERY_CHECK_EMAIL'], 'mail_check', 'email', Main::db_escape_string($recover_mail, $GLOBALS['DB_LOGIN_SERVER'])), $GLOBALS['DB_LOGIN_SERVER']);
if (Main::db_rows($query) == 0 && Main::db_rows($query2) == 0) {
$mail = new Mail();
$recover_flood = new AFlood('recover');
if (!$recover_flood->check()) {
$GLOBALS['the_status'] = $GLOBALS['LANG_ERROR_RECOVER_TIME'];
} else {
$recover_id = substr(sha1(base64_encode(rand(10, 999))), 1, 15);
$recover_page = $GLOBALS['CONFIG_WEBSITE_URL'] . '/index.php?page=recover&uname=' . $recover_account;
$recover_link = $recover_page . '&rid=' . $recover_id;
$generated_pass = substr(sha1(base64_encode(rand(10, 999))), 1, 8);
Main::db_query(sprintf($GLOBALS['DBQUERY_MCHECK_CREATE'], Main::db_escape_string($recover_account, $GLOBALS['DB_LOGIN_SERVER']), Main::db_escape_string($recover_mail, $GLOBALS['DB_LOGIN_SERVER']), $generated_pass, Main::db_escape_string(USER_IP, $GLOBALS['DB_LOGIN_SERVER']), $recover_id, time(), null), $GLOBALS['DB_LOGIN_SERVER']);
$mail->Send($recover_mail, $GLOBALS['CONFIG_ADMIN_MAIL'], sprintf($GLOBALS['LANG_RECOVER_MAIL_SUBJECT'], $GLOBALS['CONFIG_WEBSITE_NAME']), sprintf($GLOBALS['LANG_RECOVER_MAIL'], $recover_account, $recover_link, $recover_id, $recover_page, $GLOBALS['CONFIG_WEBSITE_NAME']));
$GLOBALS['the_status'] = sprintf($GLOBALS['LANG_RECOVER_ACTIVATE'], $recover_mail);
}
} else {
$GLOBALS['the_status'] = $GLOBALS['LANG_ERROR_MAIL'];
}
}
} else {
$GLOBALS['the_status'] = $GLOBALS['LANG_ERROR_MAIL'];
}
}
} else {
$template_vars['val_user'] = isset($_POST['login_username']) ? $_POST['login_username'] : '';
$template_vars['val_pass'] = isset($_POST['login_password']) ? $_POST['login_password'] : '';
$template_vars['val_remember'] = isset($_POST['login_remember']) ? 'checked="checked" ' : '';
示例2: htmlspecialchars
if (isset($_GET['uname']) && isset($_GET['rid'])) {
$rec_user = htmlspecialchars(trim($_GET['uname']));
$rec_rid = htmlspecialchars(trim($_GET['rid']));
if ($acc->validate_user($rec_user) && $acc->validate_code($rec_rid)) {
if (Account::recover_check($rec_user)) {
$query = Main::db_query(sprintf($GLOBALS['DBQUERY_MCHECK_CHECK'], Main::db_escape_string($rec_user, $GLOBALS['DB_LOGIN_SERVER']), Main::db_escape_string($rec_rid, $GLOBALS['DB_LOGIN_SERVER']), Main::db_escape_string(USER_IP, $GLOBALS['DB_LOGIN_SERVER'])), $GLOBALS['DB_LOGIN_SERVER']);
if (Main::db_rows($query) == 1) {
$query = Main::db_query(sprintf($GLOBALS['DBQUERY_MCHECK_DATA'], Main::db_escape_string($rec_user, $GLOBALS['DB_LOGIN_SERVER']), Main::db_escape_string($rec_rid, $GLOBALS['DB_LOGIN_SERVER']), Main::db_escape_string(USER_IP, $GLOBALS['DB_LOGIN_SERVER'])), $GLOBALS['DB_LOGIN_SERVER']);
$data = Main::db_fetch_row($query);
$new_pass = @Main::encrypt($data[2]);
if ($GLOBALS['CONFIG_SERVER_TYPE'] == 1) {
Main::db_query(sprintf($GLOBALS['DBQUERY_CHANGE_PASSWORD'], $GLOBALS['DBSTRUCT_L2OFF_USERAUT_TABLE'], $GLOBALS['DBSTRUCT_L2OFF_USERAUT_PASS'], 'CONVERT(binary, ' . $new_pass . ')', $GLOBALS['DBSTRUCT_L2OFF_USERAUT_ACCOUNT'], Main::db_escape_string($rec_user, $GLOBALS['DB_LOGIN_SERVER'])), $GLOBALS['DB_LOGIN_SERVER']);
} else {
Main::db_query(sprintf($GLOBALS['DBQUERY_CHANGE_PASSWORD'], $GLOBALS['DBSTRUCT_L2J_ACCOUNTS_TABLE'], $GLOBALS['DBSTRUCT_L2J_ACCOUNTS_PASS'], '\'' . $new_pass . '\'', $GLOBALS['DBSTRUCT_L2J_ACCOUNTS_NAME'], Main::db_escape_string($rec_user, $GLOBALS['DB_LOGIN_SERVER'])), $GLOBALS['DB_LOGIN_SERVER']);
}
Main::db_query(sprintf($GLOBALS['DBQUERY_MCHECK_DELETE'], Main::db_escape_string($rec_user, $GLOBALS['DB_LOGIN_SERVER'])), $GLOBALS['DB_LOGIN_SERVER']);
$mail = new Mail();
$mail->Send($data[1], $GLOBALS['CONFIG_ADMIN_MAIL'], sprintf($GLOBALS['LANG_RECOVER_PASS_MAIL_SUBJECT'], $GLOBALS['CONFIG_WEBSITE_NAME']), sprintf($GLOBALS['LANG_RECOVER_PASS_MAIL'], $data[0], $data[2], $GLOBALS['CONFIG_WEBSITE_NAME']));
$GLOBALS['the_status'] = $GLOBALS['LANG_RECOVER_SUCCEDED'];
} else {
$GLOBALS['the_status'] = $GLOBALS['LANG_ERROR_ACT_SESSION'];
}
} else {
$GLOBALS['the_status'] = $GLOBALS['LANG_ERROR_ACT_EXPIRED'];
}
}
}
$template_vars['status'] = $GLOBALS['the_status'];
} else {
$template_vars['the_error'] = $GLOBALS['LANG_PAGE_RESTRICTED'];
$template_location[] = 'errors.html';
示例3: check_step
function check_step($step, &$vars, &$step_vars, &$errors_list, &$done_list)
{
if ($step == 1) {
$vars['active_agree'] = 'active';
} elseif ($step == 2) {
$vars['active_data'] = 'active';
$step_vars['val_h_gs'] = $GLOBALS['CONFIG_MYSQL_HOST_GS'];
$step_vars['val_h_ls'] = $GLOBALS['CONFIG_MYSQL_HOST_LS'];
$step_vars['val_u_gs'] = $GLOBALS['CONFIG_MYSQL_USER_GS'];
$step_vars['val_u_ls'] = $GLOBALS['CONFIG_MYSQL_USER_LS'];
$step_vars['val_d_gs'] = $GLOBALS['CONFIG_MYSQL_NAME_GS'];
$step_vars['val_d_ls'] = $GLOBALS['CONFIG_MYSQL_NAME_LS'];
if (isset($_POST['hostname_gs']) && isset($_POST['hostname_ls']) && isset($_POST['hostname_forum']) && isset($_POST['user_gs']) && isset($_POST['user_ls']) && isset($_POST['user_forum']) && isset($_POST['pass_gs']) && isset($_POST['pass_ls']) && isset($_POST['pass_forum']) && isset($_POST['data_gs']) && isset($_POST['data_ls']) && isset($_POST['data_forum'])) {
$host_gs = $step_vars['val_h_gs'] = htmlspecialchars($_POST['hostname_gs']);
$host_ls = $step_vars['val_h_ls'] = htmlspecialchars($_POST['hostname_ls']);
$host_forum = htmlspecialchars($_POST['hostname_forum']);
$user_gs = $step_vars['val_u_gs'] = htmlspecialchars($_POST['user_gs']);
$user_ls = $step_vars['val_u_ls'] = htmlspecialchars($_POST['user_ls']);
$user_forum = htmlspecialchars($_POST['user_forum']);
$pass_gs = htmlspecialchars($_POST['pass_gs']);
$pass_ls = htmlspecialchars($_POST['pass_ls']);
$pass_forum = htmlspecialchars($_POST['pass_forum']);
$data_gs = $step_vars['val_d_gs'] = htmlspecialchars($_POST['data_gs']);
$data_ls = $step_vars['val_d_ls'] = htmlspecialchars($_POST['data_ls']);
$data_forum = htmlspecialchars($_POST['data_forum']);
$gs_check = 0;
$ls_check = 0;
if (function_exists('sqlsrv_connect') && function_exists('sqlsrv_close')) {
if (sqlsrv_connect($host_gs, array('Database' => $data_gs, 'UID' => $user_gs, 'PWD' => $pass_gs))) {
$gs_check = 1;
}
if (sqlsrv_connect($host_ls, array('Database' => $data_ls, 'UID' => $user_ls, 'PWD' => $pass_ls))) {
$ls_check = 1;
}
@sqlsrv_close();
} elseif (function_exists('mssql_connect') && function_exists('mssql_select_db') && function_exists('mssql_close')) {
if (@mssql_connect($host_gs, $user_gs, $pass_gs) && @mssql_select_db($data_gs)) {
$gs_check = 1;
}
if (@mssql_connect($host_ls, $user_ls, $pass_ls) && @mssql_select_db($data_ls)) {
$ls_check = 1;
}
@mssql_close();
}
if ($gs_check == 1 && $ls_check == 1) {
$server_type = 1;
} else {
if (function_exists('mysql_connect') && function_exists('mysql_select_db') && function_exists('mysql_close')) {
if (@mysql_connect($host_gs, $user_gs, $pass_gs) && @mysql_select_db($data_gs)) {
$gs_check = 1;
}
if (@mysql_connect($host_ls, $user_ls, $pass_ls) && @mysql_select_db($data_ls)) {
$ls_check = 1;
}
}
if ($gs_check == 1 && $ls_check == 1) {
$server_type = 2;
}
@mysql_close();
}
if (!isset($server_type)) {
$errors_list .= 'Can\'t establish a connection with those details!';
} else {
$dbt = $server_type == 1 ? 'MSSQL' : 'MYSQL';
if (Configs::update_configs(array('CONFIG_SERVER_TYPE' => '\'' . $server_type . '\''), 'main') && Configs::update_configs(array('CONFIG_' . $dbt . '_HOST_GS' => '\'' . $host_gs . '\'', 'CONFIG_' . $dbt . '_HOST_LS' => '\'' . $host_ls . '\'', 'CONFIG_' . $dbt . '_USER_GS' => '\'' . $user_gs . '\'', 'CONFIG_' . $dbt . '_USER_LS' => '\'' . $user_ls . '\'', 'CONFIG_' . $dbt . '_PASS_GS' => '\'' . $pass_gs . '\'', 'CONFIG_' . $dbt . '_PASS_LS' => '\'' . $pass_ls . '\'', 'CONFIG_' . $dbt . '_NAME_GS' => '\'' . $data_gs . '\'', 'CONFIG_' . $dbt . '_NAME_LS' => '\'' . $data_ls . '\''), 'connection')) {
++$_SESSION['DE_INSTALL_STEP'];
$done_list .= 'Database Configuration step completed!';
} else {
$errors_list .= 'Error while updating configs.Please report it on forum: <a style="color:#181818;" href="http://dragoneyecms.com">www.dragoneyecms.com</a>';
}
}
}
} elseif ($step == 3) {
if (isset($_GET['q']) && isset($_GET['r']) && isset($_GET['p'])) {
if ($GLOBALS['CONFIG_SERVER_TYPE'] == 1) {
if ($GLOBALS['CONFIG_USE_SQLSRV'] && extension_loaded('sqlsrv')) {
$GLOBALS['DB_GAME_SERVER_LINK'] = sqlsrv_connect($GLOBALS['CONFIG_MSSQL_HOST_GS'], array('Database' => $GLOBALS['CONFIG_MSSQL_NAME_GS'], 'UID' => $GLOBALS['CONFIG_MSSQL_USER_GS'], 'PWD' => $GLOBALS['CONFIG_MSSQL_PASS_GS']));
$GLOBALS['DB_LOGIN_SERVER_LINK'] = sqlsrv_connect($GLOBALS['CONFIG_MSSQL_HOST_LS'], array('Database' => $GLOBALS['CONFIG_MSSQL_NAME_LS'], 'UID' => $GLOBALS['CONFIG_MSSQL_USER_LS'], 'PWD' => $GLOBALS['CONFIG_MSSQL_PASS_LS']));
} else {
$GLOBALS['DB_GAME_SERVER_LINK'] = @mssql_pconnect($GLOBALS['CONFIG_MSSQL_HOST_GS'], $GLOBALS['CONFIG_MSSQL_USER_GS'], $GLOBALS['CONFIG_MSSQL_PASS_GS']);
$GLOBALS['DB_LOGIN_SERVER_LINK'] = @mssql_pconnect($GLOBALS['CONFIG_MSSQL_HOST_LS'], $GLOBALS['CONFIG_MSSQL_USER_LS'], $GLOBALS['CONFIG_MSSQL_PASS_LS']);
@mssql_select_db($GLOBALS['CONFIG_MSSQL_NAME_GS'], $GLOBALS['DB_GAME_SERVER_LINK']);
$GLOBALS['CURRENT_DB_P'] = 'S';
$GLOBALS['CURRENT_DB'] = '1';
}
$link = $_GET['p'] == 1 ? 1 : 2;
if ($_GET['r'] == '0') {
if (Main::db_result(Main::db_query(sprintf('IF OBJECT_ID (N\'%s\', N\'U\') IS NOT NULL SELECT 1 AS result ELSE SELECT 0 AS result', $_GET['q']), $link), 0) == 1) {
exit('1');
}
} else {
$qry = Main::db_query(sprintf('SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.Columns WHERE TABLE_NAME = \'%s\'', $_GET['r']), $link);
while ($row = Main::db_fetch_row($qry)) {
if ($row[0] == $_GET['q']) {
exit('1');
}
}
}
if ($GLOBALS['CONFIG_USE_SQLSRV'] && extension_loaded('sqlsrv')) {
@sqlsrv_close($GLOBALS['DB_GAME_SERVER_LINK']);
//.........这里部分代码省略.........
示例4: sep_path
$image_cache = sep_path(CMS_DIR . '/cache/account_' . $acc_name . '.png');
if (file_exists($image_cache) && time() - filemtime($image_cache) < $GLOBALS['CONFIG_STATS_ACCOUNT_SIGNATURE_CACHE']) {
header('Content-type: image/png');
imagecreatefrompng($image_cache);
imagepng(imagecreatefrompng($image_cache));
} else {
if ($GLOBALS['CONFIG_SERVER_TYPE'] == 1) {
$query = Main::db_query(sprintf($GLOBALS['DBQUERY_1_1'], $GLOBALS['DBSTRUCT_L2OFF_USERACC_SIGNATURE'], $GLOBALS['DBSTRUCT_L2OFF_USERACC_TABLE'], $GLOBALS['DBSTRUCT_L2OFF_USERACC_ACCOUNT'], Main::db_escape_string($acc_name, $GLOBALS['DB_LOGIN_SERVER'])), $GLOBALS['DB_LOGIN_SERVER']);
} else {
$query = Main::db_query(sprintf($GLOBALS['DBQUERY_1_1'], $GLOBALS['DBSTRUCT_L2J_ACCOUNTS_SIGNATURE'], $GLOBALS['DBSTRUCT_L2J_ACCOUNTS_TABLE'], $GLOBALS['DBSTRUCT_L2J_ACCOUNTS_NAME'], Main::db_escape_string($acc_name, $GLOBALS['DB_LOGIN_SERVER'])), $GLOBALS['DB_LOGIN_SERVER']);
}
if (Main::db_result($query, 0) == 1 || $this->logged && strcasecmp($acc_name, $acc->account_username) == 0) {
if ($GLOBALS['CONFIG_SERVER_TYPE'] == 1) {
$query = Main::db_query(sprintf($GLOBALS['DBQUERY_SIGNATURE_ACC'], $GLOBALS['DBSTRUCT_L2OFF_USERDAT_ONLINE_TIME'], $GLOBALS['DBSTRUCT_L2OFF_USERDAT_PVP'], $GLOBALS['DBSTRUCT_L2OFF_USERDAT_PK'], $GLOBALS['DBSTRUCT_L2OFF_USERDAT_TABLE'], $GLOBALS['DBSTRUCT_L2OFF_USERDAT_ACC'], Main::db_escape_string($acc_name, $GLOBALS['DB_LOGIN_SERVER'])), $GLOBALS['DB_GAME_SERVER']);
} else {
$query = Main::db_query(sprintf($GLOBALS['DBQUERY_SIGNATURE_ACC'], $GLOBALS['DBSTRUCT_L2J_CHARS_ONLINE_TIME'], $GLOBALS['DBSTRUCT_L2J_CHARS_PVP'], $GLOBALS['DBSTRUCT_L2J_CHARS_PK'], $GLOBALS['DBSTRUCT_L2J_CHARS_TABLE'], $GLOBALS['DBSTRUCT_L2J_CHARS_ACC'], Main::db_escape_string($acc_name, $GLOBALS['DB_LOGIN_SERVER'])), $GLOBALS['DB_LOGIN_SERVER']);
}
$acc_data = Main::db_fetch_row($query);
header('Content-type: image/png');
$image_path = sep_path(CMS_DIR . '/templates/' . Template::used_template() . '/' . $GLOBALS['CONFIG_TEMPLATE_IMAGES'] . '/account_signature.png');
$the_image = imagecreatefrompng($image_path);
$color_1 = imagecolorallocate($the_image, 234, 234, 174);
$color_2 = imagecolorallocate($the_image, 255, 255, 255);
$color_3 = imagecolorallocate($the_image, 151, 162, 120);
$shadow_color = imagecolorallocate($the_image, 0, 0, 0);
$shading_color = imagecolorallocatealpha($the_image, 0, 0, 0, 100);
draw_text($the_image, 17, 15, 23, $color_1, 110, $GLOBALS['CONFIG_WEBSITE_NAME']);
draw_text($the_image, 14, 20, 50, $color_2, 120, $GLOBALS['LANG_USER']);
draw_text($the_image, 10, 65, 65, $color_2, 120, '- ' . $acc_name);
draw_text($the_image, 14, 20, 85, $color_2, 120, $GLOBALS['LANG_ON_TIME']);
draw_text($the_image, 10, 20, 100, $color_2, 120, '- ' . gmstrftime(bcdiv($acc_data[0], 86400) . ' ' . $GLOBALS['LANG_DAYS'] . ' %H ' . $GLOBALS['LANG_HOURS'] . ' %M ' . $GLOBALS['LANG_MINS'], $acc_data[0]));
示例5: elseif
} elseif (isset($_GET['pk']) && $GLOBALS['CONFIG_STATS_TOP_PK_ENABLED']) {
if (!$GLOBALS['CONFIG_STATS_TOP_PK_GUESTS'] && !$this->logged) {
$GLOBALS['the_status'] = $GLOBALS['LANG_PAGE_LOGGED'];
} else {
$stat_page_vars = array();
$the_top_vars = array();
$stat_page_vars['total_results'] = $GLOBALS['CONFIG_STATS_TOP_PK_RESULTS'];
$stat_page_vars['the_top'] = '';
$cache_file = sep_path(CMS_DIR . '/cache/total_pk.txt');
if ($GLOBALS['CONFIG_STATS_TOTAL_PK_CACHE'] && file_exists($cache_file) && time() - filemtime($cache_file) < $GLOBALS['CONFIG_STATS_TOTAL_PK_CACHE']) {
$stat_page_vars['total_pk'] = file_get_contents($cache_file);
} else {
if ($this->server_type == '1') {
$stat_page_vars['total_pk'] = $GLOBALS['CONFIG_STATS_TOTAL_PK_ENABLED'] ? Main::db_result(Main::db_query(sprintf($GLOBALS['DBQUERY_STAT_SUM'], $GLOBALS['DBSTRUCT_L2OFF_USERDAT_PK'], $GLOBALS['DBSTRUCT_L2OFF_USERDAT_TABLE']), $GLOBALS['DB_GAME_SERVER']), 0) : $GLOBALS['LANG_DISABLED'];
} else {
$stat_page_vars['total_pk'] = $GLOBALS['CONFIG_STATS_TOTAL_PK_ENABLED'] ? Main::db_result(Main::db_query(sprintf($GLOBALS['DBQUERY_STAT_SUM'], $GLOBALS['DBSTRUCT_L2J_CHARS_PK'], $GLOBALS['DBSTRUCT_L2J_CHARS_TABLE']), $GLOBALS['DB_GAME_SREVER']), 0) : $GLOBALS['LANG_DISABLED'];
}
if ($GLOBALS['CONFIG_STATS_TOTAL_PK_CACHE']) {
file_put_contents($cache_file, $stat_page_vars['total_pk']);
}
}
@(require_once sep_path(CMS_DIR . '/libraries/paginate.class.inc'));
if ($this->server_type == '1') {
$top_pk_query = sprintf($GLOBALS['DBQUERY_TOP_PK'], $GLOBALS['DBSTRUCT_L2OFF_USERDAT_NAME'], $GLOBALS['DBSTRUCT_L2OFF_USERDAT_PK'], $GLOBALS['DBSTRUCT_L2OFF_USERDAT_LEVEL'], $GLOBALS['DBSTRUCT_L2OFF_USERDAT_TABLE'], $GLOBALS['DBSTRUCT_L2OFF_USERDAT_PK'], '1');
} else {
$top_pk_query = sprintf($GLOBALS['DBQUERY_TOP_PK'], $GLOBALS['DBSTRUCT_L2J_CHARS_NAME'], $GLOBALS['DBSTRUCT_L2J_CHARS_PK'], $GLOBALS['DBSTRUCT_L2J_CHARS_LEVEL'], $GLOBALS['DBSTRUCT_L2J_CHARS_TABLE'], $GLOBALS['DBSTRUCT_L2J_CHARS_PK'], '1');
}
$paginate = new Paginate($top_pk_query, $this->server_type == '1' ? $GLOBALS['DBSTRUCT_L2OFF_USERDAT_PK'] : $GLOBALS['DBSTRUCT_L2J_CHARS_PK'], $GLOBALS['CONFIG_STATS_TOP_PK_ORDER'], $GLOBALS['DB_GAME_SERVER'], $GLOBALS['CONFIG_STATS_TOP_PK_RESULTS'], $GLOBALS['CONFIG_STATS_TOP_PK_RESULTS_PER_PAGE'], $GLOBALS['CONFIG_STATS_TOP_PK_CACHE'], 'top_pk');
$paginate->load();
$results = $paginate->results();
$i = $paginate->offset;