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


PHP Main::db_escape_string方法代码示例

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


在下文中一共展示了Main::db_escape_string方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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" ' : '';
开发者ID:Ziex0,项目名称:L-CMS-old,代码行数:31,代码来源:account.php

示例2: 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]));
开发者ID:Ziex0,项目名称:L-CMS-old,代码行数:31,代码来源:signature.php

示例3: 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';
开发者ID:Ziex0,项目名称:L-CMS-old,代码行数:31,代码来源:recover.php

示例4: array

 $skills_list = array();
 $cache_file = sep_path(CMS_DIR . '/cache/skills_' . $player_name . '.txt');
 if ($GLOBALS['CONFIG_STATS_SKILLS_CACHE'] && file_exists($cache_file) && time() - filemtime($cache_file) < $GLOBALS['CONFIG_STATS_SKILLS_CACHE']) {
     $skills_list = unserialize(file_get_contents($cache_file));
 } else {
     if ($GLOBALS['CONFIG_SERVER_TYPE'] == 1) {
         $cinfo = Main::db_query(sprintf($GLOBALS['DBQUERY_2_1'], $GLOBALS['DBSTRUCT_L2OFF_USERDAT_ID'], $GLOBALS['DBSTRUCT_L2OFF_USERDAT_SUBJOB'], $GLOBALS['DBSTRUCT_L2OFF_USERDAT_TABLE'], $GLOBALS['DBSTRUCT_L2OFF_USERDAT_NAME'], Main::db_escape_string($player_name, $GLOBALS['DB_GAGME_SERVER'])), $GLOBALS['DB_GAME_SERVER']);
     } else {
         $cinfo = Main::db_query(sprintf($GLOBALS['DBQUERY_2_1'], $GLOBALS['DBSTRUCT_L2J_CHARS_ID'], $GLOBALS['DBSTRUCT_L2J_CHARS_CLASS'], $GLOBALS['DBSTRUCT_L2J_CHARS_TABLE'], $GLOBALS['DBSTRUCT_L2J_CHARS_NAME'], Main::db_escape_string($player_name, $GLOBALS['DB_GAME_SERVER'])), $GLOBALS['DB_GAME_SERVER']);
     }
     $char_id = Main::db_result($cinfo, 0);
     $subjob = Main::db_result($cinfo, 1);
     if ($GLOBALS['CONFIG_SERVER_TYPE'] == 1) {
         $skills = Main::db_query(sprintf($GLOBALS['DBQUERY_SKILLS_DATA'], $GLOBALS['DBSTRUCT_L2OFF_SKILLS_ID'], $GLOBALS['DBSTRUCT_L2OFF_SKILLS_LEVEL'], $GLOBALS['DBSTRUCT_L2OFF_SKILLS_TABLE'], $GLOBALS['DBSTRUCT_L2OFF_SKILLS_CID'], Main::db_escape_string($char_id, $GLOBALS['DB_GAME_SERVER']), $GLOBALS['DBSTRUCT_L2OFF_SKILLS_SUBJOB'], Main::db_escape_string($subjob, $GLOBALS['DB_GAME_SERVER'])), $GLOBALS['DB_GAME_SERVER']);
     } else {
         $skills = Main::db_query(sprintf($GLOBALS['DBQUERY_SKILLS_DATA'], $GLOBALS['DBSTRUCT_L2J_SKILLS_ID'], $GLOBALS['DBSTRUCT_L2J_SKILLS_LEVEL'], $GLOBALS['DBSTRUCT_L2J_SKILLS_TABLE'], $GLOBALS['DBSTRUCT_L2J_SKILLS_CID'], Main::db_escape_string($char_id, $GLOBALS['DB_GAME_SERVER']), $GLOBALS['DBSTRUCT_L2J_SKILLS_CLASS'], Main::db_escape_string($subjob, $GLOBALS['DB_GAME_SERVER'])), $GLOBALS['DB_GAME_SERVER']);
     }
     $stat_page_vars['active_skills'] = '';
     $stat_page_vars['passive_skills'] = '';
     while ($row = Main::db_fetch_row($skills)) {
         if (!in_array($row[0], $passive_skills)) {
             if ($GLOBALS['CONFIG_STATS_SKILLS_ACTIVE']) {
                 $skills_list[0][$row[0]] = $row[1];
             }
         } elseif ($GLOBALS['CONFIG_STATS_SKILLS_PASSIVE']) {
             $skills_list[1][$row[0] == '239' ? 238 + $row[1] : $row[0]] = $row[1];
         }
     }
     if ($GLOBALS['CONFIG_STATS_SKILLS_CACHE']) {
         file_put_contents($cache_file, serialize($skills_list));
     }
开发者ID:Ziex0,项目名称:L-CMS-old,代码行数:31,代码来源:statistics.php


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