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

Home » FUDforum Development » Plugins and Code Hacks » Logging in from another php application
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Logging in from another php application [message #28900] Wed, 16 November 2005 23:09 Go to next message
holdech is currently offline  holdech   Canada
Messages: 9
Registered: November 2005
Karma: 0
Junior Member
Hi all,

I need to link to FUD from another php application, where the user is already logged in and authenticated.

I assume that I just need to populate the appropriate globals?
I don't want to have user data in two databases...

Thanks

Chris
Re: Logging in from another php application [message #28903 is a reply to message #28900] Thu, 17 November 2005 14:15 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Chris, look into the FUDAPI found inside the scripts/ directory the fudapi.inc.php and forum_login.php script have the functions you are looking for.

FUDforum Core Developer
Re: Logging in from another php application [message #28904 is a reply to message #28900] Thu, 17 November 2005 14:53 Go to previous messageGo to next message
holdech is currently offline  holdech   Canada
Messages: 9
Registered: November 2005
Karma: 0
Junior Member
Thanks for the reply.
Sorry I didn't find it when searching this forum (it was there).

One more question though.
I will be using FUD as the support forum for our web app. When a new customer is set up on the app, I want to add them to FUD. Can I assume that I only need to populate the users table?

Thanks

Chris
Re: Logging in from another php application [message #28905 is a reply to message #28904] Thu, 17 November 2005 14:55 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Yes, but I'd recommend using FUDAPI for this purpose, it has a function for adding/updating users.

FUDforum Core Developer
Re: Logging in from another php application [message #28909 is a reply to message #28905] Thu, 17 November 2005 20:33 Go to previous messageGo to next message
holdech is currently offline  holdech   Canada
Messages: 9
Registered: November 2005
Karma: 0
Junior Member
Thanks - tried it and the API is perfect.

Just one problem that I'll mention here (not related to remote signon).

When I post or edit a topic, I get a blank screen - but the topic was actually posted.

The blank page URL is http://mydomain.com/index.php?t=post

It appears to be missing parms?

Thanks

Chris

More inro - after sending the above, I read a post suggesting mail needed to be enabled. Now I get the following. Note that there are two sets of single quotes around the word "test" - which is causing the error. I'm running a postgresql DB:

(/home/lite/html/forum/index.php:96
/home/lite/html/forum/index.php:150
/home/lite/html/forum/theme/default/post.php:2769
/home/lite/html/forum/theme/default/post.php:1473
/home/lite/html/forum/theme/default/post.php:3878
/home/lite/html/forum/index.php:1219
) : ERROR: parser: parse error at or near "test" at character 42
Query: SELECT id FROM fud26_search WHERE word=''test''
_GET: array ( 't' => 'post', )
_POST: array ( 'btn_submit' => 1, 'msg_subject' => 'Test forum question', 'thr_ordertype' => '0', 'thr_orderexpiry' => '1000000000', 'msg_icon' => '', 'msg_body' => 'How do I set up other employees on the system? fff', 'tmp_f_val' => '1', 'msg_show_sig' => 'Y', 'minimsg_pager_switch' => '0', 'SQ' => '893e9e945189e31c3ad78515667f7a06', 'submitted' => '1', 'reply_to' => '0', 'th_id' => '1', 'frm_id' => '7', 'start' => '0', 'msg_id' => '1', 'pl_id' => '0', 'old_subject' => '', 'prev_loaded' => '1', )
Server Version:
[Referring Page] http://lite/forum/index.php?t=post

[Updated on: Thu, 17 November 2005 20:55]

Report message to a moderator

Re: Logging in from another php application [message #28910 is a reply to message #28909] Thu, 17 November 2005 23:46 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
This is a bug that was already fixed in CVS, here is the patch:
http://cvs.prohost.org/c/index.cgi/FUDforum/chngview?cn=7437


FUDforum Core Developer
Re: Logging in from another php application [message #28927 is a reply to message #28910] Fri, 18 November 2005 19:10 Go to previous messageGo to next message
holdech is currently offline  holdech   Canada
Messages: 9
Registered: November 2005
Karma: 0
Junior Member
I really must comment on the excellent support I'm receiving.
It's refreshing to have someone realize that not everyone has time to dig through a complex application and figure it all out themselves.
You understand that support = acceptance and takeup rate.

I do need a bit more help though.
Maybe if I explain what I'm up to, that will help.

I'm using FUD as the company and user support forum for our web based business application. When employees are established for one of our clients, I'm setting them up in FUD. I am using your API now and it works great.
I did need to remove the restriction around email uniqueness (code and DB index/constraint).
Many employees use the same generic "company email"...
I also created the login name as a concattenation of clientID and userID (numeric sequence assigned values that are the primary index on their respective tables). This ensures userID will always be unique across our application.

So far, so good! I now want the user to access FUD via a link in our app i.e. the app handles the login - they never see an ID/password for FUD.

Problem, is that the /scripts/forum_login.php is designed for mySQL and has a "REPLACE INTO" command.

I'm using postgreSQL, so my question is - do you already have a postgres version or patch?

If not, I assume the best course is to delete any session records out there for the applicable FUD userID - then change the REPLACE INTO to an "INSERT INTO"?

Thanks again

Chris

[Updated on: Fri, 18 November 2005 19:12]

Report message to a moderator

Re: Logging in from another php application [message #28929 is a reply to message #28927] Fri, 18 November 2005 22:05 Go to previous messageGo to next message
holdech is currently offline  holdech   Canada
Messages: 9
Registered: November 2005
Karma: 0
Junior Member
Latest news...

I modified forum_login.php as mentioned in my previous post.

Works great!

Thanks

Chris
Re: Logging in from another php application [message #28937 is a reply to message #28929] Sat, 19 November 2005 20:09 Go to previous message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Fixed in CVS.

FUDforum Core Developer
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Modified version of popfud.php: popfudx.php
Next Topic: New threads on the front page of the site
Goto Forum:
  

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

Current Time: Thu Nov 21 15:01:18 GMT 2024

Total time taken to generate the page: 0.02851 seconds