Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在PHP7.2环境部署遇到的几个小问题 #6

Open
yanhuixie opened this issue Jun 30, 2020 · 1 comment
Open

在PHP7.2环境部署遇到的几个小问题 #6

yanhuixie opened this issue Jun 30, 2020 · 1 comment

Comments

@yanhuixie
Copy link

感谢您开发了这么方便实用的工具。
我试着在php7.2部署,发现几个小问题,我的解决方法也一并附上,供您参考。
1、sys/lib.php 中,mysql_real_escape_string 改为 mysqli_real_escape_string;
2、mysqli_real_escape_string 需要传入DB Connection,此时要用到config.php的$dbc,我把config.php 导入lib.php的include_once改为include,然后在clean_input 函数里加入global $dbc;
3、config.php的$basedir = '/VulDrill' ,我直接把应用部署到根目录,所以改为$basedir = '',不然有些css的路径不一致。

@Creammilky
Copy link

Creammilky commented Jun 12, 2024

我也在PHP7.2中遇到了问题,具体为注册和登录的时候就会报错HTTP500内部错误,的确是因为这个clean_input函数的问题。针对yanhuixie的第二条我给出更具体的解决方案。:

将sys/lib.php中的clean_input函数改为下面这个,就可以解决问题。

function clean_input($dirty){
    global $dbc; // 引入全局变量 $dbc

    if (get_magic_quotes_gpc()) {
        $clean = mysqli_real_escape_string($dbc, stripslashes($dirty));     
    } else {
        $clean = mysqli_real_escape_string($dbc, $dirty);  
    }
    return $clean;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants