Quote:
Originally Posted by Gary W
Try something like:
PHP Code:
<?php
require_once('./global.php');
if ($_REQUEST[filename])
{
if ($bbuserinfo[usergroupid] == 6)
{
header("Location: $_REQUEST[filename]");
}
}
?>
Be sure to change the path to the global.php and the usergroupid as well (currently it's 6 for admins only).
Also, save this code in a file such as download.php and then you can use the file by linking to it like http://www.example.com/forum/downloa...=something.php which will download www.examlpe.com/forum/files/something.php if the user is an administrator.
|
I just want to make a correctiion to your code:
You use if($bbuserinfo[usergroupid]. On vb3, there is a new is_member_of function, that will search your primary and secondary groups for that user. Here is how the code works with it.
PHP Code:
<?php
require_once('./global.php');
if ($_REQUEST[filename])
{
if (is_member_of($bbuserinfo, 6) OR is_member_of($bbuserinfo, 5) OR is_member_of($bbuserinfo, 7));
{
header("Location: $_REQUEST[filename]");
}
}
?>
that makes it so usergroup 6 5 and 7 can download that file.