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

Home » FUDforum » How To » Single Login with a CMS
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Single Login with a CMS [message #23322] Sat, 12 March 2005 10:38 Go to next message
LastQuark   United States
Messages: 12
Registered: August 2003
Karma: 0
Junior Member
How can I implement single login with a CMS? I will login to the CMS and it will simultaneously log me in to FUDforum?

Any easy solution?
Re: Single Login with a CMS [message #23325 is a reply to message #23322] Sat, 12 March 2005 16:01 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
Yeah... you basically need to have forum's user_login() function executed by the CMS logging in the user into the forum.

FUDforum Core Developer
Re: Single Login with a CMS [message #23336 is a reply to message #23322] Sun, 13 March 2005 01:25 Go to previous messageGo to next message
LastQuark   United States
Messages: 12
Registered: August 2003
Karma: 0
Junior Member
As ignorant as I am in php, if I have the following directory..

/public_html/ 
../mycms 
...../index.php 
...../module
......../cmslogin.php 
...../FUDforum/ 
......../theme 
.........../default 
............../login.php


How can I execute the user_login() in login.php within my cmslogin.php directory?

$50 PayPal donation here if I can get this implemented in my CMS before I post this request in Rent-A-Coder. Smile

LQ
Re: Single Login with a CMS [message #23339 is a reply to message #23336] Sun, 13 March 2005 05:34 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
The function I had mentioned can be found inside the users_reg.inc.t script found inside the src/ directory. This script in compiled form would be inside include/theme/default/users_reg.inc.

The code inside the function is pretty simple so, it may be a good idea to simply move the code into your own application.


FUDforum Core Developer
Re: Single Login with a CMS [message #23354 is a reply to message #23322] Sun, 13 March 2005 19:44 Go to previous messageGo to next message
LastQuark   United States
Messages: 12
Registered: August 2003
Karma: 0
Junior Member
Ilia,

As simple at it may seem to be, I am not successful after spending several hours. I am not a coder but only have dreams of several large forum sites. Without any knowledge of PHP, my trial and error patching didn't work out. I was not lucky this time Smile.

This process is the only one that is preventing me from launching my FUDforum sites with the Xaraya CMS. If you are not yet aware of, Xaraya is very close to version 1.0 after several years of development. It is a very powerful CMS that I strongly believe will have a great future.

I would like to see FUDforum part of this future. No doubt, it is the best forum out there. It will be hard to beat the best forum married to the best CMS. As you may already know, DogManStar came out with a mod that lets Xaraya use the authentication scheme of FUDforum through Xaraya's login process. As soon as a user logs in to Xaraya, the users table in FUDforum are copied over to Xaraya's user tables. This is wonderful. Integration to Xaraya is already 95% done except for this simple single login process that I am struggling with.

I offered a small sum that I'm hoping will encourage someone to step forward and take it. But there are not any takers. Would you be willing to help copy the user_login() to the Xaraya login files? I can send the files. I know you are a very busy man and will be difficult for you to spare some time with your schedule. But if you think about it, this presents a great opportunity for the future of FUDforum.

I can see that FUDForum is not as visible as some forums solutions out there despite its great features. I was a member of this forum for almost 2 years and I didn't realize how good it is until I installed the program very recently! I hope you take the time. I guarantee it will be time well spent because of the activity and the buzz Xaraya is getting nowadays.

Rest assured I will not bother you again for additional support.

LQ
Re: Single Login with a CMS [message #23360 is a reply to message #23354] Sun, 13 March 2005 20:58 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
I've added a script to the CVS (forum_login.php) that can be found inside the forum's scripts/directory.

This script implements external_fud_login() function that takes the forum user id as a single parameter and will try to log that user in, creating a cookie and returning you the session id for that user.

To use the script you simply need set configuration directive within the script that identifies the location of the GLOBALS.php file.

The script it attached to this message.


FUDforum Core Developer
Re: Single Login with a CMS [message #23364 is a reply to message #23322] Sun, 13 March 2005 22:43 Go to previous messageGo to next message
LastQuark   United States
Messages: 12
Registered: August 2003
Karma: 0
Junior Member
Ilia,

Wow, it didn't took you a long time. This is just super! Thanks. I'm sure many will be happy about this.

LQ
Re: Single Login with a CMS [message #23378 is a reply to message #23336] Mon, 14 March 2005 17:31 Go to previous messageGo to next message
kenjb is currently offline  kenjb   United States
Messages: 67
Registered: September 2004
Karma: 0
Member
LastQuark wrote on Sat, 12 March 2005 20:25


(stuff cut here)

$50 PayPal donation here if I can get this implemented in my CMS before I post this request in Rent-A-Coder. Smile

LQ



Do you have a paypal account and/or button somewhere on this site for donations like mentioned above Ilia?


kenjb
Re: Single Login with a CMS [message #23379 is a reply to message #23322] Mon, 14 March 2005 19:11 Go to previous messageGo to next message
JamesS is currently offline  JamesS   United States
Messages: 275
Registered: July 2002
Location: Atlanta, GA
Karma: 0
Senior Member
Check his signature.
Re: Single Login with a CMS [message #23380 is a reply to message #23378] Mon, 14 March 2005 19:16 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
There is a donation link in my signature.

FUDforum Core Developer
Re: Single Login with a CMS [message #23392 is a reply to message #23322] Tue, 15 March 2005 08:10 Go to previous messageGo to next message
LastQuark   United States
Messages: 12
Registered: August 2003
Karma: 0
Junior Member
...one day later...

How am I going to execute this file? Should I use 'onsubmit' to the form name to execute it like:

/* filename = fudlogin.xd */

<form action="&xar-modurl-roles-user-login;" method="post" enctype="application/x-www-form-urlencoded" onsubmit="forum_login.php">
<div>
    <div style="text-align: left; margin: 3px;"><label for="uname#$blockid#"><xar:mlstring>Username</xar:mlstring>:</label></div>
    <div style="text-align: right; margin: 3px;"><input type="text" name="uname" id="uname#$blockid#" maxlength="64" size="10" /></div>
</div>
<div>
    <div style="text-align: left; margin: 3px;"><label for="pass#$blockid#"><xar:mlstring>Password</xar:mlstring>:</label></div>
    <div style="text-align: right; margin: 3px;"><input type="password" name="pass" id="pass#$blockid#" maxlength="64" size="10" /></div>
</div>

<xar:if condition="xarConfigGetVar('Site.Session.SecurityLevel') ne 'High'">
    <div style="text-align: center; margin: 3px;"><input type="checkbox" name="rememberme" id="rememberme#$blockid#" value="1" />
    <label for="rememberme#$blockid#"><xar:mlstring>Remember me</xar:mlstring></label></div>
</xar:if>

<input type="hidden" name="redirecturl" id="returnurl#$blockid#" value="#$return_url#" />
<div style="text-align: center; margin: 3px;"><input type="submit" value="#$signinlabel#" /></div>

<xar:if condition="$showregister eq 1">
    <div style="text-align: center; margin: 3px;"><xar:mlstring>Need an account?</xar:mlstring><br />
    <a href="#$registerurl#"><xar:mlstring>Register here</xar:mlstring></a>.</div>
</xar:if>
</form>


...or should I execute it in the function as follows as soon as the user is authenticated (see arrows):

<?php
/* filename = authenticate_user.php */

function authfud__get_fud_userdata($connect,$username,$pass)
{
    $prefix = xarModGetVar('authfud','prefix');
    $password = md5($pass);
    $table = $prefix.'users';

    if($connect)  //just double-checking the connection.
    {
        // connect to the FUDforum database and get the user data
        //$inv_db = mysql_select_db($database, $connect);
        $query = "SELECT * FROM " . $table . " WHERE login=? AND passwd=?";
        
        $connect->SetFetchMode(ADODB_FETCH_ASSOC);
        
        $bindvars = array($username, $password);
        $result =& $connect->Execute($query,$bindvars);
    
        if (!$result) {
            //error
            $msg = "FUDforum: Query to $table has failed: " . $connect->ErrorMsg();
            xarErrorSet(XAR_SYSTEM_EXCEPTION, 'SQL_ERROR',
                new SystemException(__FILE__.'('.__LINE__.'): '.$msg));
            error_log("FUDforum Error: Query to $table failed");
            return false;
        } 
        if ($result->EOF)
        {
            //incorrect login
        $msg = xarML('Wrong username (#(1)) or pass (not shown).', $username);
            xarErrorSet(XAR_SYSTEM_EXCEPTION, 'BAD_PARAM',
                new SystemException(__FILE__.'('.__LINE__.'): '.$msg));
            $result->Close();
            return false;
        }
        else {
            //correct login.  return uid.
                if ($result->fields['users_opt']=='0')
                {
                    //user inactive
                    $msg = xarML('User #(1) not activated.', $username);
                    xarErrorSet(XAR_SYSTEM_EXCEPTION, 'BAD_PARAM',
                        new SystemException(__FILE__.'('.__LINE__.'): '.$msg));
                    $result->Close();
                    return false;    
                }
                else
                {
                    $user_data=$result->fields;
                    $result->Close();
                    return $user_data;
                }
        }
        INCLUDE('forum_login.php');  <<<<<<<========
    }
}

?>


Attached is the zip file that contains the files of the FUDforum module that was created specifically to work with Xaraya.

Pardon my ignorance. Several PHP books for Dummies are on the way...I can't wait to get this mod working before the books arrive.

  • Attachment: authfud.zip
    (Size: 24.16KB, Downloaded 740 times)
Re: Single Login with a CMS [message #23398 is a reply to message #23392] Tue, 15 March 2005 15:28 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
Well, one you've successfully retrieved the user you now have that user's forum id stored inside $result->fields['id'].

So, before the return $user_data;, which indicates a sucessful login, you need to include the script I've provided and call the external_fud_login() function with $result->fields['id'] parameter.


FUDforum Core Developer
Re: Single Login with a CMS [message #23449 is a reply to message #23322] Wed, 16 March 2005 19:19 Go to previous messageGo to next message
bwdev is currently offline  bwdev   United States
Messages: 5
Registered: March 2005
Karma: 0
Junior Member
Maybe I am lost on this issue but why isn't it necessary to pass in the users password also to the external login function?
Re: Single Login with a CMS [message #23450 is a reply to message #23449] Wed, 16 March 2005 19:49 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
Because authentication is done by CMS already or external app.

FUDforum Core Developer
Re: Single Login with a CMS [message #23460 is a reply to message #23322] Thu, 17 March 2005 17:42 Go to previous messageGo to next message
LastQuark   United States
Messages: 12
Registered: August 2003
Karma: 0
Junior Member
To the 9 others who downloaded the script,

Were you successful in running the script? Can you please provide what you have done? Please assume I have zero knowledge in php? Embarassed

Thanks.

Re: Single Login with a CMS [message #23461 is a reply to message #23322] Thu, 17 March 2005 18:17 Go to previous messageGo to next message
JamesS is currently offline  JamesS   United States
Messages: 275
Registered: July 2002
Location: Atlanta, GA
Karma: 0
Senior Member
The script is just to mark the user as logged in for the forum. You have to write, or use, something else to actually authenticate the user.
Re : Re: Single Login with a CMS [message #23462 is a reply to message #23460] Thu, 17 March 2005 18:19 Go to previous message
DogManStar is currently offline  DogManStar   France
Messages: 60
Registered: March 2005
Karma: 0
Member
LastQuark a écrit le jeu, 17 mars 2005 18:42

To the 9 others who downloaded the script,

Were you successful in running the script? Can you please provide what you have done? Please assume I have zero knowledge in php? Embarassed

Thanks.




I have to update my ipb forum to fudforum first, I have problem with my server at this moment (segmentation fault when running the script)
I hope to help you, if i can, after.
ps : after one week i think the segmentation fault is perhaps because of turk mmcache. I hope to test this again next we coz this we i'm in Paris.


I've seen things you people wouldn't believe. Attack ships on fire off the shoulder of Orion. I watched c-beams ... glitter in the dark near Tanhauser Gate. All those ... moments will be lost ... in time, like tears ... in rain. Time ... to die.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Renaming index.php and wrapping forums
Next Topic: Why store message body a textfile?
Goto Forum:
  

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

Current Time: Tue Nov 12 21:47:56 GMT 2024

Total time taken to generate the page: 0.05238 seconds