Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
  #1  
Old 10-24-2011, 02:30 AM
SnappedNet SnappedNet is offline
 
Join Date: Oct 2011
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Login and Authentication

Basicly, I'm trying to have use my own login form to login to vbulletin, the only problem is I can't retrieve the password from the database because of different levels of encryption.. How I do decrypt the password?

This is my current string:
PHP Code:
$qry="SELECT * FROM sn_user WHERE username='$username' AND password='".md5($_POST['password'])."'"
What do I change in the password='".md5($_POST['password'])."' to retrieve the password from the database correctly?

OR

How do I edit the login page so I can make it look similar to this:
Reply With Quote
  #2  
Old 10-24-2011, 03:10 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I believe you would want to compare the encrypted password from the database to:

Code:
md5(md5($_POST['password']) . salt)
but since salt is a column in the database, I'm not sure you can do it all in the query (but of course you can just read the record for that username, then check the password).

You can look at function verify_authentication() in includes/functions_login.php if you want to see how vb checks the password.
Reply With Quote
  #3  
Old 10-24-2011, 03:55 AM
SnappedNet SnappedNet is offline
 
Join Date: Oct 2011
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You have an extra bracket in there, or a bracket is missing?
Would it just be easier to use the functions_login.php to verify the login? If so, how can I do that?
Reply With Quote
  #4  
Old 10-24-2011, 10:43 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry about the extra bracket, I fixed it above.

The form for the existing login/password field in the navbar looks like this:

Code:
<script type="text/javascript" src="clientscript/vbulletin_md5.js?v=415"></script>
<form id="navbar_loginform" action="login.php?do=login" method="post" onsubmit="md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf, 0)">
	<fieldset id="logindetails" class="logindetails">
		<div>
			<div>
		<input type="text" class="textbox default-value" name="vb_login_username" id="navbar_username" size="10" accesskey="u" tabindex="101" value="User Name" />
		<input type="password" class="textbox" tabindex="102" name="vb_login_password" id="navbar_password" size="10" />
		<input type="text" class="textbox default-value" tabindex="102" name="vb_login_password_hint" id="navbar_password_hint" size="10" value="Password" style="display:none;" />
		<input type="submit" class="loginbutton" tabindex="104" value="Log in" title="Enter your username and password in the boxes provided to login, or click the 'register' button to create a profile for yourself." accesskey="s" />
			</div>
		</div>
	</fieldset>
	<div id="remember" class="remember">
		<label for="cb_cookieuser_navbar"><input type="checkbox" name="cookieuser" value="1" id="cb_cookieuser_navbar" class="cb_cookieuser_navbar" accesskey="c" tabindex="103" /> Remember Me?</label>
	</div>
 
	<input type="hidden" name="s" value="" />
	<input type="hidden" name="do" value="login" />
	<input type="hidden" name="vb_login_md5password" />
	<input type="hidden" name="vb_login_md5password_utf" />
</form>

So if you model your form after that one (i.e. use the same <form> and <input> tags but change them to display like you want), I think it should work the same and the built-in login.

Note that the above was copied from the HTML page source and not the template, because I wasn't sure if you were using templates for your new login page. If you are, then it's better to go to the navbar template and find the template code for the above. In the above code I removed the "securitytoken" hidden field because there's no way to set that in a static page, but if you use templates you should include it.
Reply With Quote
Благодарность от:
SnappedNet
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 02:23 PM.


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.04861 seconds
  • Memory Usage 2,187KB
  • 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
  • (2)bbcode_code
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (4)post_thanks_box
  • (1)post_thanks_box_bit
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (4)post_thanks_postbit_info
  • (4)postbit
  • (4)postbit_onlinestatus
  • (4)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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete