I was wondering if there was a mod or a way to protect pages so only members of the forums could enter, or even better members in a sertain group. If not can you just tell me a good way to password a directory, so when so go in it only asks for it once.
thx
Yeah i done it in phpBB, just check if the user ID from actual session match any of users ID's in certain group. If not redirect, or just show message that the site cant be viewed.
thanks, but i realy dont know anything about php, could you help me a bit more?
| clownFart wrote: |
| thanks, but i realy dont know anything about php, could you help me a bit more? |
Ok i give you example (i made it for phpBB forums)
| Code: |
$group_id = groupid; // enter here your group id
$user_id=$userdata['user_id'];
$sql = "SELECT user_id
FROM " . USER_GROUP_TABLE . "
WHERE group_id = $group_id AND user_id = $user_id";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain user and group information', '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
if ( $row['user_id'] != $userdata['user_id'])
{
die("You Are Not In That Group!");
}
This text can only be seen for members from certain group. |
Well i advice you to learn about php and mysql if you want to change / upgrade / make scripts. There's so many tutorials in internet, and many you can learn in just one day.
Thank you very much for your help. I've put your code in my page and got a couple of errors, I'm pretty sure I fixed them. Now I get this error:
Fatal error: Call to a member function on a non-object in /home/clownfar/domains/cwa.frih.net/public_html/forums/mo.php on line 326
| Code: |
<?php
$group_id =-CWA- Clan; // enter here your group id
$user_id=$userdata['user_id'];
$sql = "SELECT user_id
FROM " . USER_GROUP_TABLE . "
WHERE group_id = $group_id AND user_id = $user_id";
if ( !($result = $db->sql_query($sql)) ) //LINE 326
{
message_die(GENERAL_ERROR, 'Could not obtain user and group information', '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
if ( $row['user_id'] != $userdata['user_id'])
{
die("You Are Not In That Group!");
}
echo "This text can only be seen for members from certain group.";
?>
|