vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=187)
-   -   See who is logged in outside of vBulletin (https://vborg.vbsupport.ru/showthread.php?t=41343)

nabeel 07-20-2002 10:00 PM

See who is logged in outside of vBulletin
 
PHP Code:

//PUT THIS AS THE VERY FIRST THING ON YOUR PAGE, BEFORE THE <html> TAG<?
                include_once("forums\\admin\\config.php");
    include_once("forums\\admin\\db_mysql.php");
    $DB_site=new DB_Sql_vb;
    $DB_site->appname='vBulletin';
    $DB_site->appshortname='vBulletin (forum)';
    $DB_site->database=$dbname
    $DB_site->server=$servername;
    $DB_site->user=$dbusername;
    $DB_site->password=$dbpassword;
    $DB_site->connect();

    include("forums\\admin\\functions.php");
    include("forums\\admin\\sessions.php");
?>

<?
//now you can check who is logged in, this can go anywhere
if($bbuserinfo['userid'] != 0){
        echo "welcome " . $bbuserinfo['username'] . "<br>your user id is: " . $bbuserinfo['userid'];
    }
?>


this could be used if you want to make sure someone is logged in before they come to your site, or a customized home page showing their info

ModshackUK 07-21-2002 03:25 PM

Ermmm does that not contain your password for your sql server ?

HM

nabeel 07-21-2002 03:26 PM

lol woops

i edited it

ModshackUK 07-21-2002 03:30 PM

LOL

Its ok I posted my IRCOP password the other day by accident but no one noticed :)

HM

Velocd 07-21-2002 03:32 PM

I'm amazed by your very detailed explanation in your first post by what this hack actually does :rolleyes: :p

If this is going at before the HTML tag, doesn't it still need the <?php and ?> tags?

I have this on my forum anyway, using one of Firefly's header online hacks, but installed on every page with some integration..

Good for those using HTML pages I suppose..

ModshackUK 07-21-2002 03:36 PM

I like the idea and will give it a shot later on tonight as I run another site thats mainly html based.

HM

nabeel 07-21-2002 03:37 PM

i couldnt get that one working, so i came up with this..took me a while. i added that stuff in.

blah...its too early :\

KuraFire 07-22-2002 10:21 AM

Erm, would this work if I want to see users, who are elsewhere on the site, on the Who's Online page of my vB?

nabeel 07-22-2002 03:57 PM

itll work if you wanna make a customized page on another part of your site.

im working on a "whos online" thing

webhost 07-25-2002 01:38 AM

This is what we use,
http://logitpro.com/

trackpads 08-30-2003 02:38 PM

How do you do this with VB3?

Thanks!

Dean C 08-30-2003 05:29 PM

No vb3 hacking is allowed until the RC stage :) ^^

trackpads 08-30-2003 06:24 PM

Is this considered hacking since I am not touching any of the VB3 files? I just want to do this on all the other pages of my site.

higabyte 08-31-2003 06:22 PM

Quote:

Yesterday at 03:24 PM trackpads said this in Post #13
Is this considered hacking since I am not touching any of the VB3 files? I just want to do this on all the other pages of my site.
i dont think its considered hacking since all you are doing is requiring them logging in before accessing your non vbulletin pages, heres how i did it:

I did something similar to this with my vb2.5 and upgraded to vb3 and it still works fine...

http://board.accordtuner.com/external.php

I mean I dont know how correct it is per say but it seems to do the job and thats all that matters..
.

Code:

<?php
$logged = ($user = $HTTP_COOKIE_VARS["bbuserid"]);

if ($logged >= "1") {
?>

your page code goes here.

<?php
}
if ($logged < "1") {
echo "<div align=center>You must be a registered user of the forums.<br><br>";
echo "Please click <a href=http://www.accordtuner.com?#login><i><b>here</b></i></a> ";
echo "to login first...<br><br>Or click <a href=http://board.accordtuner.com/register.php?&action=signup><i>";
echo "<b>here</b></i></a> to register with our forums.</div>";
}
?>


trackpads 09-01-2003 11:35 PM

Thanks!

That works on some pages but I get some funny errors on others. Have to play more but thanks again, I do apprecaite it.

What is really ironix is that I use phpbb for some content mgmt sites and I can now require VB membership to have people access the phpbb sites ;-)

otacon 09-26-2003 04:00 PM

does this work on VB 3

www.randomobjects.com/testme.php I get this.

trackpads 09-28-2003 12:53 PM

I am using VB 3 and it works

ttol 12-02-2003 01:21 PM

hey, there is a missing semicolon after $DB_site->database=$dbname. took me 20 minutes to find that.

agip33 12-17-2003 10:22 PM

if cookies are disabled OR the user sets "Automatically login when you return to the site? (uses cookies)" as NO...

will this still work? if not, how can i make it work without cookies.

hwtan 01-05-2004 05:24 AM

hmm.. what I usually do is:

PHP Code:

<?php

$self_dir 
getcwd();
chdir('/path/to/vbforum/');
require_once(
'./global.php');
chdir($self_dir);

print 
"<pre>";
print_r($bbuserinfo);
print 
"</pre>";

?>


DreyerMedia 06-13-2007 12:23 PM

Any updated versions of this?

Dismounted 06-14-2007 07:09 AM

PHP Code:

<?php
$cur_dir 
getcwd();
chdir('/path/to/vbforum/');
require_once(
'./global.php');
chdir($cur_dir);

if (
$vbulletin->userinfo['userid'] != 0)
{
   echo 
'Welcome ' $vbulletin->userinfo['username'] . '<br />Your user id is: ' $vbulletin->userinfo['userid'];

?>



All times are GMT. The time now is 03:33 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.01515 seconds
  • Memory Usage 1,760KB
  • 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
  • (3)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (22)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