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 09-07-2007, 06:37 AM
jmottle jmottle is offline
 
Join Date: Aug 2003
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Read/Write vB Cookie with ASP

Does anyone know how to read and write the vB cookie with ASP. I've read tons of threads, but all are PHP based.

Cheers,
Jeff
Reply With Quote
  #2  
Old 09-07-2007, 09:40 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What do you need to know about them exactly? Or what are you going to do with them?
Reply With Quote
  #3  
Old 09-07-2007, 02:05 PM
jmottle jmottle is offline
 
Join Date: Aug 2003
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for your reply.

I am redoing our site and currently have several different login and member base systems and would like to use the vB user database as the only one to validate access to the forums as well as certain pages within our site.

I need to program a way to read and write the vB cookie to preserve the login. So there are a few questions I have.

1. I looked in the cookie and am able to read 'bbuserid' and 'bbpassword', so I am at least able to pull these values out to compare to a DB recordset. I am however unclear on the syntax and usage to compare MD5 hashes, which is what I assume is the value for 'bbpassword' in the cookie.

2. When someone checks 'remember me', do the vB pages do a database lookup and compare it to the cookie each time a vB page is accessed?

3. How to a write the MD5 password hash in ASP when a user first logs in so I can compare it to the database. I read something about the 'salt' column in the table, but was unclear how this works.

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

The password is md5'd. The salt field is then added onto the end of the hash, and then it is md5'd again.
Reply With Quote
  #5  
Old 09-08-2007, 09:07 AM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Does ASP have an MD5 function ?
Reply With Quote
  #6  
Old 09-08-2007, 09:19 AM
ragtek ragtek is offline
 
Join Date: Mar 2006
Location: austria, croatia
Posts: 1,630
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

try this:
Code:
<script runat="server">
   Function HashMD5(strText As String) As String

      If strText = Nothing Then strText = ""

      HashMD5 = System.Web.Security.FormsAuthentication. _
         HashPasswordForStoringInConfigFile(strText, "md5")

   End Function

strText = Request.QueryString("text")
   strHash = HashMD5(strText)

</script>
Reply With Quote
  #7  
Old 09-10-2007, 04:19 AM
jmottle jmottle is offline
 
Join Date: Aug 2003
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for the additional info!

I am seeing an odd problem though. I've used MD5 and the salt with a known password and it matched the hash in the database, but the cookie that vB writes has a different hash in the bbpassword field, yet the login works fine. How is this?
Reply With Quote
  #8  
Old 09-10-2007, 06:33 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The password cookie is the normal database hash, with the license number appended to the end and md5'd again.
Reply With Quote
  #9  
Old 09-10-2007, 01:46 PM
jmottle jmottle is offline
 
Join Date: Aug 2003
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ok, got it. Thanks.

Once last question I think. I see there is a session table in the database as well. Is this validated against when navigating and posting in the forum or is it only used when the user has elected not to have a persistant cookie login? If I need to use this, how does it work and how are 'sessionhash' and 'idhash' used?
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:06 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.04165 seconds
  • Memory Usage 2,232KB
  • 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
  • (1)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)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_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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete