vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Custom PHP - Prevent vBulletin from timing users out? (https://vborg.vbsupport.ru/showthread.php?t=294768)

WorldCraft 02-04-2013 07:52 PM

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

kh99 02-05-2013 01:21 AM

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.

WorldCraft 02-05-2013 08:48 PM

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 :


DivisionByZero 02-05-2013 09:28 PM

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.

WorldCraft 02-06-2013 02:21 AM

Quote:

Originally Posted by DivisionByZero (Post 2402236)
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.

kh99 02-06-2013 02:34 AM

Quote:

Originally Posted by WorldCraft (Post 2402219)
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.

WorldCraft 02-06-2013 05:08 AM

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?

miket1234 02-08-2013 06:54 PM

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.

kh99 02-10-2013 04:20 PM

Quote:

Originally Posted by WorldCraft (Post 2402322)
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().


All times are GMT. The time now is 09:17 AM.

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.02985 seconds
  • Memory Usage 1,734KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete