...

View Full Version : Only letting certain userlevals in forums....



johay
03-10-2007, 04:25 PM
I have a 'forum' It works fine, For evrything really. But what i want to do is, only let certain userlevals In, How would I do it To only let the ones with userleval "1" And above. :o

vinyl-junkie
03-10-2007, 05:18 PM
Which forum software are you using? Have you checked the documentation?

johay
03-10-2007, 05:39 PM
Which forum software are you using? Have you checked the documentation?

It's made in php,

I don't think I explaned it well. all I want to do is. to stop people going on the forum at the leval "0" I can do this, By just doing some querys to SQl, and a if statement. But, It dosn't stop them from posting. I can't do is, Like exit from the file if if you're user is "0"

vinyl-junkie
03-10-2007, 06:12 PM
I guess I didn't explain myself well either.

If you're using existing forum software, such as vBulletin, phpBB, etc., you should check the documentation, as it may offer answers to your questions. If this is custom built PHP forum software, you need to show us some of the code, perhaps the module that you think needs to be changed.

Without a little additonal information, we're just shooting in the dark.

johay
03-10-2007, 06:23 PM
I guess I didn't explain myself well either.

If you're using existing forum software, such as vBulletin, phpBB, etc., you should check the documentation, as it may offer answers to your questions. If this is custom built PHP forum software, you need to show us some of the code, perhaps the module that you think needs to be changed.

Without a little additonal information, we're just shooting in the dark.

Yeah,

Well, I was calling it 'userlevals' But in the following scripts are for mods, Ignore that that's for the staff. Since i'm pasteing the code what i'm wanting to do is the variable "crew". Basically so you can only access this forum if you are in the 'same group' as everyone else in this certain forum if that make sense.

Forum.php:
<?
session_start();
include "includes/functions.php";
logincheck();
$username=$_SESSION['username'];
include "includes/db_connect.php";
include"includes/smile.php";
$fetch=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$username'"));
$userlevel=$fetch->userlevel;
$crew=$fetch->crew;
$forum_look=$_GET['forum_look'];

$forum_count = 15;

echo $crew
if ($crew == 0) {
echo "You are not in a crew!";

function index_navigation($index, $count, $num) {
$forum = $_GET['forum'];
if ($index != 0) {
print "<a href=\"forum.php?forum=".$forum."&forum_look=" . ($index - $count) . "\"><<<Last</a> ";
}
if ($num == $count) {
print "<a href=\"forum.php?forum=".$forum."&forum_look=" . ($index + $count) . "\">Next>>></a>";
}


}
if (! isset($forum_look) ) {
$forum_look = 0;
}
?>


<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="includes/in.css" rel="stylesheet" type="text/css">
</head>

<body>

<table width=551 border=1 align="center" cellpadding=2 cellspacing=0 class=thinline rules=none>
<tr>
<td colspan=4 class=header><div align="center">Forum</div></td>
</tr>
<tr>
<td bgcolor=black height=1 colspan=4></td>
</tr>
<tr bgcolor=white>
<td align=center width=41% class=tip>Topics:</td>
<td align=center width=21% class=tip>Replies</td>
<td align=center width=18% class=tip>Topicstarter</td>
<td align=center width=20% class=tip>Last reply</td>
</tr>
<tr>
<td bgcolor=black height=2 colspan=4></td>
</tr>
<? $query=mysql_query("SELECT * FROM `topics` WHERE `forum`='$forum' ORDER BY `lastreply` DESC LIMIT $forum_look, $forum_count");
while($select=mysql_fetch_object($query)){
$num=mysql_num_rows($query);
$total=mysql_num_rows(mysql_query("SELECT * FROM replys WHERE idto='$select->id'"));
$last=mysql_fetch_object(mysql_query("SELECT * FROM replys WHERE idto='$select->id' ORDER by id DESC LIMIT 1"));
if ($select->sticky == "1"){
$typo = "<img src=images/forum/sticky.gif border=0>";
}else{
$typo = "<img src=images/forum/normal.gif border=0>";
}
?>
<tr>
<td height="41"><a href="forum_view.php?viewtopic=<?php echo "$select->id"; ?>&forum=<?php echo "$forum"; ?>"><?php echo "$typo"; ?>
<?php echo "$select->title"; ?></a></td>
<td align=center><?php echo "$total"; ?></td>
<td align=center><a href="profile.php?viewuser=<?php echo "$select->username"; ?>"><?php echo "$select->username"; ?></a></td>
<td align=center><a href="profile.php?viewuser=<?php echo "$select->username"; ?>"><?php echo "$last->username"; ?></a></td>
</tr> <? } ?>
<tr>
<td bgcolor=black height=2 colspan=4></td>
</tr>

<tr bgcolor=white>
<td align=right colspan=4 ><a href='topic.php?viewtopic=<?php echo "$viewtopic"; ?>&forum=<?php echo"$forum"; ?>'><font color="#000000">New
topic</font></a></td>
</tr>
</table>

<div align="center"><br>
<br>
<?php
index_navigation($forum_look, $forum_count, $num);
?>
</div>
</body>
</html>


Forum frame:

<?
session_start();
include "includes/db_connect.php";
include_once "includes/functions.php";
logincheck();
$username=$_SESSION['username'];

$forum = $_GET['forum'];
?>



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<title>Forum</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<frameset rows="*" cols="420,*" framespacing="0" frameborder="no" border="0">
<frame src="left.php?forum=<? print $forum; ?>" name="leftFrame" scrolling="auto" noresize>
<frame src="right.php?forum=<? print $forum; ?>&viewtopic=1" name="frameright">
</frameset>
<noframes><body>

</body></noframes>
</html>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum