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


PHP mysql::process_str方法代码示例

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


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

示例1: mysql

<?php

/**
 * Created by PhpStorm.
 * User: wb.dengxiaohui
 * Date: 2016/3/31
 * Time: 15:20
 */
require_once 'mysql.php';
$db = new mysql("localhost", "root", "asd123", "website");
$salt = "abc123";
$login_username = $db->process_str($_POST["login_username"]);
$login_password = md5($db->process_str($_POST["login_password"]) . $salt);
if ($db) {
    $conn = $db->connect_mysql();
    if ($conn) {
        $sql_login_select = "SELECT password From user WHERE username = '{$login_username}'";
        $select_login_result = $db->query($conn, $sql_login_select);
        $login_row = mysqli_fetch_array($select_login_result, MYSQLI_ASSOC);
        if ($login_row["password"] == $login_password) {
            $lifeTime = 24 * 3600;
            session_set_cookie_params($lifeTime);
            session_start();
            $_SESSION["state"] = 1;
            $_SESSION["username"] = $login_username;
            setcookie(session_name(), session_id(), time() + $lifeTime, "/");
            mysqli_free_result($select_login_result);
            $db->close_db($conn);
            echo "1";
        } else {
            mysqli_free_result($select_login_result);
开发者ID:icenewman,项目名称:project,代码行数:31,代码来源:login.php

示例2: mysql

<?php

/**
 * Created by PhpStorm.
 * User: trinity
 * Date: 2016/2/28
 * Time: 23:03
 */
require_once 'mysql.php';
/**创建数据库类 **/
$db = new mysql("localhost", "root", "asd123", "website");
/**处理Post数据安全 **/
$salt = "abc123";
$register_username = $db->process_str($_POST["register_username"]);
$register_password = md5($db->process_str($_POST["register_password"]) . $salt);
$register_email = $db->process_str($_POST["register_email"]);
$register_time = $_SERVER['REQUEST_TIME'];
/**开始注册逻辑 **/
if ($db) {
    $conn = $db->connect_mysql();
    if ($conn) {
        $sql_rigister_select = "SELECT * From user WHERE username = '{$register_username}'";
        $select_rigister_result = $db->query($conn, $sql_rigister_select);
        $row = mysqli_fetch_array($select_rigister_result, MYSQLI_ASSOC);
        if (!$row) {
            $sql_insert = "INSERT INTO  user(username,password,register_time,email) VALUES('{$register_username}','{$register_password}','{$register_time}','{$register_email}')";
            if ($db->query($conn, $sql_insert)) {
                $db->close_db($conn);
                mysqli_free_result($select_rigister_result);
                echo "1";
            }
开发者ID:icenewman,项目名称:project,代码行数:31,代码来源:register.php

示例3: mysql

<?php

/**
 * Created by PhpStorm.
 * User: wb.dengxiaohui
 * Date: 2016/4/8
 * Time: 16:42
 */
require_once 'mysql.php';
/**创建数据库类 **/
$db = new mysql("localhost", "root", "asd123", "website");
/**处理Post数据安全 **/
$register_username = $db->process_str($_POST["register_username"]);
if ($db) {
    $conn = $db->connect_mysql();
    if ($conn) {
        $sql_rigister_select = "SELECT * From user WHERE username = '{$register_username}'";
        $select_rigister_result = $db->query($conn, $sql_rigister_select);
        $row = mysqli_fetch_array($select_rigister_result, MYSQLI_ASSOC);
        if (!$row) {
            $db->close_db($conn);
            mysqli_free_result($select_rigister_result);
            echo 1;
        } else {
            $db->close_db($conn);
            mysqli_free_result($select_rigister_result);
            echo 0;
        }
    }
}
开发者ID:icenewman,项目名称:project,代码行数:30,代码来源:check_username.php


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