Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 06-14-2008, 11:26 PM
vicmarconi vicmarconi is offline
 
Join Date: Jun 2008
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Redirect after login / logout to previous page

Hi!

I'm trying to integrate vBulletin with my site, which was done with Rails.
I want to use vBulletin's login system to the whole site, so users won't need to login twice (forum and site).

So I'm planning putting a login box that would send user's name and password to vbulletin's login system and redirect the user back to where they submitted the form (the previous page, in my site).

For the logout procedure, I have another question besides redirection. How "logouthash" is generated? I'd like to reproduce this hash using Rails.

Thanks for your atention and sorry for my poor english.
Reply With Quote
  #2  
Old 06-15-2008, 01:04 AM
MoT3rror MoT3rror is offline
 
Join Date: Mar 2007
Posts: 423
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Code:
$user['securitytoken'] = sha1($user['userid'] . sha1($user['salt']) . sha1(COOKIE_SALT));
$user['logouthash'] =& $user['securitytoken']; 
Found in function fetch_userinfo in functions.php. COOKIE_SALT is your license number.
Reply With Quote
  #3  
Old 06-15-2008, 02:23 AM
vicmarconi vicmarconi is offline
 
Join Date: Jun 2008
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for your reply.

But unfortunately I found something different at functions.php:

PHP Code:
$user['securitytoken_raw'] = sha1($user['userid'] . sha1($user['salt']) . sha1(COOKIE_SALT));
$user['securitytoken'] = TIMENOW '-' sha1(TIMENOW $user['securitytoken_raw']);

$user['logouthash'] =& $user['securitytoken']; 
It seems strange, because $user['securitytoken'] (and therefore, $user['logouthash']) should have a -.
Perhaps I'm not understanding what is going on around the last line.

=& means that $user['logouthash'] is the same as $user['securitytoken'], and not a copy (so, no big deal). Am I right?
Reply With Quote
  #4  
Old 06-15-2008, 02:39 AM
MoT3rror MoT3rror is offline
 
Join Date: Mar 2007
Posts: 423
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry looking at 3.7.0 and not 3.7.1.
Yes =& means it is the same and if a change is made it either it is made to the other I believe.
Reply With Quote
  #5  
Old 06-15-2008, 04:15 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

"=&" means to pass-by-reference and not pass-by-value.
Reply With Quote
  #6  
Old 06-16-2008, 01:25 AM
vicmarconi vicmarconi is offline
 
Join Date: Jun 2008
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, I managed to get some idea of how the logouthash is made by following the code you posted:

PHP Code:
$user['securitytoken_raw'] = sha1($user['userid'] . sha1($user['salt']) . sha1(COOKIE_SALT));
$user['securitytoken'] = TIMENOW '-' sha1(TIMENOW $user['securitytoken_raw']);

$user['logouthash'] =& $user['securitytoken']; 
But now I'm having difficulties reproducing TIMENOW on Ruby. Could you show me from where this value is retrieved?

And, I still have no clues how to redirect after login / logout, so users could login/logout from outside the forum and return to the same page.

I promess that I'll retribute this favor by posting a How-to integrate vBulletin with Ruby on Rails. As there is no forum coded with Rails (Ruby), everybody still relies on php solutions like vBulletin, and integrating both would be worthy.
Reply With Quote
  #7  
Old 06-16-2008, 01:43 AM
MoT3rror MoT3rror is offline
 
Join Date: Mar 2007
Posts: 423
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

TIMENOW is the current time in UNIX time. The login and logout already redirect the user to the page they were at.
Reply With Quote
  #8  
Old 06-18-2008, 05:45 AM
IUD IUD is offline
 
Join Date: May 2008
Posts: 16
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Same prob here
Reply With Quote
  #9  
Old 06-18-2008, 06:54 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What problem? Did you read all the replies?
Reply With Quote
  #10  
Old 06-18-2008, 08:09 PM
vicmarconi vicmarconi is offline
 
Join Date: Jun 2008
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Many thanks for your help !! I'm planning releasing a tutorial about the procedure of integrating Rails is vBulletin soon.
Reply With Quote
Reply


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 12:59 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04107 seconds
  • Memory Usage 2,256KB
  • 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
  • (3)bbcode_php
  • (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