PDA

View Full Version : Session Hash


shiznatix
11-08-2007, 09:50 AM
Hello,

My installation of VB is not the main part of my website and I so I have many "hooks" into it to keep everything running smooth. Right now what I am trying to do is create my own registration page.

This is all setup and I have everything being saved to the database perfectly. Now the problem I am getting is when the user confirms their email address, I am trying to auto-login the users.

What is happening is that I am trying to create the session for VB and put it into the "session" table. Everything seams to be correct except the variable "sessionhash". I am trying to get that one to be correct but am unable to do it and thus the session that I create ends up being invalid and not used.

The code that I have been using is:
$session_id_hash = md5($_SERVER['HTTP_USER_AGENT'].implode('.', array_slice(explode('.', $_SERVER['REMOTE_ADDR']), 0, 3)));
$session_hash = md5(time().'/poker-forum/login.php?do=login&do=login'.$session_id_hash.$_SE RVER['REMOTE_ADDR'].rand(1, 1000000));

But for some reason I can not get the session_hash to be used by vbulletin. I tried to find where VB creates the sessionhash variable so I opened includes/class_core.php and went to the function fetch_sessionhash() and I tried to duplicate it in my $session_hash variable from above but it does not work.

So, how can I get this session hash variable? I need to be able to automatically log users in when they confirm their email and this is the only thing that is keeping me from doing so.

Thanks.