vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Building a hack (https://vborg.vbsupport.ru/showthread.php?t=32445)

pgowder 11-16-2001 06:10 PM

I'm starting an application for my site which will use some of the vB tables like users.

When I write my php code, what do I need to include to track user sessions, use the colors and styles of my vb, etc?

thanks

Admin 11-16-2001 06:22 PM

Code:

<?php
require('global.php');
?>

That PHP code is 100% powered by vBulletin.
That's all there is to it really. :)

Just make sure it's in the same folder as the rest of vBulletin's files.
Otherwise, you'll need to add a chdir() command before requiring global.php, for example:
Code:

chdir("/full/path/to/you/forum");

pgowder 11-16-2001 06:47 PM

Great, thanks!

MRK 11-17-2001 08:54 PM

couldnt you just do this:
Code:

<?php
require('/full/path/to/you/forum/global.php');
?>

heh. just wondering.

Palmer ofShinra 11-17-2001 10:44 PM

No, because Global.php references several other files on a relative path from the current directory, not the directory global.php is in.

If you were in www/ and specified the path /board/global.php

It looks for ./admin/functions.php

In this case, it would expect to find it at www/admin/functions.php

I found this out the hard way.

Admin 11-18-2001 05:05 AM

Exactly.
You can only include files like that if they are independent.

pgowder 11-28-2001 04:39 PM

I'm a little further in my design now.

I'm building an event calendar. I want to allow users to rate the event. And of coure limit it to only members and once per users.

What do I need to do to check to see if a person is logged in?

And if not, so them a log in screen?

thanks

Admin 11-28-2001 04:41 PM

Code:

if ($bbuserinfo[userid]==0) {
 // show_nopermission();
} else {
 // ok
}


pgowder 11-28-2001 05:12 PM

Ok, just tried that.

I placed the code below on a page.

Quote:

<?

chdir("/home/sites/home/web/gathering");
require('global.php');


if ($bbuserinfo[userid]==0) {
// show_nopermission();
} else {
// ok
}

chdir("/home/sites/home/web/gathering/pw_calendar");
?>
When I am logged in, no problems.

When I am not logged in, I get the following error:

Quote:

Warning: Cannot add header information - headers already sent by (output started at /home/sites/home/web/gathering/pw_calendar/pw_event_rate.php:9) in /home/sites/home/web/gathering/admin/functions.php on line 1459

pgowder 11-28-2001 05:14 PM

Just upgraded to 2.2.1

Still having the error.

thanks

pgowder 11-28-2001 06:34 PM

It now gives the error whether I'm logged in or not.

tubedogg 11-29-2001 05:00 AM

Remove the // in front of show_nopermission() for starters. Then remove any white space before the <? or after the ?> in your file.

pgowder 11-29-2001 11:35 AM

Ok, here is what I have now:

Quote:

<?
chdir("/home/sites/home/web/gathering");
require('global.php');


if ($bbuserinfo[userid]==0) {
show_nopermission();
} else {
print ('It worked'."\n");
}
?>

Still getting the same error??

Thanks

pgowder 01-04-2002 06:34 PM

I'm trying to do the following, where am I going wrong:

PHP Code:


<?
require('global.php');

if ($bbuserinfo[userid]==0) {
show_nopermission();
} else {
 $q= "SELECT * FROM user";
 $r= mysql_query($q) or die(mysql_error());
$row=mysql_fetch_object($r);
print (' '.$row->userid.' ');

}?>


pgowder 01-04-2002 06:37 PM

Nevermind, it works.


All times are GMT. The time now is 12:25 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.01192 seconds
  • Memory Usage 1,742KB
  • 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
  • (4)bbcode_code_printable
  • (1)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (15)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