vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Sessions Created on External Page (https://vborg.vbsupport.ru/showthread.php?t=150951)

Mistah Roth 06-29-2007 12:39 PM

Sessions Created on External Page
 
So I finally have a somewhat working script that replicated the method in which vBulletin sets and stores sessions. The main algorithm is here:

Code:

$_SESSION['lastactivity'] = strtotime(date('dS M Y, H:i:s', $_SERVER['REQUEST_TIME']));

$_SESSION['sessionhash'] = md5($_SESSION['lastactivity'] . $_SERVER['REQUEST_URI'] . $_SESSION['idhash'] . $_SERVER['REMOTE_ADDR'] . rand(1, 1000000));

$sql = ("INSERT INTO `session` ( `sessionhash` , `userid` , `host` , `idhash` , `lastactivity` , `location` , `useragent`) VALUES ('".$_SESSION['sessionhash']."', '".$_SESSION['id']."', '".$_SERVER['REMOTE_ADDR']."', '".$_SESSION['idhash']."', '".$_SESSION['lastactivity']."', '".$_SERVER['REQUEST_URI']."', '".$_SERVER['HTTP_USER_AGENT']."')");

mysql_query($sql) or die(mysql_error());

This works for the most part, the ID hash is identical to the one that vBulletin sets, and I believe the sessionhash is correct as well.

When someone visits the forum, then goes to the non-vB site, the site grabs the session values OK

When someone logs into the forums, then goes to the site, the site grabs the session values OK

When someone visits the site, then goes to the forum, the forum grabs the session values OK

Where it messes up is when a user logs on to the site, then visits the forum, the forum creates a new session for the user (one that is not logged in).

Logging in sets session values in the database, as well as matching cookie values all properly, anyone know why the log in isn't transfering to the forums?

Mistah Roth 07-06-2007 12:13 PM

bump, $10 to anyone that helps me figure this out.

Mistah Roth 07-18-2007 03:41 PM

bump $20


All times are GMT. The time now is 03:49 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.01596 seconds
  • Memory Usage 1,711KB
  • 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
  • (1)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)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