Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 08 Sep 2008, 19:19
CtrlAltDel CtrlAltDel is offline
 
Join Date: Feb 2002
TIMENOW and access to it outside the Forum Software

I want to display a logout button to logged in users on my new custom homepage that I am writing. I have been able to recreate the logout hash, but since it is based off of appending "time()-" to the front, the value it gets is different than what the value would be when generated by login.php.

How do I get to the global TIMENOW variable that VB uses? Do I need to just include global.php into my application?

Is there another way to do this without including that entire file? Trying to avoid unnecessary bloat from 'over including' files.

TIA
__________________
Wii Have A Problem
Pirate Cove
Reply With Quote
  #2  
Old 08 Sep 2008, 19:58
Kirk Y's Avatar
Kirk Y Kirk Y is offline
 
Join Date: Apr 2005
There is no difference; vBulletin uses time() as TIMENOW.

See line 32 of init.php:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Check out line 1335 of functions.php:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

__________________
Former vBulletin.org Staff Member

Please feel free to re-use any of the code in any of my projects submitted to vB.org, so long as original attribution is retained.
Reply With Quote
  #3  
Old 08 Sep 2008, 20:11
CtrlAltDel CtrlAltDel is offline
 
Join Date: Feb 2002
Maybe I need to update the forum that I'm working with. As this is the code from my functions.php...


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Assume:
1. myscript.php is a script outside my forum root directory
2. login.php is the standard file included in vB

Appending time() in myscript.php is going to be different than the generated one that would be generated from login.php. So when I pass the hash from one myscript.php to login.php, login.php will error out and then display a new (and correct) logout link w/proper logouthash.

If the newest version of VB has dropped this timestamping feature of the logout hash then this simplifies things dramatically.
__________________
Wii Have A Problem
Pirate Cove
Reply With Quote
  #4  
Old 08 Sep 2008, 20:27
Kirk Y's Avatar
Kirk Y Kirk Y is offline
 
Join Date: Apr 2005
Ah, I didn't realize the 3.7.3 hash now included the time (I was looking at 3.7.0).

Try including your global file. At least then the constant would be in namespace.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

__________________
Former vBulletin.org Staff Member

Please feel free to re-use any of the code in any of my projects submitted to vB.org, so long as original attribution is retained.
Reply With Quote
  #5  
Old 08 Sep 2008, 20:48
CtrlAltDel CtrlAltDel is offline
 
Join Date: Feb 2002
Yeah I figured I had to do that so I started playing with that.

It works all well and good, but the logout hash is not correct. I click it and then I get an error page on login.php and it then generates a logouthash that is correct.

I wonder what magical step I'm missing. Maybe I'm missing setting some cookie var, or session var.

--------------- Added 09 Sep 2008 at 03:38 ---------------

By including the global.php shouldnt I be able to use things like $bbuserinfo inside my custom php page?

--------------- Added 09 Sep 2008 at 17:56 ---------------

figured it out, just needed to use the right variable, $vbulletin->userinfo['logouthash']
__________________
Wii Have A Problem
Pirate Cove

Last edited by CtrlAltDel; 09 Sep 2008 at 17:56. Reason: Auto-Merged DoublePost
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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


New To Site? Need Help?

All times are GMT. The time now is 20:56.

Layout Options | Width: Wide Color: