Script to make a page viewable by certain ranks only?

Links for php scripts

Moderators: macek, egami, gesf

otarts
New php-forum User
New php-forum User
Posts: 11
Joined: Sat Jan 01, 2005 9:23 am

Script to make a page viewable by certain ranks only?

Postby otarts » Sat Jan 01, 2005 9:26 am

I have a php forum I'm using and there is no way included to make a forum only visible to admins, mods, or other certain ranks. Can anyone help me on what I need so that the forum is only visible to certain people?
Thanks.

User avatar
Oleg Butuzov
Last Samuray
Last Samuray
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

Postby Oleg Butuzov » Sat Jan 01, 2005 9:55 am

telepats have vacetion....

User avatar
Alexej Kubarev
Site Admin
Site Admin
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län
Contact:

Postby Alexej Kubarev » Sat Jan 01, 2005 11:13 am

A brain would really help...
Also you will need a basic knowlege of SQL and some good knowlege of PHP..


Wel... anyways... try making it work this way:

When you are showing a topic or something: let it check who is that person... if that person HAS an access: show it... otherwise: not..

So... what you will need to do is add a special column in the database that will contain an id of a group that may view this forum/topic..

You will need to alter several files, including login (to spare the information about the group id, that is if you dont want to make extra query).

More i cannot tell you cuz i have no idea about what forum script you are running and no more information is available from you so far..

otarts
New php-forum User
New php-forum User
Posts: 11
Joined: Sat Jan 01, 2005 9:23 am

Postby otarts » Sat Jan 01, 2005 11:49 am

Well I'm using this forum code
http://prdownloads.sourceforge.net/gbx/ ... X-v1.1.zip

It's simple and I like it.


I'm sorry for being such a noob, this is my first experience with Php so I'm having alot of trial and error and plenty of confusion. I would think I would need a script that would say something such as



<?php
if($perm == '1'){
?>

<?php
} else {
accessdenied();
}
?>



It's okay if all the people can see that the forum is there, just that if they click it they are denied. Though invisibility would be ideal. I know there must be some kind of code to acknowledge user ranks and add restrictions to them.....I hope there is atleast.

I'd link you to my actual forum here but my webspace isn't loading for some reason. So here's someone else's if you want to see what it looks like. Dont think this would really help any though.
http://www.dedlockmusic.com/forums/index.php

Any help is greatly appreciated.
Last edited by otarts on Sat Jan 01, 2005 3:52 pm, edited 1 time in total.

User avatar
Alexej Kubarev
Site Admin
Site Admin
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län
Contact:

Postby Alexej Kubarev » Sat Jan 01, 2005 12:35 pm

unfortunately im affraid that without a knowlege of PHP you are not going to be able to do so...

otarts
New php-forum User
New php-forum User
Posts: 11
Joined: Sat Jan 01, 2005 9:23 am

Postby otarts » Sat Jan 01, 2005 12:48 pm

that's a shame

User avatar
Alexej Kubarev
Site Admin
Site Admin
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län
Contact:

Postby Alexej Kubarev » Sat Jan 01, 2005 1:20 pm

Yes in deed... but i will take a look at that script for you... I might do some modifications for you... I will not prommise anything thou...

User avatar
Alexej Kubarev
Site Admin
Site Admin
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län
Contact:

Postby Alexej Kubarev » Sat Jan 01, 2005 1:31 pm

Ehh...Take my advise... take phpBB or something like that... Because this script has some things that concern me... i mean security and stuff like that... I might be a bit wrong but i didnt like the login script..

phpBB will work much better for you... its quite easy to use... and a very powerfull one... so tak that one instead... i think phpBB has the functionality that you want to have..

otarts
New php-forum User
New php-forum User
Posts: 11
Joined: Sat Jan 01, 2005 9:23 am

Postby otarts » Sat Jan 01, 2005 3:51 pm

well this is for privite use and more just learning some php, I't wont ever be a heavly populated forum and will probably only be up for a short while.
I found out the code used to block admin pages off and it's

At the beggining. (The 1 is the admin status, 2 would be mod, 3 registed user, etc)

<?php
if($perm == '1'){
?>

and at end it

<?php
}else{
accessdenied();
}
?>


The thing is I don't know where to put it. I can't just open and add it to the forum. I need to find a way to add that code to the forum page I want locked out. But if I make a new board and name it something such as admins only it doesnt create a physical file that I could open and add this code to.

There is probably a really easy answer but since I don't know what to look for I cant find it.

User avatar
Alexej Kubarev
Site Admin
Site Admin
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län
Contact:

Postby Alexej Kubarev » Sun Jan 02, 2005 3:04 am

Okej... i've told you already how to do that:

You need a new column in the SQL database..
Name it: "visible_to" for instance..

Then alter the admin page that creates a new forum and add the function that will allow you to choose whethere to make it visible to:
all => visible_to=3
moderators+admins => visible_to=2
only admins => visible_to=1

Then you will need to alter a php file that shows the forum...

There you will need to fetch that row from the database.. you will also need to know what user group does the person belong too..

Then check... if the user belongs to a group that has higher $perm then visible_to for that forum -- dont show it... and redirect to some page or output an error message.. else -- show :)

Thats really a simple algorithm... jsut that you will need to look around.. :D

otarts
New php-forum User
New php-forum User
Posts: 11
Joined: Sat Jan 01, 2005 9:23 am

Postby otarts » Sun Jan 02, 2005 12:57 pm

as you could have guessed im a little confused. Please bear with me though.
I think I may see what I need to do.
I can see the info forindividual forums now and do I need to find a way to add visible to the colums like the ones below?
Image

If that is the case how do I do this?


Also with adding that colum to the SQL database I can't seem to find how to do that. THe closest thing I have gotten to is this
Image
Could it be something like

(UPDATE `testboards` SET `visible_to=group_id ` = '1' WHERE `board_id` = '3' LIMIT 1 ;)

I can export the board file and get this

CREATE TABLE `testboards` (
`name` varchar(255) default NULL,
`board_id` int(10) unsigned NOT NULL auto_increment,
`cat_id` tinyint(4) default '1',
`boardorder` int(11) default NULL,
PRIMARY KEY (`board_id`),
FULLTEXT KEY `name` (`name`)
) TYPE=MyISAM AUTO_INCREMENT=7 ;

#
# Dumping data for table `testboards`
#

INSERT INTO `testboards` VALUES ('General', 1, 1, 1);
INSERT INTO `testboards` VALUES ('Off Topic', 2, 1, 1);
INSERT INTO `testboards` VALUES ('Admins Only', 3, 2, 1);


Would I add it in there and then replace that file?

Please help guide me through this.

User avatar
Alexej Kubarev
Site Admin
Site Admin
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län
Contact:

Postby Alexej Kubarev » Sun Jan 02, 2005 1:53 pm

You are using PMA -- therefore you should go to the structure tab, click on add 1 new row

Call it visible_to, type: INTEGER

otarts
New php-forum User
New php-forum User
Posts: 11
Joined: Sat Jan 01, 2005 9:23 am

Postby otarts » Sun Jan 02, 2005 2:14 pm

Go to structure from the main page or board page?
Well niether have a add row option, the main page has this though.


There is an add one field though.
Image

that it? It has name and type, but there's alot of other options

User avatar
Alexej Kubarev
Site Admin
Site Admin
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län
Contact:

Postby Alexej Kubarev » Sun Jan 02, 2005 2:49 pm

Yes...everything is correct... not the 3d option thou.. Length... leave it blank... and set the default value to 3 (if you want to make it available to all users..) or 1 -- for only admins by default

otarts
New php-forum User
New php-forum User
Posts: 11
Joined: Sat Jan 01, 2005 9:23 am

Postby otarts » Sun Jan 02, 2005 3:02 pm

okay now it looks like this

Image


now how do I get it to recognize that 1 is admins. It didnt seem to automaticly see that 1 means user group1.

User avatar
Alexej Kubarev
Site Admin
Site Admin
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län
Contact:

Postby Alexej Kubarev » Sun Jan 02, 2005 3:36 pm

No, ofcourse not :)

It will have to be made through a script.. it will take quite a while to change everything.. like i said... i can guide you through everything but will not make the whloe thing...

The next thing you need to find out is find where in the script the topic is show... i mean what file shows the topic..

You will need to alter that script to check what group the current user bellongs to and what visible_to value is for that forum..

Then compare and make an output based on the result..

otarts
New php-forum User
New php-forum User
Posts: 11
Joined: Sat Jan 01, 2005 9:23 am

Postby otarts » Sun Jan 02, 2005 3:45 pm

I have some php files

viewmain.php
viewthreads.php

main is the main page that shows all the forums
and view threads is once you're in the forum and see the topics people have made.


So I need to change viewthreads?

If so I'm going to need some coding help, there's alot of code and I dont know where to put this code to check or even the code i need to alter.

Code: Select all

   FileManager 

   

<?php

/*****************************************************************************/
/* viewthreads.php                                                           */
/*****************************************************************************/
/* Gravity Board X                                                           */
/* Open-Source Project started by Jonathan Taft (headchimp@rapmonkey.com)    */
/* Software Version: GBX Version 1.0                                         */
/* ========================================================================= */
/* Copyright (c) 2002-2003 Gravity Board X Developers. All Rights Reserved   */
/* Software by: The Gravity Board X Development Team                         */
/*****************************************************************************/
/* This program is free software; you can redistribute it and/or modify it   */
/* under the terms of the GNU General Public License as published by the     */
/* Free Software Foundation; either version 2 of the License, or (at your    */
/* option) any later version.                                                */
/*                                                                           */
/* This program is distributed in the hope that it will be useful, but       */
/* WITHOUT ANY WARRANTY; without even the implied warranty of                */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General */
/* Public License for more details.                                          */
/*                                                                           */
/* The GNU GPL can be found in gpl.txt, which came with your download of GBX */
/*****************************************************************************/

mysql_query("UPDATE " . $prefix . "stats SET boardviews=boardviews+1") OR DIE("Gravity Board X was unable to log your board view: " . mysql_error());
if($sr == '2'){
mysql_query("UPDATE " . $prefix . "members SET boardviews=boardviews+1 WHERE memberid='$memberid'") OR DIE("Gravity Board X was unable to log your member board view: " . mysql_error());
}

$boardquery = mysql_query("SELECT name FROM " . $prefix . "boards WHERE board_id = '$board_id'") OR DIE("Gravity Board X was unable to retrieve the board data from the database: " . mysql_error());

list($bn) = mysql_fetch_row($boardquery);

?>
<center>
<table class=station width="100%">
  <tr>
    <td class=header colspan=7 width="90%" height="18">
    <p>
    <b><a href="index.php"><font class=headerfont><?php echo $boardname; ?></a>: <?php echo $bn; ?></font></b></td>
    </tr>
<?php
if($perm == '1'){
?>
<SCRIPT LANGUAGE="javascript">
<!--
function confirmboarddelete()
{
   if(confirm("Are you sure you would like to delete this board and all threads and posts associated with it?\nThis may NOT be undone!!"))
   {
   if(confirm("Please confirm that you would like to delete this board and all threads and messages assiciated with it.\nThis may NOT be undone!!"))
      location='index.php?action=deleteboard&board_id=<?php echo $board_id; ?>'
   }
}
//-->
</SCRIPT>
  <tr>
    <td colspan=7>
   <p><b>Admin Options:</b> <a href="javascript:confirmboarddelete()">Delete Board</a></p>
    </td>
  </tr>
<?php
}
?>
  <tr>
    <td class=row3 colspan=7 style="padding: 0px;"><table>
  <tr>
    <td class=row3 onclick="document.location.href='index.php?action=postnew&board_id=<?php echo $board_id; ?>'" onmouseover="this.className='rollover'" onmouseout="this.className='row3'">
   <p><b>New Thread</b></p>
        </td>
      </tr>
    </td>
  </tr>
</table>
  <tr>
    <td width="4%"></td>
    <td width="46%">
    <p align="center"><b><font class=small>Thread</b></td>
    <td width="18%">
    <p align="center"><b><font class=small>Author</b></td>
    <td width="5%">
    <p align="center"><b><font class=small>Replies</b></td>
    <td width="5%">
    <p align="center"><b><font class=small>New</b></td>
    <td width="20%">
    <p align="center"><b><font class=small>Last Post</b></td>
  </tr>
<?php

$num = $skip*30;

$tcquery = mysql_query("SELECT COUNT(*) FROM " . $prefix . "threads WHERE board_id = '$board_id'") OR DIE("Gravity Board X was not able to retrieve a thread count: " . mysql_error());
list($count) = mysql_fetch_row($tcquery);
#######################
##LIST STICKY THREADS##
#######################
$stickyquery = mysql_query("SELECT * FROM " . $prefix . "threads WHERE board_id = '$board_id' && sticky = '1' ORDER BY last_msg_time DESC") OR DIE("Gravity Board X was unable to retrieve the sticky thread data from the database: " . mysql_error());
while($stickyinfo = mysql_fetch_assoc($stickyquery)){
   $stickytemp2 = mysql_query("SELECT * FROM " . $prefix . "members WHERE memberid = '$stickyinfo[memberid]'") OR DIE("Gravity Board X was unable to retrieve the data from the member database: " . mysql_error());
   $stickytemp = mysql_query("SELECT * FROM " . $prefix . "posts WHERE msg_id = '$stickyinfo[first_msg]'") OR DIE("Gravity Board X was unable to retrieve the data from the database: " . mysql_error());
   while($postinfo = mysql_fetch_assoc($stickytemp)){
?>
  <tr>
    <td class=floatrow width="2%" height="25" align="center">
<center>
<?php

if($stickyinfo[locked] == "1" AND $stickyinfo[reply_num] <= "15") { echo "<img src=images/locked_thread.gif alt='Locked Thread'>"; } elseif($stickyinfo[locked] == "1" AND $stickyinfo[reply_num] >= "15") { echo "<img src=images/hotlocked_thread.gif alt='Hot/Locked Thread'>"; } else { echo "<img src=images/regular_thread.gif alt='Regular Thread'>"; }

?>
</center>
</td>
    <td class=floatrow width="46%" height="25" align="left">
<?php

##include("messagesread.php");

##CENSOR THREADS
$postinfo[subject] = stripslashes($postinfo[subject]);
$postinfo[subject] = censor($postinfo[subject]);

if($new >= '1'){ echo '<b>'; }
?>
    <font class=subjectfont><a href="index.php?action=viewthread&thread_id=<?php echo $stickyinfo[thread_id]; ?>&board_id=<?php echo $board_id; ?>" onMouseOver="window.status='<?php echo $bn; echo ': '; echo $postinfo[subject]; ?>'; return true" onMouseOut="window.status=''; return true"><?php echo $postinfo[subject]; ?></font>
<?php
if($new >= '1'){ echo '</b>'; }
?>
</a></td>
    <td class=floatrow width="16%" height="25" align="left">
<b><a href="index.php?action=viewprofile&member_id=<?php echo $postinfo[memberid]; ?>">
<?php

   $threadtemp3 = mysql_query("SELECT * FROM " . $prefix . "members WHERE memberid = '$postinfo[memberid]'") OR DIE("Gravity Board X was unable to retrieve the data from the member database: " . mysql_error());
   while($tsi = mysql_fetch_assoc($threadtemp3)){

##BEGIN USER RANK CHECK
   $pcquery = mysql_query("SELECT COUNT(*) FROM " . $prefix . "posts WHERE memberid = '$postinfo[memberid]'") OR DIE("Gravity Board X was unable to locate a users rank: " . mysql_error());
   list($pc) = mysql_fetch_row($pcquery);
   include("ranks.php");
##END USER RANK CHECK
##CHECK USER PERMISSIONS
   $mgquery = mysql_query("SELECT * FROM " . $prefix . "membergroups WHERE group_id = '$tsi[memberGroup]'") OR DIE("Gravity Board X was unable to verify a users member group: " . mysql_error());
   while($mg = mysql_fetch_assoc($mgquery)){
##END USER PERMISSION CHECK
?>
<font class=small color="<?php if($mg[group_type] == '1'){ echo $admincolor; }elseif($mg[group_type] == '2'){ echo $modcolor; }else{ echo $rankcolor; } ?>"><?php echo $tsi[displayname]; ?></a></font></b></td>
<?php
   }
}
?>
    <td class=floatrow width="5%" height="25" align="center">
    <font class=small><?php echo $stickyinfo[reply_num]; ?></font></td>
    <td class=floatrow width="5%" height="25" align="center">
    <font class=small><?php echo 'X'; ##echo $new; ?></font>
    <td class=floatrow width="23%" height="25" align="right">
<?php
   $threadtemp4 = mysql_query("SELECT memberid FROM " . $prefix . "posts WHERE msg_id = '$stickyinfo[last_msg]'") OR DIE("Gravity Board X was unable to retrieve the data from the database: (2)" . mysql_error());
   list($lpi) = mysql_fetch_row($threadtemp4);
   $threadtemp5 = mysql_query("SELECT * FROM " . $prefix . "members WHERE memberid = '$lpi'") OR DIE("Gravity Board X was unable to retrieve the data from the member database: (2)" . mysql_error());
   while($poster = mysql_fetch_assoc($threadtemp5)){

##BEGIN LAST POST USER RANK CHECK
   $pcquery = mysql_query("SELECT COUNT(*) FROM " . $prefix . "posts WHERE memberid = '$poster[memberid]'") OR DIE("Gravity Board X was unable to locate a users rank: " . mysql_error());
   list($pc) = mysql_fetch_row($pcquery);
   include("ranks.php");
##END USER RANK CHECK
?>
    <font class=small><a href="index.php?action=viewthread&thread_id=<?php echo $stickyinfo[thread_id]; ?>&board_id=<?php echo $board_id; ?>#<?php echo $stickyinfo[last_msg]; ?>" onMouseOver="window.status='<?php echo $bn; echo ': '; echo $postinfo[subject]; ?>'; return true" onMouseOut="window.status=''; return true">
<?php
$slpt = date ("m/d/Y h:i:s A",$stickyinfo[last_msg_time] + $timeadjust);
echo $slpt;
?>
</a><br>
    </font>
<?php
##CHECK USER PERMISSIONS
   $mgquery = mysql_query("SELECT * FROM " . $prefix . "membergroups WHERE group_id = '$poster[memberGroup]'") OR DIE("Gravity Board X was unable to verify a users member group: " . mysql_error());
   while($mg = mysql_fetch_assoc($mgquery)){
##END USER PERMISSION CHECK
?>
    <font class=small>by <b><a href="index.php?action=viewprofile&member_id=<?php echo $lpi; ?>"><font color="<?php if($mg[group_type] == '1'){ echo $admincolor; }elseif($mg[group_type] == '2'){ echo $modcolor; }else{ echo $rankcolor; } ?>"><?php echo $poster[displayname]; ?></a></font></b></td>
<?php
}
}
?>
    <td class=floatrow width="2%" height="25" align="center">
<?php
if($perm == '1') {
if($stickyinfo[sticky] == "1") { echo "<a href=index.php?action=float&thread_id=" . $stickyinfo[thread_id] . "&board_id=" . $board_id . "><img src=images/sticky_thread.gif border=0 alt='Floated Thread - Click to sink'></a>"; } else { echo "<a href=index.php?action=float&thread_id=" . $stickyinfo[thread_id] . "&board_id=" . $board_id . "><img src=images/nonsticky_thread.gif border=0 alt='Regular Thread - Click to float'></a>"; }
} elseif($perm == '2') {
if($stickyinfo[sticky] == "1") { echo "<a href=index.php?action=float&thread_id=" . $stickyinfo[thread_id] . "&board_id=" . $board_id . "><img src=images/sticky_thread.gif border=0 alt='Floated Thread - Click to sink'></a>"; } else { echo "<a href=index.php?action=float&thread_id=" . $stickyinfo[thread_id] . "&board_id=" . $board_id . "><img src=images/nonsticky_thread.gif border=0 alt='Regular Thread - Click to float'></a>"; }
} else {
if($stickyinfo[sticky] == "1") { echo "<img src=images/sticky_thread.gif border=0 alt='This thread was floted by an admin or moderator'>"; } else { echo "<img src=images/nonsticky_thread.gif>"; }
}
?>
    </td>
  </tr>
<?php
   }
}
######################
##END STICKY THREADS##
######################

$threadquery = mysql_query("SELECT * FROM " . $prefix . "threads WHERE board_id = '$board_id' && sticky = '0' ORDER BY last_msg_time DESC LIMIT $num, 30") OR DIE("Gravity Board X was unable to retrieve the thread data from the database: " . mysql_error());

while($threadinfo = mysql_fetch_assoc($threadquery)){
   $threadtemp2 = mysql_query("SELECT * FROM " . $prefix . "members WHERE memberid = '$threadinfo[memberid]'") OR DIE("Gravity Board X was unable to retrieve the data from the member database: " . mysql_error());
   $threadtemp = mysql_query("SELECT * FROM " . $prefix . "posts WHERE msg_id = '$threadinfo[first_msg]'") OR DIE("Gravity Board X was unable to retrieve the data from the database: " . mysql_error());
   while($postinfo = mysql_fetch_assoc($threadtemp)){
?>
  <tr>
    <td class=row3 width="2%" height="25" align="center">
<center>
<?php

if($threadinfo[locked] == "1" AND $threadinfo[reply_num] <= "15") { echo "<img src=images/locked_thread.gif alt='Locked Thread'>"; } elseif($threadinfo[locked] == "1" AND $threadinfo[reply_num] >= "15") { echo "<img src=images/hotlocked_thread.gif alt='Hot/Locked Thread'>"; } else { echo "<img src=images/regular_thread.gif alt='Regular Thread'>"; }

?>
</center>
</td>
    <td class=row1 width="46%" height="25" align="left">
<?php

##include("messagesread.php");

##CENSOR THREADS
$postinfo[subject] = stripslashes($postinfo[subject]);
$postinfo[subject] = censor($postinfo[subject]);

if($new >= '1'){ echo '<b>'; }
?>
    <font class=subjectfont><a href="index.php?action=viewthread&thread_id=<?php echo $threadinfo[thread_id]; ?>&board_id=<?php echo $board_id; ?>" onMouseOver="window.status='<?php echo $bn; echo ': '; echo $postinfo[subject]; ?>'; return true" onMouseOut="window.status=''; return true"><?php echo $postinfo[subject]; ?></font>
<?php
if($new >= '1'){ echo '</b>'; }
?>
</a></td>
    <td class=row1 width="16%" height="25" align="left">
<b><a href="index.php?action=viewprofile&member_id=<?php echo $postinfo[memberid]; ?>">
<?php

   $threadtemp3 = mysql_query("SELECT * FROM " . $prefix . "members WHERE memberid = '$postinfo[memberid]'") OR DIE("Gravity Board X was unable to retrieve the data from the member database: " . mysql_error());
   while($tsi = mysql_fetch_assoc($threadtemp3)){

##BEGIN USER RANK CHECK
   $pcquery = mysql_query("SELECT COUNT(*) FROM " . $prefix . "posts WHERE memberid = '$postinfo[memberid]'") OR DIE("Gravity Board X was unable to locate a users rank: " . mysql_error());
   list($pc) = mysql_fetch_row($pcquery);
   include("ranks.php");
##END USER RANK CHECK
##CHECK USER PERMISSIONS
   $mgquery = mysql_query("SELECT * FROM " . $prefix . "membergroups WHERE group_id = '$tsi[memberGroup]'") OR DIE("Gravity Board X was unable to verify a users member group: " . mysql_error());
   while($mg = mysql_fetch_assoc($mgquery)){
##END USER PERMISSION CHECK
?>
<font class=small color="<?php if($mg[group_type] == '1'){ echo $admincolor; }elseif($mg[group_type] == '2'){ echo $modcolor; }else{ echo $rankcolor; } ?>"><?php echo $tsi[displayname]; ?></a></font></b></td>
<?php
   }
}
?>
    <td class=row1 width="5%" height="25" align="center">
    <font class=small><?php echo $threadinfo[reply_num]; ?></font></td>
    <td class=row1 width="5%" height="25" align="center">
    <font class=small>
<?php
echo 'X';
##New messages not yet fully implemented
##echo $new;
?>
</font>
    <td class=row1 width="23%" height="25" align="right">
<?php
   $threadtemp4 = mysql_query("SELECT memberid FROM " . $prefix . "posts WHERE msg_id = '$threadinfo[last_msg]'") OR DIE("Gravity Board X was unable to retrieve the data from the database: (2)" . mysql_error());
   list($lpi) = mysql_fetch_row($threadtemp4);
   $threadtemp5 = mysql_query("SELECT * FROM " . $prefix . "members WHERE memberid = '$lpi'") OR DIE("Gravity Board X was unable to retrieve the data from the member database: (2)" . mysql_error());
   while($poster = mysql_fetch_assoc($threadtemp5)){

##BEGIN LAST POST USER RANK CHECK
   $pcquery = mysql_query("SELECT COUNT(*) FROM " . $prefix . "posts WHERE memberid = '$poster[memberid]'") OR DIE("Gravity Board X was unable to locate a users rank: " . mysql_error());
   list($pc) = mysql_fetch_row($pcquery);
   include("ranks.php");
##END USER RANK CHECK
?>
    <font class=small><a href="index.php?action=viewthread&thread_id=<?php echo $threadinfo[thread_id]; ?>&board_id=<?php echo $board_id; ?>#<?php echo $threadinfo[last_msg]; ?>" onMouseOver="window.status='<?php echo $bn; echo ': '; echo $postinfo[subject]; ?>'; return true" onMouseOut="window.status=''; return true">

<?php
$lastposttime = date ("m/d/Y h:i:s A",$threadinfo[last_msg_time] + $timeadjust);
echo $lastposttime;
?>

</a><br>
    </font>
<?php
##CHECK USER PERMISSIONS
   $mgquery = mysql_query("SELECT * FROM " . $prefix . "membergroups WHERE group_id = '$poster[memberGroup]'") OR DIE("Gravity Board X was unable to verify a users member group: " . mysql_error());
   while($mg = mysql_fetch_assoc($mgquery)){
##END USER PERMISSION CHECK
?>
    <font class=small>by <b><a href="index.php?action=viewprofile&member_id=<?php echo $lpi; ?>"><font color="<?php if($mg[group_type] == '1'){ echo $admincolor; }elseif($mg[group_type] == '2'){ echo $modcolor; }else{ echo $rankcolor; } ?>"><?php echo $poster[displayname]; ?></a></font></b></td>
<?php
}
}
?>
    <td class=row3 width="2%" height="25" align="center">
<?php
if($perm == '1') {
if($threadinfo[sticky] == "1") { echo "<a href=index.php?action=float&thread_id=" . $threadinfo[thread_id] . "&board_id=" . $board_id . "><img src=images/sticky_thread.gif border=0 alt='Floated Thread - Click to sink'></a>"; } else { echo "<a href=index.php?action=float&thread_id=" . $threadinfo[thread_id] . "&board_id=" . $board_id . "><img src=images/nonsticky_thread.gif border=0 alt='Regular Thread - Click to float'></a>"; }
} elseif($perm == '2') {
if($threadinfo[sticky] == "1") { echo "<a href=index.php?action=float&thread_id=" . $threadinfo[thread_id] . "&board_id=" . $board_id . "><img src=images/sticky_thread.gif border=0 alt='Floated Thread - Click to sink'></a>"; } else { echo "<a href=index.php?action=float&thread_id=" . $threadinfo[thread_id] . "&board_id=" . $board_id . "><img src=images/nonsticky_thread.gif border=0 alt='Regular Thread - Click to float'></a>"; }
} else {
if($threadinfo[sticky] == "1") { echo "<img src=images/sticky_thread.gif border=0 alt='This thread was floted by an admin or moderator'>"; } else { echo "<img src=images/nonsticky_thread.gif>"; }
}
?>
    </td>
  </tr>
<?php
}
}
?>
  <tr>
    <td class=row3 colspan=7>
   <p>Jump To Page:
<?php
$pages = ceil($count/30);
for($pagenum = '1'; $pagenum <= $pages; $pagenum++) {
if($pagenum != '1'){ echo ' · '; }
$pagenum--;
echo '<a href="index.php?action=viewboard&board_id=' . $board_id . '&skip=' . $pagenum . '">';
$pagenum++;
echo $pagenum;
echo '</a>';
}
?></p>
    </td>
  </tr>
</center>

User avatar
Alexej Kubarev
Site Admin
Site Admin
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län
Contact:

Postby Alexej Kubarev » Mon Jan 03, 2005 1:12 am

well..that was a correct file :)

User avatar
Alexej Kubarev
Site Admin
Site Admin
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län
Contact:

Postby Alexej Kubarev » Mon Jan 03, 2005 1:20 am

Well.. i will take a look at it tomorrow morning..sorry..leaving today..

What you need is to get a visible_to value from the databse, then compare it to $perm in a condition

Tat cant be so hard, right ;)

otarts
New php-forum User
New php-forum User
Posts: 11
Joined: Sat Jan 01, 2005 9:23 am

Postby otarts » Mon Jan 03, 2005 12:02 pm

Quantum physics isn't hard if you know how to do it. I bring that up because it has something in common with this comparing $perm to visible_to. That would be that I don't know how to do it. I understand what you said and what I need to do but I dont know how to go about doing it. :(

User avatar
Alexej Kubarev
Site Admin
Site Admin
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län
Contact:

Postby Alexej Kubarev » Tue Jan 04, 2005 9:17 am

Okej..now im back..

The best thing is to take some simple guide to basic PHP syntax... you will only need IF conditions...

otarts
New php-forum User
New php-forum User
Posts: 11
Joined: Sat Jan 01, 2005 9:23 am

Postby otarts » Thu Jan 06, 2005 3:17 pm

Well I've been looking at some guides and I just dont seem to see anything that can help me, or maybe I'm seeing it but not understanding or knowing. Can you point me to a specific guide that can help me with something like this?

User avatar
Alexej Kubarev
Site Admin
Site Admin
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län
Contact:

Postby Alexej Kubarev » Fri Jan 07, 2005 3:22 am

Code: Select all

<?php

/*****************************************************************************/
/* viewthreads.php                                                           */
/*****************************************************************************/

mysql_query("UPDATE " . $prefix . "stats SET boardviews=boardviews+1") OR DIE("Gravity Board X was unable to log your board view: " . mysql_error());
if($sr == '2'){
mysql_query("UPDATE " . $prefix . "members SET boardviews=boardviews+1 WHERE memberid='$memberid'") OR DIE("Gravity Board X was unable to log your member board view: " . mysql_error());
}

$boardquery = mysql_query("SELECT name FROM " . $prefix . "boards WHERE board_id = '$board_id'") OR DIE("Gravity Board X was unable to retrieve the board data from the database: " . mysql_error());

list($bn) = mysql_fetch_row($boardquery);

#Edited#
$visibility_res = mysql_query("SELECT visible_to FROM " . $prefix . "boards WHERE board_id = '$board_id'") OR DIE("Gravity Board X was unable to retrieve the board data from the database: " . mysql_error());

$visibility_row = mysql_fetch_assoc($visibility_res);
$visibility = $visibility_row['visible_to'];
#Edit stop#

?>
<center>
<table class=station width="100%">
  <tr>
    <td class=header colspan=7 width="90%" height="18">
    <p>
    <b><a href="index.php"><font class=headerfont><?php echo $boardname; ?></a>: <?php echo $bn; ?></font></b></td>
    </tr>
<?php
if($perm == '1'){
?>
<SCRIPT LANGUAGE="javascript">
<!--
function confirmboarddelete()
{
   if(confirm("Are you sure you would like to delete this board and all threads and posts associated with it?\nThis may NOT be undone!!"))
   {
   if(confirm("Please confirm that you would like to delete this board and all threads and messages assiciated with it.\nThis may NOT be undone!!"))
      location='index.php?action=deleteboard&board_id=<?php echo $board_id; ?>'
   }
}
//-->
</SCRIPT>
  <tr>
    <td colspan=7>
   <p><b>Admin Options:</b> <a href="javascript:confirmboarddelete()">Delete Board</a></p>
    </td>
  </tr>
<?php
}

#Edited#

if($visibility>$perm){

#Edited Stop#
?>
  <tr>
    <td class=row3 colspan=7 style="padding: 0px;"><table>
  <tr>
    <td class=row3 onclick="document.location.href='index.php?action=postnew&board_id=<?php echo $board_id; ?>'" onmouseover="this.className='rollover'" onmouseout="this.className='row3'">
   <p><b>New Thread</b></p>
        </td>
      </tr>
    </td>
  </tr>
</table>
  <tr>
    <td width="4%"></td>
    <td width="46%">
    <p align="center"><b><font class=small>Thread</b></td>
    <td width="18%">
    <p align="center"><b><font class=small>Author</b></td>
    <td width="5%">
    <p align="center"><b><font class=small>Replies</b></td>
    <td width="5%">
    <p align="center"><b><font class=small>New</b></td>
    <td width="20%">
    <p align="center"><b><font class=small>Last Post</b></td>
  </tr>
<?php

$num = $skip*30;

$tcquery = mysql_query("SELECT COUNT(*) FROM " . $prefix . "threads WHERE board_id = '$board_id'") OR DIE("Gravity Board X was not able to retrieve a thread count: " . mysql_error());
list($count) = mysql_fetch_row($tcquery);
#######################
##LIST STICKY THREADS##
#######################
$stickyquery = mysql_query("SELECT * FROM " . $prefix . "threads WHERE board_id = '$board_id' && sticky = '1' ORDER BY last_msg_time DESC") OR DIE("Gravity Board X was unable to retrieve the sticky thread data from the database: " . mysql_error());
while($stickyinfo = mysql_fetch_assoc($stickyquery)){
   $stickytemp2 = mysql_query("SELECT * FROM " . $prefix . "members WHERE memberid = '$stickyinfo[memberid]'") OR DIE("Gravity Board X was unable to retrieve the data from the member database: " . mysql_error());
   $stickytemp = mysql_query("SELECT * FROM " . $prefix . "posts WHERE msg_id = '$stickyinfo[first_msg]'") OR DIE("Gravity Board X was unable to retrieve the data from the database: " . mysql_error());
   while($postinfo = mysql_fetch_assoc($stickytemp)){
?>
  <tr>
    <td class=floatrow width="2%" height="25" align="center">
<center>
<?php

if($stickyinfo[locked] == "1" AND $stickyinfo[reply_num] <= "15") { echo "<img src=images/locked_thread.gif alt='Locked Thread'>"; } elseif($stickyinfo[locked] == "1" AND $stickyinfo[reply_num] >= "15") { echo "<img src=images/hotlocked_thread.gif alt='Hot/Locked Thread'>"; } else { echo "<img src=images/regular_thread.gif alt='Regular Thread'>"; }

?>
</center>
</td>
    <td class=floatrow width="46%" height="25" align="left">
<?php

##include("messagesread.php");

##CENSOR THREADS
$postinfo[subject] = stripslashes($postinfo[subject]);
$postinfo[subject] = censor($postinfo[subject]);

if($new >= '1'){ echo '<b>'; }
?>
    <font class=subjectfont><a href="index.php?action=viewthread&thread_id=<?php echo $stickyinfo[thread_id]; ?>&board_id=<?php echo $board_id; ?>" onMouseOver="window.status='<?php echo $bn; echo ': '; echo $postinfo[subject]; ?>'; return true" onMouseOut="window.status=''; return true"><?php echo $postinfo[subject]; ?></font>
<?php
if($new >= '1'){ echo '</b>'; }
?>
</a></td>
    <td class=floatrow width="16%" height="25" align="left">
<b><a href="index.php?action=viewprofile&member_id=<?php echo $postinfo[memberid]; ?>">
<?php

   $threadtemp3 = mysql_query("SELECT * FROM " . $prefix . "members WHERE memberid = '$postinfo[memberid]'") OR DIE("Gravity Board X was unable to retrieve the data from the member database: " . mysql_error());
   while($tsi = mysql_fetch_assoc($threadtemp3)){

##BEGIN USER RANK CHECK
   $pcquery = mysql_query("SELECT COUNT(*) FROM " . $prefix . "posts WHERE memberid = '$postinfo[memberid]'") OR DIE("Gravity Board X was unable to locate a users rank: " . mysql_error());
   list($pc) = mysql_fetch_row($pcquery);
   include("ranks.php");
##END USER RANK CHECK
##CHECK USER PERMISSIONS
   $mgquery = mysql_query("SELECT * FROM " . $prefix . "membergroups WHERE group_id = '$tsi[memberGroup]'") OR DIE("Gravity Board X was unable to verify a users member group: " . mysql_error());
   while($mg = mysql_fetch_assoc($mgquery)){
##END USER PERMISSION CHECK
?>
<font class=small color="<?php if($mg[group_type] == '1'){ echo $admincolor; }elseif($mg[group_type] == '2'){ echo $modcolor; }else{ echo $rankcolor; } ?>"><?php echo $tsi[displayname]; ?></a></font></b></td>
<?php
   }
}
?>
    <td class=floatrow width="5%" height="25" align="center">
    <font class=small><?php echo $stickyinfo[reply_num]; ?></font></td>
    <td class=floatrow width="5%" height="25" align="center">
    <font class=small><?php echo 'X'; ##echo $new; ?></font>
    <td class=floatrow width="23%" height="25" align="right">
<?php
   $threadtemp4 = mysql_query("SELECT memberid FROM " . $prefix . "posts WHERE msg_id = '$stickyinfo[last_msg]'") OR DIE("Gravity Board X was unable to retrieve the data from the database: (2)" . mysql_error());
   list($lpi) = mysql_fetch_row($threadtemp4);
   $threadtemp5 = mysql_query("SELECT * FROM " . $prefix . "members WHERE memberid = '$lpi'") OR DIE("Gravity Board X was unable to retrieve the data from the member database: (2)" . mysql_error());
   while($poster = mysql_fetch_assoc($threadtemp5)){

##BEGIN LAST POST USER RANK CHECK
   $pcquery = mysql_query("SELECT COUNT(*) FROM " . $prefix . "posts WHERE memberid = '$poster[memberid]'") OR DIE("Gravity Board X was unable to locate a users rank: " . mysql_error());
   list($pc) = mysql_fetch_row($pcquery);
   include("ranks.php");
##END USER RANK CHECK
?>
    <font class=small><a href="index.php?action=viewthread&thread_id=<?php echo $stickyinfo[thread_id]; ?>&board_id=<?php echo $board_id; ?>#<?php echo $stickyinfo[last_msg]; ?>" onMouseOver="window.status='<?php echo $bn; echo ': '; echo $postinfo[subject]; ?>'; return true" onMouseOut="window.status=''; return true">
<?php
$slpt = date ("m/d/Y h:i:s A",$stickyinfo[last_msg_time] + $timeadjust);
echo $slpt;
?>
</a><br>
    </font>
<?php
##CHECK USER PERMISSIONS
   $mgquery = mysql_query("SELECT * FROM " . $prefix . "membergroups WHERE group_id = '$poster[memberGroup]'") OR DIE("Gravity Board X was unable to verify a users member group: " . mysql_error());
   while($mg = mysql_fetch_assoc($mgquery)){
##END USER PERMISSION CHECK
?>
    <font class=small>by <b><a href="index.php?action=viewprofile&member_id=<?php echo $lpi; ?>"><font color="<?php if($mg[group_type] == '1'){ echo $admincolor; }elseif($mg[group_type] == '2'){ echo $modcolor; }else{ echo $rankcolor; } ?>"><?php echo $poster[displayname]; ?></a></font></b></td>
<?php
}
}
?>
    <td class=floatrow width="2%" height="25" align="center">
<?php
if($perm == '1') {
if($stickyinfo[sticky] == "1") { echo "<a href=index.php?action=float&thread_id=" . $stickyinfo[thread_id] . "&board_id=" . $board_id . "><img src=images/sticky_thread.gif border=0 alt='Floated Thread - Click to sink'></a>"; } else { echo "<a href=index.php?action=float&thread_id=" . $stickyinfo[thread_id] . "&board_id=" . $board_id . "><img src=images/nonsticky_thread.gif border=0 alt='Regular Thread - Click to float'></a>"; }
} elseif($perm == '2') {
if($stickyinfo[sticky] == "1") { echo "<a href=index.php?action=float&thread_id=" . $stickyinfo[thread_id] . "&board_id=" . $board_id . "><img src=images/sticky_thread.gif border=0 alt='Floated Thread - Click to sink'></a>"; } else { echo "<a href=index.php?action=float&thread_id=" . $stickyinfo[thread_id] . "&board_id=" . $board_id . "><img src=images/nonsticky_thread.gif border=0 alt='Regular Thread - Click to float'></a>"; }
} else {
if($stickyinfo[sticky] == "1") { echo "<img src=images/sticky_thread.gif border=0 alt='This thread was floted by an admin or moderator'>"; } else { echo "<img src=images/nonsticky_thread.gif>"; }
}
?>
    </td>
  </tr>
<?php
   }
}
######################
##END STICKY THREADS##
######################

$threadquery = mysql_query("SELECT * FROM " . $prefix . "threads WHERE board_id = '$board_id' && sticky = '0' ORDER BY last_msg_time DESC LIMIT $num, 30") OR DIE("Gravity Board X was unable to retrieve the thread data from the database: " . mysql_error());

while($threadinfo = mysql_fetch_assoc($threadquery)){
   $threadtemp2 = mysql_query("SELECT * FROM " . $prefix . "members WHERE memberid = '$threadinfo[memberid]'") OR DIE("Gravity Board X was unable to retrieve the data from the member database: " . mysql_error());
   $threadtemp = mysql_query("SELECT * FROM " . $prefix . "posts WHERE msg_id = '$threadinfo[first_msg]'") OR DIE("Gravity Board X was unable to retrieve the data from the database: " . mysql_error());
   while($postinfo = mysql_fetch_assoc($threadtemp)){
?>
  <tr>
    <td class=row3 width="2%" height="25" align="center">
<center>
<?php

if($threadinfo[locked] == "1" AND $threadinfo[reply_num] <= "15") { echo "<img src=images/locked_thread.gif alt='Locked Thread'>"; } elseif($threadinfo[locked] == "1" AND $threadinfo[reply_num] >= "15") { echo "<img src=images/hotlocked_thread.gif alt='Hot/Locked Thread'>"; } else { echo "<img src=images/regular_thread.gif alt='Regular Thread'>"; }

?>
</center>
</td>
    <td class=row1 width="46%" height="25" align="left">
<?php

##include("messagesread.php");

##CENSOR THREADS
$postinfo[subject] = stripslashes($postinfo[subject]);
$postinfo[subject] = censor($postinfo[subject]);

if($new >= '1'){ echo '<b>'; }
?>
    <font class=subjectfont><a href="index.php?action=viewthread&thread_id=<?php echo $threadinfo[thread_id]; ?>&board_id=<?php echo $board_id; ?>" onMouseOver="window.status='<?php echo $bn; echo ': '; echo $postinfo[subject]; ?>'; return true" onMouseOut="window.status=''; return true"><?php echo $postinfo[subject]; ?></font>
<?php
if($new >= '1'){ echo '</b>'; }
?>
</a></td>
    <td class=row1 width="16%" height="25" align="left">
<b><a href="index.php?action=viewprofile&member_id=<?php echo $postinfo[memberid]; ?>">
<?php

   $threadtemp3 = mysql_query("SELECT * FROM " . $prefix . "members WHERE memberid = '$postinfo[memberid]'") OR DIE("Gravity Board X was unable to retrieve the data from the member database: " . mysql_error());
   while($tsi = mysql_fetch_assoc($threadtemp3)){

##BEGIN USER RANK CHECK
   $pcquery = mysql_query("SELECT COUNT(*) FROM " . $prefix . "posts WHERE memberid = '$postinfo[memberid]'") OR DIE("Gravity Board X was unable to locate a users rank: " . mysql_error());
   list($pc) = mysql_fetch_row($pcquery);
   include("ranks.php");
##END USER RANK CHECK
##CHECK USER PERMISSIONS
   $mgquery = mysql_query("SELECT * FROM " . $prefix . "membergroups WHERE group_id = '$tsi[memberGroup]'") OR DIE("Gravity Board X was unable to verify a users member group: " . mysql_error());
   while($mg = mysql_fetch_assoc($mgquery)){
##END USER PERMISSION CHECK
?>
<font class=small color="<?php if($mg[group_type] == '1'){ echo $admincolor; }elseif($mg[group_type] == '2'){ echo $modcolor; }else{ echo $rankcolor; } ?>"><?php echo $tsi[displayname]; ?></a></font></b></td>
<?php
   }
}
?>
    <td class=row1 width="5%" height="25" align="center">
    <font class=small><?php echo $threadinfo[reply_num]; ?></font></td>
    <td class=row1 width="5%" height="25" align="center">
    <font class=small>
<?php
echo 'X';
##New messages not yet fully implemented
##echo $new;
?>
</font>
    <td class=row1 width="23%" height="25" align="right">
<?php
   $threadtemp4 = mysql_query("SELECT memberid FROM " . $prefix . "posts WHERE msg_id = '$threadinfo[last_msg]'") OR DIE("Gravity Board X was unable to retrieve the data from the database: (2)" . mysql_error());
   list($lpi) = mysql_fetch_row($threadtemp4);
   $threadtemp5 = mysql_query("SELECT * FROM " . $prefix . "members WHERE memberid = '$lpi'") OR DIE("Gravity Board X was unable to retrieve the data from the member database: (2)" . mysql_error());
   while($poster = mysql_fetch_assoc($threadtemp5)){

##BEGIN LAST POST USER RANK CHECK
   $pcquery = mysql_query("SELECT COUNT(*) FROM " . $prefix . "posts WHERE memberid = '$poster[memberid]'") OR DIE("Gravity Board X was unable to locate a users rank: " . mysql_error());
   list($pc) = mysql_fetch_row($pcquery);
   include("ranks.php");
##END USER RANK CHECK
?>
    <font class=small><a href="index.php?action=viewthread&thread_id=<?php echo $threadinfo[thread_id]; ?>&board_id=<?php echo $board_id; ?>#<?php echo $threadinfo[last_msg]; ?>" onMouseOver="window.status='<?php echo $bn; echo ': '; echo $postinfo[subject]; ?>'; return true" onMouseOut="window.status=''; return true">

<?php
$lastposttime = date ("m/d/Y h:i:s A",$threadinfo[last_msg_time] + $timeadjust);
echo $lastposttime;
?>

</a><br>
    </font>
<?php
##CHECK USER PERMISSIONS
   $mgquery = mysql_query("SELECT * FROM " . $prefix . "membergroups WHERE group_id = '$poster[memberGroup]'") OR DIE("Gravity Board X was unable to verify a users member group: " . mysql_error());
   while($mg = mysql_fetch_assoc($mgquery)){
##END USER PERMISSION CHECK
?>
    <font class=small>by <b><a href="index.php?action=viewprofile&member_id=<?php echo $lpi; ?>"><font color="<?php if($mg[group_type] == '1'){ echo $admincolor; }elseif($mg[group_type] == '2'){ echo $modcolor; }else{ echo $rankcolor; } ?>"><?php echo $poster[displayname]; ?></a></font></b></td>
<?php
}
}
?>
    <td class=row3 width="2%" height="25" align="center">
<?php
if($perm == '1') {
if($threadinfo[sticky] == "1") { echo "<a href=index.php?action=float&thread_id=" . $threadinfo[thread_id] . "&board_id=" . $board_id . "><img src=images/sticky_thread.gif border=0 alt='Floated Thread - Click to sink'></a>"; } else { echo "<a href=index.php?action=float&thread_id=" . $threadinfo[thread_id] . "&board_id=" . $board_id . "><img src=images/nonsticky_thread.gif border=0 alt='Regular Thread - Click to float'></a>"; }
} elseif($perm == '2') {
if($threadinfo[sticky] == "1") { echo "<a href=index.php?action=float&thread_id=" . $threadinfo[thread_id] . "&board_id=" . $board_id . "><img src=images/sticky_thread.gif border=0 alt='Floated Thread - Click to sink'></a>"; } else { echo "<a href=index.php?action=float&thread_id=" . $threadinfo[thread_id] . "&board_id=" . $board_id . "><img src=images/nonsticky_thread.gif border=0 alt='Regular Thread - Click to float'></a>"; }
} else {
if($threadinfo[sticky] == "1") { echo "<img src=images/sticky_thread.gif border=0 alt='This thread was floted by an admin or moderator'>"; } else { echo "<img src=images/nonsticky_thread.gif>"; }
}
?>
    </td>
  </tr>
<?php
}
}
?>
  <tr>
    <td class=row3 colspan=7>
   <p>Jump To Page:
<?php
$pages = ceil($count/30);
for($pagenum = '1'; $pagenum <= $pages; $pagenum++) {
if($pagenum != '1'){ echo ' · '; }
$pagenum--;
echo '<a href="index.php?action=viewboard&board_id=' . $board_id . '&skip=' . $pagenum . '">';
$pagenum++;
echo $pagenum;
echo '</a>';
}
?></p>
    </td>
  </tr>
<?php

#Edited#

}
else
{
 echo("<tr><td><center>You are not allowed to view this page!</center></td></tr></table>");

}

#Edited Stop#
?>
</center>

User avatar
Alexej Kubarev
Site Admin
Site Admin
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län
Contact:

Postby Alexej Kubarev » Fri Jan 07, 2005 3:23 am

However im not really sure that this one would work... as the code is a bit weird..

So please bake a backup of your database AND files BEFORE doing anything..

otarts
New php-forum User
New php-forum User
Posts: 11
Joined: Sat Jan 01, 2005 9:23 am

Postby otarts » Fri Jan 07, 2005 3:34 pm

That works for blocking the page. Now all I need to know is how to make it Allow you to see some boards but not others. Right now the code blocks out the main page. So how would I go about setting a board's value so it could be seen?


Return to “PHP Scripts”

Who is online

Users browsing this forum: No registered users and 2 guests

cron