我发现了AjaXplorer,我想知道是否有一个循序渐进的指南来指导如何在我读过文件的数据库之间建立链接http://ajaxplorer.info/documentation/developer-documentation/chapter-external-bridge/
但还是觉得太详细了
有没有一个一步一步的ajax来链接数据库?

最佳答案

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

    "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:这是如果您想通过自己的登录页面登录,在验证用户名和密码后,必须在登录页面中添加一个glucode行:
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);

这应该管用。

09-04 20:40