PDA

View Full Version : Limit Guests on foreign scripts?


DAMINK
10-16-2010, 04:48 AM
Just wanting to know the correct code to use to add to a foreign script.
To ensure that only registered users are capable of viewing what i offer?

Bradley_Wint
10-16-2010, 06:03 AM
Foreign script? More details please.

DAMINK
10-16-2010, 08:56 PM
Foreign script? More details please.

A custom php script.
For example if i am to create a script and place it in the root directory then i would like to be able to prevent non registered users from viewing the page.

Lynne
10-16-2010, 09:47 PM
And is the global.php script included in your custom script? I fyou have that script included, then you can use basic vbulletin code.

DAMINK
10-17-2010, 12:37 AM
And is the global.php script included in your custom script? I fyou have that script included, then you can use basic vbulletin code.

Yes i tried to include the global file but it throws an error as below.

Warning: require(./includes/class_bootstrap.php) [function.require]: failed to open stream: No such file or directory in /home/ftwforum/public_html/global.php on line 15

So i assume this is because i am using a directory instead of the root for my script location?

--------------- Added 1287284215 at 1287284215 ---------------

Anyone got any ideas what i am doing wrong?
I can get it to work in the root directory using the below code.

<?php
require_once('./global.php');
if ($vbulletin->userinfo['userid']!=0) {
echo "Welcome Back, <b>";
echo $vbulletin->userinfo['username'];
} else {
echo "Sorry No Joy, <b>";
}
?>

But if i try this in a lower directory and change the location to global.php to ../global.php i get errors.

Normally errors like this.

Warning: require(./includes/class_bootstrap.php) [function.require]: failed to open stream: No such file or directory in /home/ftwforum/public_html/global.php on line 15

Now i tried defining the root like so.
define( ROOT_PATH , "./" );
But that did nothing either.
I know this is a simple answer but i am really not that good with PHP and even less skilled with VB. So any help here would be appreciated.