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 04-04-2009, 10:26 AM
sv1cec sv1cec is offline
 
Join Date: May 2004
Location: Athens, Greece
Posts: 2,091
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Different cookie for AdminCP

Some years ago, when I first started using vB, I got frustrated from the fact that every time I logged out from the forums, I also got logged out from adminCP and vice versa. So I requested some help for that and another old timer, Nexialys, was good enough to come up with a two-lines code that you added in your init.php and did that. It created a different cookie prefix for AdminCP, so all was well.

Nexialys approach was very elegant and simple. It added a different cookie prefix, if you were in AdminCP than if you were in the Forums.

Unfortunately, being an old dog, I didn't follow up the development of vB, I had a hard time getting in grips with the coding scheme they developped after release 3.5. But now, I had just created a new site and I need that same functionality. I know I can use a different browser to avoid the problem, but I do not want to do that. All I want is to have separate cookies for AdminCP and for the Forums, so that when I log out of the one, it doesn't also log me out of the other. The current init.php is totally different than the old one used in vB 3.0 that I can work on. So.....

Can someone help me with this? Can someone come up with a way to have a different cookie prefix for admincp than for the forums?

Needless to say, your help will be greatly appreciated.
Reply With Quote
  #2  
Old 04-05-2009, 05:05 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

See functions_login.php, process_new_login().
Reply With Quote
  #3  
Old 04-05-2009, 07:15 AM
sv1cec sv1cec is offline
 
Join Date: May 2004
Location: Athens, Greece
Posts: 2,091
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ah, thank you very much Sir, sincerely appreciated. Time to study 3.8 code a little, but I think I can patch that function to work like my old one.

May I come back to you, if I face the wall??

Rgds and again, many thanks!
Reply With Quote
  #4  
Old 04-05-2009, 10:25 AM
nexialys
Guest
 
Posts: n/a
Default

ARGH, an old dog...

yeah, the function changed, to avoid my hack to work.. lol

i never touched it again, but i suppose it would be simple to modify the code by hand -- as there is no hook there!...
Reply With Quote
  #5  
Old 04-05-2009, 11:06 AM
sv1cec sv1cec is offline
 
Join Date: May 2004
Location: Athens, Greece
Posts: 2,091
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hey buddy, how are you? Long time no talk. How are you doing?

Now that I know where to look, I am sure I'll figure out how to patch the code. Who care for hooks? LoRL, I am still at 3.0.xx in my first site, managed to learn that quite good, I doubt if there is a single file on that site which doesn't contain one patch or another. But going to the latest versions, well, it's tough to teach an old dog new tricks.

Glad to see you around.

Au revoir mon ami! A bientot!

P.S. That old mod you made for me, doesn't even exist in this site, it was deleted (like others for 3.0.xx I guess) some time ago. Why people think that 3.0.xx is obsolete??

Ahhh Victory!!!!!

After some looking around, I managed it.

The patch has to be made in class_core, function fetch_config.

If anyone is interested, please let me know, I'll make it available.
Reply With Quote
  #6  
Old 04-05-2009, 07:02 PM
PaintballHQ PaintballHQ is offline
 
Join Date: Nov 2003
Location: Bunker Hill, WV
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by sv1cec View Post
Ahhh Victory!!!!!

After some looking around, I managed it.

The patch has to be made in class_core, function fetch_config.

If anyone is interested, please let me know, I'll make it available.
I am interested in this :up:
Reply With Quote
  #7  
Old 04-05-2009, 08:12 PM
sv1cec sv1cec is offline
 
Join Date: May 2004
Location: Athens, Greece
Posts: 2,091
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, let me get the original file so that I can have both the before and after the change code and I'll post it here some time tomorrow.
Reply With Quote
  #8  
Old 04-05-2009, 08:31 PM
PaintballHQ PaintballHQ is offline
 
Join Date: Nov 2003
Location: Bunker Hill, WV
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by sv1cec View Post
OK, let me get the original file so that I can have both the before and after the change code and I'll post it here some time tomorrow.
Thanks, appreciate it.
Reply With Quote
  #9  
Old 04-06-2009, 04:19 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

My guess: Find:
PHP Code:
define('COOKIE_PREFIX', (empty($this->config['Misc']['cookieprefix']) ? 'bb' $this->config['Misc']['cookieprefix'])); 
Replace With:
PHP Code:
define('COOKIE_PREFIX', (VB_AREA == 'AdminCP' 'cpprefix' $this->config['Misc']['cookieprefix'])); 
Reply With Quote
  #10  
Old 04-06-2009, 07:00 AM
sv1cec sv1cec is offline
 
Join Date: May 2004
Location: Athens, Greece
Posts: 2,091
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

As I said, my coding experience stops at vB 3.0.xx, so don't count me as the best alternative for advise, but here is what I did, based on Nexialys original hack, for 3.0. Don't ask me what the first conditional does, I have no idea, that's how Nexialys did it, that's how I did it.

Edit class_chore.php and find:

Code:
define('COOKIE_PREFIX', (empty($this->config['Misc']['cookieprefix']) ? 'bb' : $this->config['Misc']['cookieprefix']));
Replace that with:

Code:
$admincpdir = $this->config['Misc']['admincpdir'];
if (preg_match("/$admincpdir/i", $_SERVER['HTTP_REFERER']) OR (VB_AREA =='AdminCP'))
{
	$cookieprefix = 'acp_'.$this->config['Misc']['cookieprefix'];
}
else
{
	$cookieprefix = $this->config['Misc']['cookieprefix'];
}
define('COOKIE_PREFIX', (empty($cookieprefix)) ? 'bb' : $cookieprefix);
You can substitute 'acp_' with any prefix you want the admincp cookie to have.

Save the file and upload it to your server.

On a side note, I find it particularly frustrating (and it reminded me why I never upgraded to vB 3.5 etc) that the new coding scheme used by vB is so crazy. In some places, they use $vbulletin->config in other places they use $this->config. In some places, they use $this->config["$_SERVER[HTTP_REFERER]"], in other places they use $_SERVER['HTTP_REFERER'] and in others they user REFERRER. In some places, the $admincpdir works, while in others it doesn't. I really do not understand why it is so difficult to have a consistent coding scheme all over the place.
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:42 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.06647 seconds
  • Memory Usage 2,265KB
  • 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
  • (2)bbcode_php
  • (2)bbcode_quote
  • (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
  • (9)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