vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   External login logs out after 15 minutes (https://vborg.vbsupport.ru/showthread.php?t=269215)

punterzone 08-27-2011 03:33 AM

External login logs out after 15 minutes
 
I've managed to get a script working to login using vB on an external site, but users get logged out after 15 minutes (presumably due to lack of activity, even if I am doing something).

I guess the question is, how do I make vB think the user is doing something while they are "logged in" via my other site?

Thanks!

kh99 08-27-2011 05:55 AM

There was a thread on this not too long ago. I think the answer is that you should call exec_shut_down() at the end of your script, otherwise the session lastactivity time never gets written to the db.

punterzone 08-27-2011 10:06 AM

Here is my login, script. As you can see I do use exec_shut_down()

PHP Code:

define('START_CWD','/home/pzone/public_html');
define('CWD','/home/pzone/public_html/forum');
chdir(CWD);
include_once 
CWD.'/includes/class_hook.php';
include_once 
CWD.'/global.php';
chdir(START_CWD);
include_once(
'/home/pzone/public_html/forum/includes/functions_login.php');
$password=$_POST['password'];
$username=mysql_real_escape_string($_POST['username']);
$results=mysql_query("SELECT userid,zip,password,salt,dispid FROM com_user WHERE username='$username' LIMIT 1");
$row=mysql_fetch_assoc($results);
$password=md5(md5($password).$row['salt']);
$md5_pass=md5($_POST['password']);
$check=verify_authentication($_POST['username'], ''$md5_pass$md5_pass'0''1');
if(
$check){
    
exec_unstrike_user($username);
    
process_new_login(''$username'');
    
$vbulletin->url='/index.php';
    
exec_shut_down();
    
header('Location:/');
    exit;
}else{
    
header('Location:/loginfail');



kh99 08-27-2011 10:51 AM

OK, but that's your login script, right? You need to do something to get the lastactivity updated when they "doing something" (by which I assume you mean accessing other external pages?). You probably only need to do something like:

PHP Code:

define('START_CWD','/home/pzone/public_html'); 
define('CWD','/home/pzone/public_html/forum'); 
chdir(CWD); 
include_once 
CWD.'/includes/class_hook.php'
include_once 
CWD.'/global.php'
exec_shut_down(); 
chdir(START_CWD); 


on each of your external pages.

punterzone 08-27-2011 12:17 PM

Quote:

Originally Posted by kh99 (Post 2238668)
OK, but that's your login script, right? You need to do something to get the lastactivity updated when they "doing something" (by which I assume you mean accessing other external pages?). You probably only need to do something like:

PHP Code:

define('START_CWD','/home/pzone/public_html'); 
define('CWD','/home/pzone/public_html/forum'); 
chdir(CWD); 
include_once 
CWD.'/includes/class_hook.php'
include_once 
CWD.'/global.php'
exec_shut_down(); 
chdir(START_CWD); 


on each of your external pages.

Aaah I get you. I'll try this, expect it to work actually.

Thanks!

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

It worked :)

What actually is exec_shut_down() by the way..?

kh99 08-27-2011 12:56 PM

Quote:

Originally Posted by punterzone (Post 2238687)
What actually is exec_shut_down() by the way..?

I don't know everything it does, but I know that some db updates are kept until the end (I suppose to make the page look like it loads faster), and one of those is the one that updates the time that keeps the session active.


All times are GMT. The time now is 08:27 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.00998 seconds
  • Memory Usage 1,742KB
  • 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
  • (3)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)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