vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Read/Write vB Cookie with ASP (https://vborg.vbsupport.ru/showthread.php?t=157233)

jmottle 09-07-2007 06:37 AM

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

Dismounted 09-07-2007 09:40 AM

What do you need to know about them exactly? Or what are you going to do with them?

jmottle 09-07-2007 02:05 PM

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

Dismounted 09-08-2007 06:54 AM

The password is md5'd. The salt field is then added onto the end of the hash, and then it is md5'd again.

Paul M 09-08-2007 09:07 AM

Does ASP have an MD5 function ?

ragtek 09-08-2007 09:19 AM

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>


jmottle 09-10-2007 04:19 AM

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?

Dismounted 09-10-2007 06:33 AM

The password cookie is the normal database hash, with the license number appended to the end and md5'd again.

jmottle 09-10-2007 01:46 PM

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?


All times are GMT. The time now is 10:25 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.01083 seconds
  • Memory Usage 1,723KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete