FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum » FUDforum Suggestions » API function to authenticate users
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: API function to authenticate users [message #27184 is a reply to message #27179] Mon, 29 August 2005 20:21 Go to previous messageGo to previous message
naudefj is currently offline  naudefj   South Africa
Messages: 3771
Registered: December 2004
Karma:
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
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: "Save outgoing PM" toggle in User CP-->Settings and form
Next Topic: mark topics as bookmark in fudforum
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Nov 27 13:36:33 GMT 2024

Total time taken to generate the page: 0.04223 seconds