Log in

View Full Version : Must be logged in to view non-vb page?


snyx
08-10-2001, 08:42 PM
Yeah im curious if you can do this. I have a non-vb page, like another php script, and I want to make it so you can't view it, unless your logged in. Is this easy to pull off, or hard? Any help would be cool, thanks!

snyx

BradC
08-10-2001, 10:33 PM
chdir($DOCUMENT_ROOT . "/vb_folder");
require("./global.php");
chdir($DOCUMENT_ROOT . "/whateverthefoldernameis");

if ($bbuserinfo['userid']==0) {
echo"<center><font size=1 color=red style=verdana>You need to log in!</font>";
}
else
{
$username=$bbuserinfo['username'];
}


something like that might work

certify
08-16-2001, 09:05 AM
Will it work for .SHTML files?

PBC
07-06-2002, 04:03 AM
Here's an updated version that will also show a templated php file:


<?php
error_reporting(7);

require('./global.php');

if ($bbuserinfo['userid']==0) {
show_nopermission();
}

$username=$bbuserinfo['username'];
eval("dooutput(\"".gettemplate('templatenamehere')."\");");

?>


This will show the error/not logged in page if they are not logged in.

I left the CHDIR out, but feel free to add it if you need it.

Webmasta XT
08-13-2002, 05:31 PM
I want the same thing, except my non-vb page is on another server with a totally different database, is it possible?