Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 02-04-2013, 07:52 PM
WorldCraft WorldCraft is offline
 
Join Date: Jun 2010
Posts: 240
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Custom PHP - Prevent vBulletin from timing users out?

Hello, I run a PHP-based Ajax chatroom on my forum that uses existing vBulletin logins for the chat. By design when users logout of the forums, they are automatically logged out from the chat as well. Unfortunately the auto-logout will occur to vB's timeout option (AdminCP -> Cookie Options -> Session Timeout).

The issue here is that many of my users will just want to chat and not browse the forums. They will be constantly logged out because vB "thinks" that they aren't being active. Is there any sort of PHP function or plugin I can set on the chat script so that they will not be timed-out?

Thanks,
Mike
Reply With Quote
  #2  
Old 02-05-2013, 01:21 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I assume your chat script is including global.php? If you add a call to exec_shut_down() (sometime after you're done with the vb stuff), it should keep the users active.
Reply With Quote
  #3  
Old 02-05-2013, 08:48 PM
WorldCraft WorldCraft is offline
 
Join Date: Jun 2010
Posts: 240
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

For some reason it's causing errors to occur. I am placing the function call under my global.php call - require(AJAX_CHAT_PATH.'../global.php');

This is what I get when trying to access the chat when already logged in to the forums:
Code:
Query: SELECT userID, userName, userRole, channel, UNIX_TIMESTAMP(dateTime) AS timeStamp, ip FROM ajax_chat_online ORDER BY userName; Error-Report: Error-Code:
If I try to go to the chat and try to login directly, I get this database error:
Code:
Database error in vBulletin 4.2.0:

 Invalid SQL:
 SELECT
                                                         forumid,
                                                         title
                                                 FROM
                                                         forum
                                                 WHERE
                                                         options & 4
                                                 AND
                                                         password='';;

 MySQL Error   :
 Error Number  :
 Request Date  : Tuesday, February 5th 2013 @ 01:44:14 PM
 Error Date    : Tuesday, February 5th 2013 @ 01:44:14 PM
 Script        : http://www.x.com/forums/chat/
 Referrer      : http://www.x.com/forums/forum.php
 IP Address    : 72.226.103.183
 Username      : Unregistered
 Classname     : vB_Database_MySQLi
 MySQL Version :
Reply With Quote
  #4  
Old 02-05-2013, 09:28 PM
DivisionByZero's Avatar
DivisionByZero DivisionByZero is offline
 
Join Date: Dec 2002
Location: South Bend, Indiana
Posts: 485
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

an easy way to keep users active would be to write an easy script that calls global.php and refreshes every X minutes inside a 1x1 iframe in your chat page.
Reply With Quote
  #5  
Old 02-06-2013, 02:21 AM
WorldCraft WorldCraft is offline
 
Join Date: Jun 2010
Posts: 240
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by DivisionByZero View Post
an easy way to keep users active would be to write an easy script that calls global.php and refreshes every X minutes inside a 1x1 iframe in your chat page.
Tried some Javascript functions that re-creates an iframe with the src pointed to globals.php at an interval. I still get timed out.
Reply With Quote
  #6  
Old 02-06-2013, 02:34 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by WorldCraft View Post
For some reason it's causing errors to occur. I am placing the function call under my global.php call - require(AJAX_CHAT_PATH.'../global.php');
I'm not sure why that's happening, but you would need to put the call to exec_shut_down() after anything that uses the vbulletin variables or functions. Maybe try moving it to the bottom.
Reply With Quote
  #7  
Old 02-06-2013, 05:08 AM
WorldCraft WorldCraft is offline
 
Join Date: Jun 2010
Posts: 240
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmm. Well the chat uses multiple PHP files to run, so finding the end of the vBulletin functions may be out of the question here.

--------------- Added [DATE]1360186567[/DATE] at [TIME]1360186567[/TIME] ---------------

Refreshing global.php in an iframe doesn't keep users active (nor does refreshing global.php in its own browser tab). Anything else I could try?
Reply With Quote
  #8  
Old 02-08-2013, 06:54 PM
miket1234 miket1234 is offline
 
Join Date: Dec 2009
Posts: 45
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I had the same problem and I solved it with installing a plugin called keep me log in. So basically, if you don't push the log out button from forum , the cookie never expire and you can chat until you close or the browser or you log out from forum.
Reply With Quote
  #9  
Old 02-10-2013, 04:20 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by WorldCraft View Post
Refreshing global.php in an iframe doesn't keep users active (nor does refreshing global.php in its own browser tab). Anything else I could try?

Maybe it will work if you use a script that includes global.php followed by a call to exec_shut_down().
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 05:47 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.05465 seconds
  • Memory Usage 2,243KB
  • 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
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete