PHP Classes

Session

Recommend this page to a friend!

      vBulletin Bridge  >  All threads  >  Session  >  (Un) Subscribe thread alerts  
Subject:Session
Summary:Session tracking
Messages:7
Author:jared sharen
Date:2009-10-25 22:04:01
Update:2014-07-18 06:47:27
 

  1. Session   Reply   Report abuse  
Picture of jared sharen jared sharen - 2009-10-25 22:04:01
I wish to use this to check and see if there is a current active vbulletin session? So my user comes to my vbulletin login, logs onto the system, and clicks a redirect to a purely custom page. In that page I wish to call your class to see if they are logged in, and if not then redirect to the vbulletin login page?

Thanks!

  2. Re: Session   Reply   Report abuse  
Picture of Sam Cleaver Sam Cleaver - 2009-10-26 17:49:29 - In reply to message 1 from jared sharen
Hi,
At the moment that functionality isnt in the class to "check" if theyre logged in, I plan to include this soon, for now you could use something like:
$sessioninfo = mysql_query("SELECT * FROM `session` WHERE `sessionhash` = '{$_COOKIE['bbsessionhash']}' LIMIT 1");
Process that to get the users session info into an array or whatever and then:
if($sessioninfo->userid!=0)
{
//Okay theyre logged in
}
else
{
//Theyre not logged in
}

  3. Re: Session   Reply   Report abuse  
Picture of jared sharen jared sharen - 2009-10-30 04:34:23 - In reply to message 2 from Sam Cleaver
Sam,
That worked perfectly!

One question I do have however, when I attempt to use your actual class I get the following error:

Fatal error: Call to a member function query_first_slave() on a non-object in C:\xampp\htdocs\sampleurl\app\webroot\includes\functions.php on line 1368

To clarify, I use cakephp. I know this is an issue with global scope vs this being called from within a class. However I am hoping you can assist in this regards.

Thanks!

  4. Re: Session   Reply   Report abuse  
Picture of Sam Cleaver Sam Cleaver - 2009-10-30 10:32:24 - In reply to message 3 from jared sharen
Hi Jared,
Is it just on the delete_user function that it does this or on any others? From the error it seems to be saying that when it calls:
$this->db->query_first_slave
$this->db is not an object, though it should be as its defined in the constructor, so yeah do the other functions that use $this->db work okay?

  5. Re: Session   Reply   Report abuse  
Picture of jared sharen jared sharen - 2009-10-30 13:21:30 - In reply to message 4 from Sam Cleaver
The problem is largely a cakephp problem, there is nothing specifically wrong with the code you have developed as long as I call it from an php page that is not integrated with cakephp.

You can see some discussion on it at vbulletin.org.

vbulletin.org/forum/showthread.php? ...

From what I have seen, this error happens the minute I attempt to include global.php. I've been trying to get this to work for a couple months on and off as a pet project, however my php skills are just not up to the task.

Unfortunately PHP is my hobby, my career is ABAP programming so I just don't have the time to learn as much as I'd like.

Anyway, if you have any idea's that would be great!

  6. Re: Session   Reply   Report abuse  
Picture of Sam Cleaver Sam Cleaver - 2009-10-30 13:32:16 - In reply to message 5 from jared sharen
Okay, well it seems as though some variables must be clashing with vbulletin etc within its scope, I've tried to move the includes into the constructor so we keep it all within the class, try using:
pastebin.com/m12c9a1cd
(remember to change the config stuff at the top again) and let me know if you have any luck.
That code is untested as I'm not on my main computer at the moment!

  7. Re: Session   Reply   Report abuse  
Picture of oliviagold oliviagold - 2014-07-18 06:47:27 - In reply to message 1 from jared sharen
live betting
www.betngo.com