Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 01-22-2004, 06:59 AM
siLk's Avatar
siLk siLk is offline
 
Join Date: Aug 2003
Location: North Carolina, USA
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default username stored in vB cookie

i would like to see a small hack that stores the username in the cookie along with the userid.

I have comments for multiple content areas on my website right now, and would like to force them to register an account on the forums before they can post, and then have that username automatically show up.

thanks

Edit, figured it out myself, just adding 2 lines to login.php so not sure if it is really a hack or just a small mod

if anyone is interested, i can attach the lines here?
Reply With Quote
  #2  
Old 01-22-2004, 05:42 PM
Kentaurus's Avatar
Kentaurus Kentaurus is offline
 
Join Date: Dec 2001
Posts: 332
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by siLk
i would like to see a small hack that stores the username in the cookie along with the userid.

I have comments for multiple content areas on my website right now, and would like to force them to register an account on the forums before they can post, and then have that username automatically show up.

thanks

Edit, figured it out myself, just adding 2 lines to login.php so not sure if it is really a hack or just a small mod

if anyone is interested, i can attach the lines here?
You really don't need to store the username in a cookie. You can use $bbuserinfo[username] almost anywhere in a template and that would show the username.
Reply With Quote
  #3  
Old 01-22-2004, 05:43 PM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

guess not.... nvm ^^



you could accomplish this by including global.php to your outside the forum pages AND a simple if stamtnet
Reply With Quote
  #4  
Old 01-22-2004, 06:30 PM
siLk's Avatar
siLk siLk is offline
 
Join Date: Aug 2003
Location: North Carolina, USA
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I don't want to include global.php though, i want to keep the forums seperate from the other parts of the site, but still be able to enforce the use of a username.

Either way, the way I did it works like a charm and I am very happy with it
Reply With Quote
  #5  
Old 01-22-2004, 06:40 PM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by siLk
I don't want to include global.php though, i want to keep the forums seperate from the other parts of the site, but still be able to enforce the use of a username.

Either way, the way I did it works like a charm and I am very happy with it
but can be spoofed very ezily
Reply With Quote
  #6  
Old 01-22-2004, 07:30 PM
SteveK SteveK is offline
 
Join Date: Oct 2001
Location: Seattle, WA USA
Posts: 41
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

siLk,

Post your changes, please. Could be a simple solution to something I've been thinking about.

Thanks
Reply With Quote
  #7  
Old 01-24-2004, 04:08 AM
siLk's Avatar
siLk siLk is offline
 
Join Date: Aug 2003
Location: North Carolina, USA
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

In login.php I added the following cookies:

replace:
Code:
if ($_REQUEST['cookieuser'])
	{
		vbsetcookie('userid', $bbuserinfo['userid']);
		vbsetcookie('password', md5($bbuserinfo['password'] . 'L598544d'));
	}
with:

Code:
if ($_REQUEST['cookieuser'])
	{
		vbsetcookie('userid', $bbuserinfo['userid']);
		vbsetcookie('password', md5($bbuserinfo['password'] . 'L598544d'));
		vbsetcookie('username', $bbuserinfo['username']);
	}
and replace:
Code:
{
		// we have a cookie from a user and we're logging in as
		// a different user and we're not going to store a new cookie,
		// so let's unset the old one
		vbsetcookie('userid', '');
		vbsetcookie('password', '');
	}
with:

Code:
{
		// we have a cookie from a user and we're logging in as
		// a different user and we're not going to store a new cookie,
		// so let's unset the old one
		vbsetcookie('userid', '');
		vbsetcookie('password', '');
		vbsetcookie('username', '');
	}
The users will need to log out and log back in to set this new cookie however.

So far it works very well, the cookie $bbusername is available all over my domain and I can force people to use there forum name. Also, to check if they are registerd for the forums already, anywhere on the site without including global.php, just use a simple if: (your vB cookies must be set to the whole domain for this to work)

Code:
if (isset($bbuserid)) { 
               arguments 
               } else { 
               echo "please register at the forums before posting here or accessing this part of the site etc"; 
               }
By the way, if you are interested in see where / how this works, the site I am using it on is www.wcreplays.com
Reply With Quote
  #8  
Old 01-25-2004, 05:06 AM
SteveK SteveK is offline
 
Join Date: Oct 2001
Location: Seattle, WA USA
Posts: 41
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nice.

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


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.03905 seconds
  • Memory Usage 2,231KB
  • Queries Executed 11 (?)
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
  • (5)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)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