vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Query DB - Session Logged in? (https://vborg.vbsupport.ru/showthread.php?t=202637)

m002.p 01-21-2009 09:40 PM

Query DB - Session Logged in?
 
Hello!

I am after a way to detect using a mysql query whether a user on my vbulletin forum is logged in or not.

Basically, I have a few external scripts on the same server that instead of using a login system for, would like to simply add a query to the php files concerned and detect whether a user is logged in at the forums or not. If they are, then proceed otherwise refer to a denied page.

I have worked out the rest of the queries involved here, and would appreciate anyone who knows or can provide me with the MYSQL query to check the login status from the forum table.

In addition, does anyone know whether a users IP could be faked? I get a users IP and use it to identify them so I am wondering if this is not fail safe and a hacker could potentially fake or mask a users ip and appear to be them?

Any assistance is appreciated.

Matt

Dismounted 01-22-2009 03:05 AM

Include global.php, and then use this code (it will display an error message if not logged in).
PHP Code:

if ($show['guest'])
{
    
print_no_permission();



m002.p 01-22-2009 09:35 AM

Hello Dismounted.

Will this work on an external script though?

Thanks

Dismounted 01-23-2009 04:25 AM

Quote:

Originally Posted by Dismounted (Post 1720813)
Include global.php, and then use this code (it will display an error message if not logged in).[/php]

:).


All times are GMT. The time now is 05:28 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.00944 seconds
  • Memory Usage 1,719KB
  • 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_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)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