|
|
Re: API function to authenticate users [message #27178 is a reply to message #27176] |
Mon, 29 August 2005 19:15 |
|
naudefj
Messages: 3771 Registered: December 2004
Karma: 28
|
Senior Member Administrator Core Developer |
|
|
That was quick! Thank you very much.
Can you please also apply this patch (untested):
--- forum_login.php.old 2005-08-29 14:11:34.000000000 -0500
+++ forum_login.php 2005-08-29 14:12:06.000000000 -0500
@@ -49,7 +49,7 @@
eval(str_replace('<?php', '', substr_replace($data, '', strpos($data, 'require'))));
/* db.inc needs certain vars inside the global scope to work, so we export them */
- foreach (array('FUD_OPT_1', 'DBHOST', 'DBHOST_USER', 'DBHOST_PASSWORD', 'DBHOST_DBNAME') as $v) {
+ foreach (array('FUD_OPT_1', 'DBHOST', 'DBHOST_USER', 'DBHOST_PASSWORD', 'DBHOST_DBNAME', 'DATA_DIR') as $v) {
$GLOBALS[$v] = $$v;
}
Best regards.
Frank
|
|
|
|
Re: API function to authenticate users [message #27184 is a reply to message #27179] |
Mon, 29 August 2005 20:21 |
|
naudefj
Messages: 3771 Registered: December 2004
Karma: 28
|
Senior Member Administrator Core Developer |
|
|
Yes, thank you!
I also had to add the following lines to prevent errors:
--- forum_login.php.old 2005-08-29 15:19:14.000000000 -0500
+++ forum_login.php 2005-08-29 15:15:02.000000000 -0500
@@ -39,6 +39,21 @@
function external_get_user_by_auth($login,$passwd)
{
+ /* load forum config */
+ $data = file_get_contents($GLOBALS['PATH_TO_FUD_FORUM_GLOBALS_PHP']);
+ eval(str_replace('<?php', '', substr_replace($data, '', strpos($data, 'require'))));
+
+ /* db.inc needs certain vars inside the global scope to work, so we export them */
+ foreach (array('FUD_OPT_1', 'DBHOST', 'DBHOST_USER', 'DBHOST_PASSWORD', 'DBHOST_DBNAME', 'DATA_DIR') as $v) {
+ $GLOBALS[$v] = $$v;
+ }
+
+ if (!$GLOBALS['PATH_TO_FUD_FORUM_DB_INC']) {
+ require_once $GLOBALS['DATA_DIR'] . 'include/theme/default/db.inc';
+ } else {
+ require_once $GLOBALS['PATH_TO_FUD_FORUM_DB_INC'];
+ }
+
return q_singleval("SELECT id FROM ".$DBHOST_TBL_PREFIX."users WHERE login='".addslashes($login)."' AND passwd='".md5($passwd)."'");
}
I'm sure you will be able to optimize it further...
Best regards.
Frank
|
|
|
|