vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Using the User DB table for another application (https://vborg.vbsupport.ru/showthread.php?t=74348)

Tom Freeman 01-14-2005 08:41 AM

Using the User DB table for another application
 
Hi,
I need some help. I have the lastest version or the forums (3) running on my server and I have a large database of users. I am now developing a new application but I only want to have ONE login, and basically use the login information and users from the forum. I presume this is possible.

I can see the information in the users table in the database. My question is really how are the sessions done when a user logs in? I'm pretty new to the PHP code for the forum and haven't done any hacks to it yet, so wondered if anyone could point me in the right direction.

Can I just query $_SESSION['username'] or something like that? Would be nice if it was that simple :ninja:

Thanks,
Tom

Tekton 01-14-2005 08:47 AM

I'd just require_once(path/global.php); or something in the php file.

Tom Freeman 01-14-2005 10:10 AM

Quote:

Originally Posted by Tekton
I'd just require_once(path/global.php); or something in the php file.

ok thanks, can you ellaborate a little bit? If I require the global.php file then what? Is there a variable somewhere I can query against to see if the user is logged in? And if so what their username is?

THanks for the help, i'm a bit confused :o

Andreas 01-14-2005 10:17 AM

$bbuserinfo['userid] and $bbuserinfo['username']

If you want to be independent from vBulletin backend you must (if existant) check the cookies bbuserid and bbpassword against the user table.
Or the username and password entered in your application, if it also does provide login.

Tekton 01-14-2005 10:23 AM

Quote:

Originally Posted by Tom Freeman
ok thanks, can you ellaborate a little bit? If I require the global.php file then what? Is there a variable somewhere I can query against to see if the user is logged in? And if so what their username is?

THanks for the help, i'm a bit confused :o

Then you can do anything you could in vBulletin pages basically (unless you needed to require some of the functions).

i.e. after grabbing the file make them login which is something like....

PHP Code:

require_once(~path~/global.php);
if(
$bbuserinfo[userid]==0){print_no_permission();} 

I can't remember off hand if that will work, but it might.

Tom Freeman 01-14-2005 11:23 AM

ok thanks, that makes sense, i'll give it a go.

One more thing though, I have my forum running under /forums/ on my server. My other application is running under /apd/. Do I have to move this to /forums/apd/ because I tried require_once('../forums/global.inc'); and it gave me this error.

Warning: main(./includes/init.php): failed to open stream: No such file or directory in /home/gadseek/public_html/forums/global.php on line 50

Fatal error: main(): Failed opening required './includes/init.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/gadseek/public_html/forums/global.php on line 50

I guess this is probably because under a different directory right?

Tekton 01-14-2005 11:27 AM

something like...
PHP Code:

chdir('../forums');
require(
'global.php');
chdir('../apd'); 

Is that how to do it?

Tom Freeman 01-14-2005 11:43 AM

cheers that does work, thanks! :)

Although having problems now because the login form it redirects me to tries to run login.php under the /apd/ directory. But I will sort that by hardcoding the form action to be /forums/login.php, rather than just login.php, which should sort it. Will just have to remember I changed that if I ever move the forums.

Next problem though is finding where in the distribution the form HTML code is! :) sure I will find it eventually.

Tom Freeman 01-14-2005 12:01 PM

ok I give up. Where can I find the HTML code which is generated on call to print_no_permission(); so I can edit the form action='login.php' to be form action='/forums/login.php'

Is it even stored on disk as a file, or in the database?

Cheers,

Marco van Herwaarden 01-14-2005 12:21 PM

Check out the includes/functions.php

You will find the print_no_permission function there.


All times are GMT. The time now is 02:33 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.02641 seconds
  • Memory Usage 1,735KB
  • 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
  • (2)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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