我发现了 AjaXplorer,我想知道是否有关于如何加强数据库之间链接的分步指南我已阅读文件 http://ajaxplorer.info/documentation/developer-documentation/chapter-external-bridge/ 但还是觉得太详细了
有没有一步一步ajax链接数据库的?
最佳答案
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);
这应该有效。
关于AjaXplorer 连接到数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10165453/