php forum
php mysql forum
php mysql smarty
 
Topic Options
#259343 - 09/24/03 12:55 PM help with automatic login
CSMike Offline
Lurker

Registered: 09/24/03
Posts: 6
Hello all,<br /><br />I have a pressing problem that I hope some of you can help with. I'm integrating threads version 6.3.2 into an existing community, with an existing login function. What I need to do is figure out what I need to do to my current login function to automatically login users to the forum. It used to be simple: http://community.infopop.net/2/OpenTopic...mp;m=3963035063<br /><br />However, this doesn't work now, and the response I got back from support was that "It's a bit more involved now since it requires generating a session key, storing it in the UBB.threads database and then creating a cookie." They then pointed me here for help. I have full control over my server and the code, so any modifications aren't a problem, I just need to know how to do it. Anyone have any ideas or thoughts?<br /><br />I'm trying to get this finished in the next couple days, so any help would be greatly appreciated. Thanks!

Top
#259344 - 09/24/03 05:56 PM Re: help with automatic login [Re: chiefmonkey]
omegatron Offline
Member

Registered: 04/05/01
Posts: 3440
Loc: abingdon,md
I am sure there are plenty of Developer's in our Developer's for Hire forum that could help you with this. <br /> <br />Two that come off the top of my head that could do this easily are DaveL and JoshPet. <br /> <br />I just just recently coworking on a site had someone deal with integrating software and using Threads Login. Your situation is just the reverse. However the point I am making is something like this is usually not done in days. It does require time to look at the existing functions and then the code you will be replacing it with and making things mesh.
_________________________
Chuck S

DIVE IN AND VISIT ME:

Omegatron\'s Reefs

Administrator at ReefTalk

Top
#259345 - 09/24/03 09:30 PM Re: help with automatic login [Re: chiefmonkey]
JoshPet Offline
I type Like navaho

Registered: 11/29/01
Posts: 11330
Loc: Charlotte, NC
Yeah, this is probably tricky.<br /><br />First thing - you need your existing users to be input into the threads database - they would have to have a user entry in the w3t_Users table. That's why doing the reverse and using threads for the registration system is much easier.<br /><br />So you'd need to copy your existing users to the Threads database and modify your existing new user function to also add users to the Threads database.<br /><br />Passwords need to be stored MD5 encoded in the w3t_Users database, and some other key fields need to be setup U_Approved = 'yes' etc.... You can check the INSERT function inside the adduser.php for exactly what the minimum info is needed to insert the user.<br /><br />Then indeed, you'd need to replicate the cookies that are set when you login to threads. You can see this in the ubbt.inc.php in the function "do_login". <br /><br />If your existing pages handling this are php and using MySQL it would be easier to replicate what the login function does, and even perhaps include the main.inc.php file so that your pages have access to the threads variables etc...<br /><br />Assuming you're using cookies.... I'm not exactly sure how it would need to be handled in Sessions.<br /><br />I've never done anything myself this way, I've done it the way omegatron suggests, getting other PHP pages etc.. to work off the Threads user base.<br /><br />I would presume it's more complicated if your existing pages are not PHP pages. I'm not sure, as I'm not proficient in other languages.
_________________________
Joshua Pettit
www.JoshuaPettit.com
My abilities are for hire.

Top
#259346 - 09/24/03 09:54 PM Re: help with automatic login [Re: Daine]
CSMike Offline
Lurker

Registered: 09/24/03
Posts: 6
Thanks for the help guys, I'll try it out tonight and see where I get. Otherwise, I'll probably be contacting you, Josh, or Dave for developer for hire help.<br /><br />And sorry about posting this in a couple different areas, I didn't know where was best to post it, and I wasn't getting responses initially. My bad. <img src="/forum/images/graemlins/blush.gif" alt="" />

Top
#259347 - 09/24/03 09:59 PM Re: help with automatic login [Re: chiefmonkey]
JoshPet Offline
I type Like navaho

Registered: 11/29/01
Posts: 11330
Loc: Charlotte, NC
No problemo - just tidying up so that all the responses get focused in one place so it's easier for those trying to offer advice. <img src="/forum/images/graemlins/smile.gif" alt="" />
_________________________
Joshua Pettit
www.JoshuaPettit.com
My abilities are for hire.

Top
#259348 - 09/26/03 10:51 PM Re: help with automatic login [Re: Daine]
CSMike Offline
Lurker

Registered: 09/24/03
Posts: 6
Josh, you're the man! I haven't gotten to importing my existing users or configuring the community registration process to populate the UBB.t DB yet, but I did bring over a couple sample users and tweaked my login script based on the info you provided above, Josh. Worked like a charm, got the correct cookies in with the correct info and viola, the user is automatically logged in.<br /><br />For anyone also trying to do this, here is what I pulled out of ubbt.inc.php as Josh suggested and added to my login script (and yes, it is PHP) to set the cookies correctly. This chunk goes after the user is authenticated:<br /><br /> srand((double)microtime()*1000000);<br /> $newsessionid = md5(rand(0,32767));<br /> $autolog = md5("$Uid$pass");<br /> setcookie("w3t_myid","$Uid",time()+31536000,"/");<br /> setcookie("w3t_key","$autolog",time()+31536000,"/");<br /> setcookie("w3t_mysess","$newsessionid","0","/");<br /> setcookie("w3t_language","english",time()+31536000,"/");<br /> setcookie("ubbt_pass","",time()-3600,"/");<br /> setcookie("ubbt_dob","",time()-3600,"/");<br /><br />You basically have to make sure the Uid matches up with your existing User ID scheme, and make sure $pass is already an md5 encrypted version of the user's password. You'll notice I had to hardcode some of the cookie variables (such as the language and the path), but nothing too crazy here, and it works great.<br /><br />I'll try to update this as I drop in my existing users and tweak my current registration process to do the DB insert into the UBB.t DB, but it should be relatively easy. The existing users dump should be a simple script looping an insert, and the registration process tweak should also just be a variation of the insert query that Josh pointed me to.<br /><br />Thanks again.

Top



Latest Posts
[7.2.1] - Naked shoutbox
by bellaonline
05/05/12 05:00 PM
[7.x] Stop Forum Spam Integration v0.4
by bellaonline
05/05/12 03:53 PM
Shout Box

(Views)Popular Topics
Known public proxy servers 1689885
Integrated Index Page (IIP) 5.3.1 555705
Finished-[6.5.2] Games Arcade Deluxe v1.9 501236
Integrated Index Page (IIP) 5.1.1 415112
TLD Bv2.1 Released - Threads Links Directory 396822
[6.0x] Who's Online 4.0.0 [Finished] 389412
Finished-[6.5.1] Integrated Index Page (IIP) 6.5 330423
Q & A 298663
Slash UBB 266936
[6.3.x] [beta] Hit Hack 2.0 227970
Forum Stats
13621 Members
59 Forums
37191 Topics
295716 Posts

Max Online: 686 @ 06/28/07 07:04 AM

 

 

 
fusionbb message board php hacks