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

Home » FUDforum » How To » Automatically create user in an extranet
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Automatically create user in an extranet [message #18076] Wed, 05 May 2004 16:22 Go to next message
anner is currently offline  anner   United States
Messages: 36
Registered: May 2004
Karma: 0
Member
I am trying to create a user in a client's extranet and create a FUD user at the same time. Then, when the user logs into the extranet and clicks on a link, they are to get logged into fud.

At the moment, if we create the user in FUD, the click to login works...the problem is creating the user when we create the user in the extranet. We can't post the same for FUD uses because we don't have the admin cookies set to do so. We have currently entered the users by doing:

$query = "insert into fud26_users (login, alias, passwd, name, email, join_date, last_read) values ('$login','$login',md5('$password'),'$name','$email','$datestamp','$datesta mp') ";
$sth=$dtools->query($dbh2,$query, 'Q1238');
$sth->finish;

#fetch the new user id
$query = "select id from fud26_users where login = '$login'";
$sth=$dtools->query($dbh2,$query);
($id)= $sth->fetchrow;
$sth->finish;

$query = "insert into fud26_group_members (user_id, group_id, group_members_opt) values ('$id','$group','3276951')";
$sth=$dtools->query($dbh2,$query);
$sth->finish;

When we try and login we get a "NO SUCH URL" error.

Please help ASAP, we were supposed to go live with this a couple of days ago. We've been struggling with it for a while.

Thanks,
Anne
Re: Automatically create user in an extranet [message #18082 is a reply to message #18076] Thu, 06 May 2004 12:20 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Netherlands
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Don't create a user by running the queries manually, instead use the add_user() method of the fud_user_reg class defined inside users_reg.inc.

You can find usage examples inside scripts_common.inc file.


FUDforum Core Developer
Re: Automatically create user in an extranet [message #18084 is a reply to message #18076] Thu, 06 May 2004 12:57 Go to previous messageGo to next message
anner is currently offline  anner   United States
Messages: 36
Registered: May 2004
Karma: 0
Member
But how can I do that without an admin cookie set?

Anne
Re: Automatically create user in an extranet [message #18085 is a reply to message #18084] Thu, 06 May 2004 13:16 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Netherlands
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
It's an API function, it does not need any admin stuff if you call it from a PHP script of your own.

FUDforum Core Developer
Re: Automatically create user in an extranet [message #18088 is a reply to message #18082] Thu, 06 May 2004 14:45 Go to previous messageGo to next message
anner is currently offline  anner   United States
Messages: 36
Registered: May 2004
Karma: 0
Member
alright, I see how to add and delete a users. We also need to add them to a group with a certain set of permissions. There doesn't appear to be an include for this...there appears to be one for adding a group with members, but not adding members to an existing group. Is there a function for this? Can I enter this into the db directly?

Anne
Re: Automatically create user in an extranet [message #18089 is a reply to message #18088] Thu, 06 May 2004 15:07 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Netherlands
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
For group permissions consult the groupmgr.php file.

FUDforum Core Developer
Re: Automatically create user in an extranet [message #18090 is a reply to message #18089] Thu, 06 May 2004 15:08 Go to previous messageGo to next message
anner is currently offline  anner   United States
Messages: 36
Registered: May 2004
Karma: 0
Member
Is this for adding users to a group too?

Anne
Re: Automatically create user in an extranet [message #18091 is a reply to message #18090] Thu, 06 May 2004 15:11 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Netherlands
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
There are no functions to add a user, but you can see how it's done by looking @ the code inside the file I've indicated.

FUDforum Core Developer
Re: Automatically create user in an extranet [message #18092 is a reply to message #18076] Thu, 06 May 2004 15:21 Go to previous messageGo to next message
anner is currently offline  anner   United States
Messages: 36
Registered: May 2004
Karma: 0
Member
Thanks for all your help.

Anne
Re: Automatically create user in an extranet [message #18919 is a reply to message #18076] Thu, 17 June 2004 01:47 Go to previous messageGo to next message
zariok is currently offline  zariok   United States
Messages: 5
Registered: June 2004
Location: St. Louis
Karma: 0
Junior Member

I was reading this thread to see how someone can add a user to both an 'external' application and the FUDforum.

I see someone specified how to ADD a user via a class method, but how would you log this person on if they logon to the 'external' application first?

Thanks in advance,


------
zariok
Re: Automatically create user in an extranet [message #18921 is a reply to message #18919] Thu, 17 June 2004 02: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
If the external application is a web app you can use a cookie to pass the login information to the forum.

FUDforum Core Developer
Re: Automatically create user in an extranet [message #18924 is a reply to message #18921] Thu, 17 June 2004 02:19 Go to previous messageGo to next message
zariok is currently offline  zariok   United States
Messages: 5
Registered: June 2004
Location: St. Louis
Karma: 0
Junior Member

Is this explained anywhere? Attributes to send?

What about a attributes set within $_SESSION?



------
zariok
Re: Automatically create user in an extranet [message #18925 is a reply to message #18924] Thu, 17 June 2004 02:23 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
FUDforum uses it's own sessions mechanism, not the native PHP one. Look into the cookies.inc.t code.

FUDforum Core Developer
Re: Automatically create user in an extranet [message #19585 is a reply to message #18924] Sun, 08 August 2004 18:10 Go to previous messageGo to next message
Pieter007 is currently offline  Pieter007   Netherlands
Messages: 1
Registered: August 2004
Karma: 0
Junior Member
Quote:


If the external application is a web app you can use a cookie to pass the login information to the forum.


Can you eloborate on this? It doesn't seem to follow from the content of cookies.inc.t.

In the meantime, there is another possible approach, just generate an invisible form and submit it using JavaScript:

<html>
<body>
<form action='/path/to/fud/index.php?t=login' method='post' name='frm'>
<?php
  echo "<input type='hidden' name='quick_login' value='" . $username . "'>";
  echo "<input type='hidden' name='quick_password' value='" . $passwd . "'>";
?>
</form>
<script language="JavaScript">
document.frm.submit();
</script>
</body>
</html>


Maybe not as clean as setting the right cookie(s), but certainly easy to understand and implement.
Re: Automatically create user in an extranet [message #19591 is a reply to message #19585] Mon, 09 August 2004 10:14 Go to previous message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
When you login to the forum the forum creates you a session and stores it inside a cookie. Basically if the remote application does the same thing then forum can just pickup on the created cookie and use it.

FUDforum Core Developer
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: just upgraded to 2.6.4
Next Topic: new themes
Goto Forum:
  

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

Current Time: Mon Nov 25 01:40:34 GMT 2024

Total time taken to generate the page: 0.02557 seconds