0

我发现了 AjaXplorer,我想知道是否有分步指南说明如何在我已阅读文件http://ajaxplorer.info/documentation/developer-documentation/chapter-external-bridge/的数据库之间建立链接 但还是觉得太详细了

有没有一步一步的ajax来链接数据库?

4

2 回答 2

2

1:将bootstrap_plugins.php中的auth驱动和conf驱动替换为:

    "CONF_DRIVER" => array(
        "NAME"      => "sql",
        "OPTIONS"   => array(
            "SQL_DRIVER"    => array(
                "driver"    => "mysql",
                "host"      => "db_server",
                "database"  => "db_name",
                "user"      => "db_username",
                "password"  => "db_password",
            ),
            )
),    

"AUTH_DRIVER" => array(
            "NAME"          => "sql",
            //"NAME" => "remote",
            "OPTIONS"       => array(
            "SLAVE_MODE"  => true,  
                "SQL_DRIVER"    => array(
                                        "driver"    => "mysql",
                                        "host"      => "db_server",
                                        "database"  => "db_name",
                                        "user"      => "db_username",
                                        "password"  => "db_password"
                                            ),

                "LOGIN_URL" => "../login.php",  // The URL to redirect to if a non-logged user tries to access AjaXplorer
                "LOGOUT_URL" => "../logout.php",  // The URL to redirect upon login out
                "SECRET" => "ahmed",// the secret key that you will pass to the glueCode when communicating with it (see below)
                "TRANSMIT_CLEAR_PASS"   => false  // Don't touch this. It's unsafe (and useless here) to transmit clear password.
                                        )
                ),

2:这是如果你想通过自己的登录页面登录,你必须在验证用户名和密码后登录页面时添加一个葡萄糖行:

define("AJXP_EXEC", true);
    $glueCode = "ajaxplorer-core-4.0.4/plugins/auth.remote/glueCode.php";
    $secret = "ahmed";

    // Initialize the "parameters holder"
    global $AJXP_GLUE_GLOBALS;
    $AJXP_GLUE_GLOBALS = array();
    $AJXP_GLUE_GLOBALS["secret"] = $secret;
    $AJXP_GLUE_GLOBALS["plugInAction"] = "login";
    $AJXP_GLUE_GLOBALS["autoCreate"] = false;

    // NOTE THE md5() call on the password field.
    $AJXP_GLUE_GLOBALS["login"] = array("name" => $_POST["login"], "password" => md5($_POST["password"]));

    // NOW call glueCode!
    include($glueCode);

这应该有效。

于 2012-09-14T13:52:21.497 回答
1

1) You cannot use bridge with SQL Auth method in AjaxPlorer without heavily modifying the code. 2) The above example is incorrect because you must specify the "remote" parameter for "NAME" or it will not attempt to make the bridge.

This is how the process works...

You tell AjaXplorer to bridge by specifying the "NAME" => "remote" for "AUTH_DRIVER" setting. Then, AjaXplorer links with your CMS on login attempt via the AjaXplorer CMS plugin and writes a user in the users.ser (Serial File) if they do not exist. At this point AjaXplorer does not even attempt to look at any database at all. The database is completely bypassed weather you specify "SQL_DRIVER" => $SQL_Settings or not. The ONLY way it will refer to the database is if "NAME" => 'sql' for "AUTH_DRIVER" setting. But then if you use 'sql' you will NOT be able to have bridge functionality.

Personally I think this is a HUGE bug and a major annoyance.

I hope this clears up all the confusion.

于 2013-02-25T16:44:15.717 回答