PDA

View Full Version : How can I do this?


Mijae
02-24-2003, 04:12 AM
I have a gallery on my site, and I would like only registered members to be able to view it (basically I want people to sign up if they want to view the gallery).

So I have a gallery.php file outside my /forum/ directory, so if I move the gallery.php to the vB forum directory I'd like to add access restriction for registered members only.

How can I do this? (if I can)

Erwin
02-24-2003, 07:06 AM
At the top of the gallery.php file, find:


<?php


Underneath, ADD:


require("./global.php");
if ($bbuserinfo[userid]==0) {
show_nopermission();
}


Make sure the global.php file is in the same directory as the gallery.php file, or you will have to change the path to the global.php file. :)

Sebastian
02-24-2003, 08:16 AM
yeah all you have to do is include the global.php

you may have to use chdir() function first..

like this:


chdir("/forums/");
require("global.php");
if ($bbuserinfo[userid]==0) {
show_nopermission();
}


otherwise you will get include errors.

Mijae
02-24-2003, 11:28 PM
chdir was giving an error in safe mode, so the edit posted by Erwin did the work :)