Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 08-17-2007, 06:08 PM
dzineit dzineit is offline
 
Join Date: Aug 2007
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Logging in a User to VB from an external Script Help?

hey guys,

Going to try and keep figuring this out, but this is where I stand.

I have an external login script, login a user to my own backend I am building and VB. I want it so they only login once. So anyways long story short. When they Login, it inserts the required data to Sessions for VB. It has a row setup in user for VB.

When I login, I see my username in Active Users. But, when trying to post, It says I must login.

I have the following cookies set on login.

bbsessionhash
bblastactivity
bblastvisit

Long story short.

When posting, how does the system verify your logged on?
Reply With Quote
  #2  
Old 08-18-2007, 04:43 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Here's how to log users in.
PHP Code:
setcookie(COOKIE_PREFIX 'password'$passwordtime() + 14400);
setcookie(COOKIE_PREFIX 'userid'$useridtime() + 14400);

$password md5(md5(md5($password) . $salt) . $license); 
That's all there needs to be, other cookies will be automatically created by vBulletin.
Reply With Quote
  #3  
Old 08-20-2007, 12:45 PM
dzineit dzineit is offline
 
Join Date: Aug 2007
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

strangely this is not working...
Reply With Quote
  #4  
Old 08-20-2007, 12:52 PM
BulletxxProof89 BulletxxProof89 is offline
 
Join Date: Feb 2007
Location: MI, United States
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The function:
PHP Code:
function login($userid$pass_plaintext$salt$license){

$password md5(md5(md5($pass_plaintext) . $salt) . $license); 

setcookie('bbpassword'$passwordtime() + 14400);
setcookie('bbuserid'$useridtime() + 14400);


The login:
PHP Code:

login
(1,'password','3vt','1234567890'); 
Of course you fill in the data correctly from your MySQL query and your files.
Reply With Quote
  #5  
Old 08-20-2007, 01:03 PM
dzineit dzineit is offline
 
Join Date: Aug 2007
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

When is that function called?

lets try something else... So far my userid is set, password is set, but its not inserting my userid into the session in the database. So where does Vbulletin initally set the session from the forums index page. This way I can have the userid be inserted along with it.

When I manually do this via PHPMYADMIN I am logged it, and all is well...

This shit is not working. VB keeps deleting the cookies. How the hell. Help guys, common.

Both of those solutions successfully created the cookies but it is not working.. ANy Help???
Reply With Quote
  #6  
Old 08-21-2007, 12:58 PM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You need to create the sessions in the database yourself.
Reply With Quote
  #7  
Old 08-23-2007, 01:00 AM
Norco Norco is offline
 
Join Date: Jun 2007
Posts: 39
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Uhm.. what does the license mean?
Reply With Quote
  #8  
Old 08-23-2007, 01:21 AM
treelovinhippie treelovinhippie is offline
 
Join Date: Jul 2007
Posts: 18
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Dismounted View Post
You need to create the sessions in the database yourself.
How?
Reply With Quote
  #9  
Old 08-23-2007, 07:41 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Norco View Post
Uhm.. what does the license mean?
License number
Quote:
Originally Posted by treelovinhippie View Post
How?
Search for it, it was posted here, somewhere.
Reply With Quote
  #10  
Old 08-23-2007, 04:33 PM
Norco Norco is offline
 
Join Date: Jun 2007
Posts: 39
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have found my license. But, if I was logging in from mydomain.com and my forum is located on mydomain.net - it still wouldn't work because the cookie is set from mydomain.com, right?

And.. I have realized I am in the same situation as dzineit and treelovinhippie. Where does vbulletin have the query to set the session stuff in the database?

This is how it is adding the user into the forum AFTER they have logged into my website:
PHP Code:
function loginforum($userid$pass_plaintext$salt$license){
                
$password md5(md5(md5($pass_plaintext) . $salt) . $license); 
                
setcookie(COOKIE_PREFIX 'bbpassword'$passwordtime() + 14400);
                
setcookie(COOKIE_PREFIX 'bbuserid'$useridtime() + 14400);
                }
                
                
$getinfo mysql_query("SELECT * FROM `users` WHERE `username` = '$username'");
                while(
$r mysql_fetch_array($getinfo)){
                
$useridf $r['id'];
                
$passf $r['password'];
                
$saltf $r['salt'];
                }  
                
loginforum('$useridf','$passf','$saltf','LICENSE'); 
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:29 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04390 seconds
  • Memory Usage 2,268KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (4)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete