Firefox PHP

integrate phorum with other systems

Posted by pilu 
integrate phorum with other systems
September 07, 2004 09:19AM
I would like to know how to activate a phorum user from my site. This is because i have already a user system management and i'd like that when a user enter in my site doesn't have to re-login to enter in the phorum too.
How have i to do to obtain this? Maybe activate the right sessions variabiles?

thx



Edited 2 time(s). Last edit at 09/07/2004 09:20AM by pilu.
Re: integrate phorum with other systems
September 07, 2004 10:32AM
There are varying ways to do this. You can "mirror" the user database, so that if somebody registers on your sites system it will add them to Phorum also.

You can rewrite the Phorum user system to use yours instead, but this is a ton of work.

You can require that somebody be logged in to your site to use your Phorum by the use of a module in Phorum, and not use Phorum's user system at all.

Or you can take the route I went: go the other way. I just made the rest of my site use Phorum's user system, because it was a lot better then the one I had before. :)
Re: integrate phorum with other systems
September 07, 2004 10:54AM
Re: integrate phorum with other systems
September 08, 2004 04:00AM
Tridus Wrote:
-------------------------------------------------------
>
> Or you can take the route I went: go the other
> way. I just made the rest of my site use Phorum's
> user system, because it was a lot better then the
> one I had before. :)


Ok, but in the case i'll use this way, how many unuseful libraries i'll have to import in my system to let it works?

thx
Re: integrate phorum with other systems
September 08, 2004 04:21AM
how are they unuseful?

for starters, I used this layer to load everything I need for user-auth in another app
<?PHP  
 
$safe_id=$i;

$phorum5dir="/home/XXX/forum_v50/";

$PHORUM['session_path']="/";
$PHORUM['session_domain']="XXX.de";
$PHORUM["session_timeout"]=365;
$PHORUM["use_cookies"]=true;
$PHORUM['PROFILE_FIELDS']=array("real_name","icq","aol","msn","yahoo","jabber","image","webpage","delete_info");
$PHORUM['enable_pm']=0;
$PHORUM['track_user_activity']=1;

include $phorum5dir.'include/constants.php';
include $phorum5dir.'include/db/config.php';
include $phorum5dir.'include/db/mysql.php';
include $phorum5dir.'include/users.php';

$i = $safe_id;

?>

You can use everything from include/users.php then.


Thomas Seifert
Re: integrate phorum with other systems
September 08, 2004 05:49AM
i have problem passing the session variabiles to my application. I don't see user data: when i'm logged into the phorum and i go to my application and return to phorum again the user is non logged...i loose users session informations.
How can i extend global scope to users variabiles to my application?

thx
Re: integrate phorum with other systems
September 08, 2004 12:49PM
We will need to know more about what you have done and what you are looking for to help you on this.

Brian - Cowboy Ninja Coder - Personal Blog - Twitter
Drupal
September 09, 2004 01:06PM
I have a site running since 1997 (www.bmwe30.net) where I'm currently installing Drupal;

I've been using Webbbs for ages, which needs to be replaced, and since Drupal's forum isn't really a forum (it sucks, basically), I decided to use Phorum5, which looks great (I'm just sorry I didn't find it before).

I also need to integrate it with Drupal's authentication system...

> You can require that somebody be logged in to your
> site to use your Phorum by the use of a module in
> Phorum, and not use Phorum's user system at all.

This seems to be the way to go, for me, but since I'm not a programmer, don't have a clue where to start...

Can you give me any pointers?

Thanks for any help
Re: Drupal
September 09, 2004 01:14PM
Gustavo Wrote:
-------------------------------------------------------

> > You can require that somebody be logged in to
> your
> > site to use your Phorum by the use of a
> module in
> > Phorum, and not use Phorum's user system at
> all.
>
> This seems to be the way to go, for me, but since
> I'm not a programmer, don't have a clue where to
> start...
>
> Can you give me any pointers?
>
> Thanks for any help

I can give you some ideas on how to do this, but ultimately it will require some programming to do it.

Your module would effectively need to be able to do authentication with Drupal's user system in order to figure out if someone is logged in or not. If they are, then they can get into Phorum and post and such. If not, you would effectively want to bounce them to a "you must login" page, and block them from using Phorum at all.
Re: Drupal
September 09, 2004 06:24PM
And what about the phorum username, email address, etc? would that also come from drupal side?

I'm also asking for help on the Drupal forums, to see if I can figure out how Drupal handles authentication.

I think such a module would help a lot of other people since Drupal is wonderful, but, like I said, its forum is awful... and phorum looks like what I've been looking for for years!

Thank you for your help,

Gustavo Melo
Re: integrate phorum with other systems
September 09, 2004 07:44PM
Yeah, this stuff would be taken from Drupal and put into posts for users when the post is made. A user should never see the "username" or "email" sections on the post form, you could remove them from the template and just populate the values with information from Drupal.
Re: integrate phorum with other systems [SOLVED]
September 16, 2004 05:14AM
Hello,

I've the same kind of problem.

I've my own authentication system and I want to hide the Phorum (5.0.10) authentication process when my users are logging in.
For this I maintain 2 tables of users. Each time I add a user in my table, I add him in the Phorum_user table with a sql script.

At the end of my authentication process I start the Phorum authentication process by (I wrote tthp for the address to let you see the real code!!)

die(header("Location: tthp://my_site/phorum/phorum-5.0.10/login_my_site.php?f_username=$username&f_password=$password&foreign_ident=YES&f_redir=$redir"));

I obtained the login_my_site.php file by doing these minor changes in the login.php file to take into account the foreign_id and f_redir parameters.



if($foreign_ident="YES"){
$username=$f_username;
$password=$f_password;

$GLOBALS["PHORUM"]["user"]["username"] = $user;
$GLOBALS["PHORUM"]["user"]["password"] = $password;
$PHORUM["user"]["username"] = $username;
$PHORUM["user"]["password"] = $password;


}else{
$username=$_POST["username"];
$password=$_POST["password"];
}


Then I call the phorum_user_check_login function with the previous variables rather than with the $POST variables comming from your login.php form:

if(phorum_user_check_login($username, $password)){



At the en of the phorum authenication process I use the value of the f_redir parameter rather your redir variable if the login script know the foreign_ident variable :

if($foreign_ident="YES")
header("Location: $f_redir");
else
header("Location: $redir");


So, at the end of this process my users can use my site with Phorum inside it, but they are not logged in Phorum.


The checking of the username/password is well done by the call to phorum_user_check_login($username, $password) but I mean that the phorum_user_create_session() which follows always return false and no "PHORUM" session is created for my users.

Am I rigth?

Which other $GLOBALS variables or $PHORUM variables have I to set up to do it work better?

Thank's a lot


Soory for this silly question .. the solution was here!!
After a more attentive look at a previous post of Thomas I found the solution:

To do it work, I've just added these variables in my test
if($foreign_ident="YES"){
$username=$f_username; ...BLA BLA;


$PHORUM['session_path']="/";
$PHORUM['session_domain']="my_site.org";
$PHORUM["session_timeout"]=365;
$PHORUM["use_cookies"]=true;
$PHORUM['PROFILE_FIELDS']=array("real_name","icq","aol","msn","yahoo","jabber","image","webpage","delete_info");
$PHORUM['enable_pm']=0;
$PHORUM['track_user_activity']=1;
}else{
$username=$_POST["username"];
$password=$_POST["password"];

}


if(phorum_user_check_login($username, $password)){ ..... BLA BLA BLA;

If you think this post can be usefull for someone, keep it otherwise remove it when you want .

Sorry again for the embarras.

Koala




Edited 2 time(s). Last edit at 09/16/2004 06:17AM by koala.
Re: integrate phorum with other systems [SOLVED]
September 17, 2004 10:02AM
If you have your own auth system and your own session system, you don't really need to use the phorum functions to create the user session. All you need to do is create the $PHORUM["user"] variable with enough information that Phorum will be happy with it.

I think you can do with as little as:

$PHORUM["user"]["user_id"]
$PHORUM["user"]["username"]
$PHORUM["user"]["email"]

There are a couple of drawbacks. Functions like having replies emailed would require additional module work.

Brian - Cowboy Ninja Coder - Personal Blog - Twitter
Re: integrate phorum with other systems [SOLVED]
September 17, 2004 10:07AM
I've always done it the other way round and I'm quite happy with it. Easy functions to use in the other apps ;).


Thomas Seifert
Re: integrate phorum with other systems
November 03, 2004 02:00PM
I've been working on integrating phorum, and decided to go with using the Phorum User system.

On most pages I have a login option, and got that working fine by posting to login.php.

I can check if a user is logged in by including the common.php and checking, $PHORUM["DATA"]["LOGGEDIN"].

The problem I get is that although this all works fine, when my page's are located in the phorum main directory, when I try to include common.php from an outside directory I naturally get the problem of having all the other files out of reach.

I.e failed connection stream errors.

I tried changing the include_once and include's in common.php and other files, to use the full path from the root folder and hard-code it into script, instead of "./" , but noticed somewhat of a slow down after doing this.

I was wondering if anyone could help in figuring out another way of accomplishing the above without sacraficing the speed.

Also should it be suffering a slow down because of the full root paths versus using the relative (./) paths?

Thanks for any help.



Edited 1 time(s). Last edit at 11/03/2004 02:00PM by shinda.
Re: integrate phorum with other systems
November 03, 2004 02:02PM
don't change all the includes.
just do a chdir to the phorum-directory before you include common.php.


Thomas Seifert
Re: integrate phorum with other systems
November 03, 2004 02:36PM
Wow.........

Thanks for that...didn't know about the function...
pat
Re: integrate phorum with other systems
May 01, 2005 04:16PM
Hi Thomas,

> for starters, I used this layer to load everything
> I need for user-auth in another app
> (...code...)

I get a #403 if I include your code - is there some phorum-security-check missing something that wasn't there at the time you where writing this post?

thanx
pat


Re: integrate phorum with other systems
May 01, 2005 04:23PM
phorum doesn't send a 403 anywhere. sounds like some .htaccess blocking in your case.


Thomas Seifert
pat
Re: integrate phorum with other systems
May 01, 2005 04:59PM
Hi Thomas,

there is only the .htaccess which comes with the phorum-distribution...

thanx
pat
Re: integrate phorum with other systems
May 01, 2005 05:03PM
there is no .htaccess in the main phorum-directory.


Thomas Seifert
pat
Re: integrate phorum with other systems
May 02, 2005 03:42AM
but in include-folder there is...



Edited 1 time(s). Last edit at 05/02/2005 03:42AM by pat.
Re: integrate phorum with other systems
May 02, 2005 03:44AM
you shouldn't run code directly in the include-folder.
thats why its called "include", only includes used in other files there.


Thomas Seifert
pat
Re: integrate phorum with other systems
May 02, 2005 03:49AM
Hi Thomas,

> you shouldn't run code directly in the
> include-folder.
> thats why its called "include", only includes used
> in other files there.

Thats all "I" wanna do - as I said I just use your code:

(...)
include $phorum5dir.'include/constants.php';
include $phorum5dir.'include/db/config.php';
include $phorum5dir.'include/db/mysql.php';
include $phorum5dir.'include/users.php';

thanx
pat
Re: integrate phorum with other systems
May 02, 2005 04:02AM
yeah but *where* do you run "my code" ?
where did you put this file in?
what do you have there as $phorum5dir? It should be a filesystem path and no url.


Thomas Seifert
pat
Re: integrate phorum with other systems
May 07, 2005 02:05PM
Hi Thomas,

thank you so far - the 403 is gone now (it was really a stupid mistake of mine!) but the thing is still not working for me.

I put this in a separate file in the main phorum-folder but it gives me no values for $PHORUM other than the ones given in the script itself. And my check of session gives me "Session not active".


<?PHP

$safe_id=$i;

$phorum5dir="./";

$PHORUM['session_path']="/";
$PHORUM['session_domain']="";
$PHORUM["session_timeout"]=365;
$PHORUM["use_cookies"]=true;
$PHORUM['PROFILE_FIELDS']=array("real_name","delete_info");
$PHORUM['enable_pm']=0;
$PHORUM['track_user_activity']=1;

include $phorum5dir.'include/constants.php';
include $phorum5dir.'include/db/config.php';
include $phorum5dir.'include/db/mysql.php';
include $phorum5dir.'include/users.php';

$i = $safe_id;

print_r ($PHORUM);
if ( phorum_user_check_session() ) {echo ("Session active");} else {echo ("Session not active");}

?>

Do you know why.

thanx
pat
Re: integrate phorum with other systems
May 08, 2005 10:44AM
Hmm, maybe just because the session is not active? :)
Are you sure the user is logged in? are you sure that the cookie is available for that directory where you start your script in?

ah, there comes something to my mind:
put this on top of the script before including any other file:
define("PHORUM",1);


Thomas Seifert
pat
Re: integrate phorum with other systems
May 08, 2005 12:33PM
Hi Thomas,

> ah, there comes something to my mind:
> put this on top of the script before including any
> other file:
> define("PHORUM",1);

That's it !

What's that for - security-measure?

thanx
pat




Edited 1 time(s). Last edit at 05/08/2005 12:33PM by pat.
Re: integrate phorum with other systems
May 08, 2005 12:35PM
yes and avoiding recursive include ... some files won't load without that set, see there at the top.


Thomas Seifert



Edited 1 time(s). Last edit at 05/08/2005 12:36PM by ts77.
Sorry, only registered users may post in this forum.

Click here to login