birdbrain24
07-11-2007, 07:50 PM
Can Someone Add Page Numbering To This Script Please
<link rel=stylesheet href=../style.css type=text/css>
<?php
include"mysql_connect.php";
include"functions.php";
$username=$_SESSION['username'];
$fetch=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$username'"));
$userlevel=$fetch->userlevel;
$topics=mysql_fetch_object(mysql_query("SELECT * FROM topics WHERE id='$username'"));
$date=gmdate('F jS Y');
$time=gmdate('g:i:s a');
$datetime="$date at $time";
?>
<form id="form" name="form" method="post" action="newtopic.php">
<input type="submit" name="Submit" value="New Topic!" />
</form>
<table width=400 border=1 cellpadding=2 cellspacing=0 bordercolor=black class=table align=center>
<tr>
<td width=100% align=center class=header colspan=2>Forum</td>
</tr>
<?php
$query = mysql_query("SELECT * FROM `topics` WHERE `type`='important' ORDER BY `lastpost` DESC");
while($topics=mysql_fetch_object($query)){
if($topics->type == "important"){
if($userlevel == "Admin"){
echo "<tr><td class=text><u><b>Important:</b></u> ";
echo "<a href='posts.php?topic=$topics->id' target='frameright'>$topics->topic</a>";
if ($topics->locked == "Yes" ){ echo" (Locked)"; }
echo"</td>
<td>
<a href='topics.php?delete=$topics->id'><img src='images/delete.gif' border='0' /></a>
</td>
</tr>";
}
if($userlevel == "Head"){
echo "<tr><td class=text><u><b>Important:</b></u> ";
echo "<a href='posts.php?topic=$topics->id' target='frameright'>$topics->topic</a>";
if ($topics->locked == "Yes" ){ echo" (Locked)"; }
echo"</td>
<td>
<a href='topics.php?delete=$topics->id'><img src='images/delete.gif' border='0' /></a>
</td>
</tr>";
}
if($userlevel == "Mod"){
echo "<tr><td class=text><u><b>Important:</b></u> ";
echo "<a href='posts.php?topic=$topics->id' target='frameright'>$topics->topic</a>";
if ($topics->locked == "Yes" ){ echo" (Locked)"; }
echo"</td>
<td>
<a href='topics.php?delete=$topics->id'><img src='images/delete.gif' border='0' /></a>
</td>
</tr>";
}
if($userlevel == "Users"){
echo "<tr><td class=text><u><b>Important:</b></u> ";
echo "<a href='posts.php?topic=$topics->id' target='frameright'>$topics->topic</a>";
if ($topics->locked == "Yes" ){ echo" (Locked)"; }
echo"</td></tr>";
}
}
}
$query = mysql_query("SELECT * FROM `topics` WHERE `type`='sticky' ORDER BY `lastpost` DESC");
while($topics=mysql_fetch_object($query)){
if($topics->type == "sticky"){
if($userlevel == "Admin"){
echo "<tr><td class=text><u>Sticky:</u> ";
echo "<a href='posts.php?topic=$topics->id' target='frameright'>$topics->topic</a>";
if ($topics->locked == "Yes" ){ echo" (Locked)"; }
echo"</td>
<td>
<a href='topics.php?delete=$topics->id'><img src='images/delete.gif' border='0' /></a>
</td>
</tr>";
}
if($userlevel == "Head"){
echo "<tr><td class=text><u>Sticky:</u> ";
echo "<a href='posts.php?topic=$topics->id' target='frameright'>$topics->topic</a>";
if ($topics->locked == "Yes" ){ echo" (Locked)"; }
echo"</td>
<td>
<a href='topics.php?delete=$topics->id'><img src='images/delete.gif' border='0' /></a>
</td>
</tr>";
}
if($userlevel == "Mod"){
echo "<tr><td class=text><u>Sticky:</u> ";
echo "<a href='posts.php?topic=$topics->id' target='frameright'>$topics->topic</a>";
if ($topics->locked == "Yes" ){ echo" (Locked)"; }
echo"</td>
<td>
<a href='topics.php?delete=$topics->id'><img src='images/delete.gif' border='0' /></a>
</td>
</tr>";
}
if($userlevel == "Users"){
echo "<tr><td class=text><u>Sticky:</u> ";
echo "<a href='posts.php?topic=$topics->id' target='frameright'>$topics->topic</a>";
if ($topics->locked == "Yes" ){ echo" (Locked)"; }
echo"</td></tr>";
}
}
}
$query = mysql_query("SELECT * FROM `topics` WHERE `type`='normal' ORDER BY `lastpost` DESC");
while($topics=mysql_fetch_object($query)){
if($topics->type == "normal"){
if($userlevel == "Admin"){
echo "<tr><td class=text><a href='posts.php?topic=$topics->id' target='frameright'>$topics->topic</a>";
if ($topics->locked == "Yes" ){ echo" (Locked)"; }
echo"</td>
<td>
<a href='topics.php?delete=$topics->id'><img src='images/delete.gif' border='0' /></a>
</td>
</tr>";
}
if($userlevel == "Head"){
echo "<tr><td class=text><a href='posts.php?topic=$topics->id' target='frameright'>$topics->topic</a>";
if ($topics->locked == "Yes" ){ echo" (Locked)"; }
echo"</td>
<td>
<a href='topics.php?delete=$topics->id'><img src='images/delete.gif' border='0' /></a>
</td>
</tr>";
}
if($userlevel == "Mod"){
echo "<tr><td class=text><a href='posts.php?topic=$topics->id' target='frameright'>$topics->topic</a>";
if ($topics->locked == "Yes" ){ echo" (Locked)"; }
echo"</td>
<td>
<a href='topics.php?delete=$topics->id'><img src='images/delete.gif' border='0' /></a>
</td>
</tr>";
}
if($userlevel == "Users"){
echo "<tr><td class=text><a href='posts.php?topic=$topics->id' target='frameright'>$topics->topic</a>";
if ($topics->locked == "Yes" ){ echo" (Locked)"; }
echo"</td></tr>";
}
}
}
$delete=$_GET[delete];
if($delete) {
if($userlevel == "Admin"){
echo "<META HTTP-EQUIV=\"Refresh\" target=\"_top\" CONTENT=\"0; URL=forum.php\">";
echo"Deleted!";
mysql_query("DELETE FROM topics WHERE id='$delete'");
mysql_query("DELETE FROM posts WHERE topicid='$delete'");
mysql_query("INSERT INTO `staff_logs` (`username`, `action`, `date`) VALUES ('$username', 'Delete Forum Topic = $delete', '$datetime');") or die (mysql_error());
}
if($userlevel == "Head"){
mysql_query("INSERT INTO `staff_logs` (`username`, `action`, `date`) VALUES ('$username', 'Delete Forum Topic = $delete', '$datetime') LIMIT 1;") or die (mysql_error());
mysql_query("DELETE FROM topics WHERE id='$delete'");
mysql_query("DELETE FROM posts WHERE topicid='$delete'");
echo "<META HTTP-EQUIV=\"Refresh\" target=\"_top\" CONTENT=\"0; URL=forum.php\">";
echo"Deleted!";
}
if($userlevel == "Mod"){
mysql_query("INSERT INTO `staff_logs` (`username`, `action`, `date`) VALUES ('$username', 'Delete Forum Topic = $delete', '$datetime');") or die (mysql_error());
mysql_query("DELETE FROM topics WHERE id='$delete'");
mysql_query("DELETE FROM posts WHERE topicid='$delete'");
echo "<META HTTP-EQUIV=\"Refresh\" target=\"_top\" CONTENT=\"0; URL=forum.php\">";
echo"Deleted!";
}
if($userlevel == "User"){
echo"Nice Try!<br>You Actions Have Been Logged!";
mysql_query("INSERT INTO `user_logs` (`username`, `action`, `date`) VALUES ('$username', 'Delete Forum Topic = $delete', '$datetime');")
or die (mysql_error());
}
}
?>
</table>
Thanks,
birdbrain24
<link rel=stylesheet href=../style.css type=text/css>
<?php
include"mysql_connect.php";
include"functions.php";
$username=$_SESSION['username'];
$fetch=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$username'"));
$userlevel=$fetch->userlevel;
$topics=mysql_fetch_object(mysql_query("SELECT * FROM topics WHERE id='$username'"));
$date=gmdate('F jS Y');
$time=gmdate('g:i:s a');
$datetime="$date at $time";
?>
<form id="form" name="form" method="post" action="newtopic.php">
<input type="submit" name="Submit" value="New Topic!" />
</form>
<table width=400 border=1 cellpadding=2 cellspacing=0 bordercolor=black class=table align=center>
<tr>
<td width=100% align=center class=header colspan=2>Forum</td>
</tr>
<?php
$query = mysql_query("SELECT * FROM `topics` WHERE `type`='important' ORDER BY `lastpost` DESC");
while($topics=mysql_fetch_object($query)){
if($topics->type == "important"){
if($userlevel == "Admin"){
echo "<tr><td class=text><u><b>Important:</b></u> ";
echo "<a href='posts.php?topic=$topics->id' target='frameright'>$topics->topic</a>";
if ($topics->locked == "Yes" ){ echo" (Locked)"; }
echo"</td>
<td>
<a href='topics.php?delete=$topics->id'><img src='images/delete.gif' border='0' /></a>
</td>
</tr>";
}
if($userlevel == "Head"){
echo "<tr><td class=text><u><b>Important:</b></u> ";
echo "<a href='posts.php?topic=$topics->id' target='frameright'>$topics->topic</a>";
if ($topics->locked == "Yes" ){ echo" (Locked)"; }
echo"</td>
<td>
<a href='topics.php?delete=$topics->id'><img src='images/delete.gif' border='0' /></a>
</td>
</tr>";
}
if($userlevel == "Mod"){
echo "<tr><td class=text><u><b>Important:</b></u> ";
echo "<a href='posts.php?topic=$topics->id' target='frameright'>$topics->topic</a>";
if ($topics->locked == "Yes" ){ echo" (Locked)"; }
echo"</td>
<td>
<a href='topics.php?delete=$topics->id'><img src='images/delete.gif' border='0' /></a>
</td>
</tr>";
}
if($userlevel == "Users"){
echo "<tr><td class=text><u><b>Important:</b></u> ";
echo "<a href='posts.php?topic=$topics->id' target='frameright'>$topics->topic</a>";
if ($topics->locked == "Yes" ){ echo" (Locked)"; }
echo"</td></tr>";
}
}
}
$query = mysql_query("SELECT * FROM `topics` WHERE `type`='sticky' ORDER BY `lastpost` DESC");
while($topics=mysql_fetch_object($query)){
if($topics->type == "sticky"){
if($userlevel == "Admin"){
echo "<tr><td class=text><u>Sticky:</u> ";
echo "<a href='posts.php?topic=$topics->id' target='frameright'>$topics->topic</a>";
if ($topics->locked == "Yes" ){ echo" (Locked)"; }
echo"</td>
<td>
<a href='topics.php?delete=$topics->id'><img src='images/delete.gif' border='0' /></a>
</td>
</tr>";
}
if($userlevel == "Head"){
echo "<tr><td class=text><u>Sticky:</u> ";
echo "<a href='posts.php?topic=$topics->id' target='frameright'>$topics->topic</a>";
if ($topics->locked == "Yes" ){ echo" (Locked)"; }
echo"</td>
<td>
<a href='topics.php?delete=$topics->id'><img src='images/delete.gif' border='0' /></a>
</td>
</tr>";
}
if($userlevel == "Mod"){
echo "<tr><td class=text><u>Sticky:</u> ";
echo "<a href='posts.php?topic=$topics->id' target='frameright'>$topics->topic</a>";
if ($topics->locked == "Yes" ){ echo" (Locked)"; }
echo"</td>
<td>
<a href='topics.php?delete=$topics->id'><img src='images/delete.gif' border='0' /></a>
</td>
</tr>";
}
if($userlevel == "Users"){
echo "<tr><td class=text><u>Sticky:</u> ";
echo "<a href='posts.php?topic=$topics->id' target='frameright'>$topics->topic</a>";
if ($topics->locked == "Yes" ){ echo" (Locked)"; }
echo"</td></tr>";
}
}
}
$query = mysql_query("SELECT * FROM `topics` WHERE `type`='normal' ORDER BY `lastpost` DESC");
while($topics=mysql_fetch_object($query)){
if($topics->type == "normal"){
if($userlevel == "Admin"){
echo "<tr><td class=text><a href='posts.php?topic=$topics->id' target='frameright'>$topics->topic</a>";
if ($topics->locked == "Yes" ){ echo" (Locked)"; }
echo"</td>
<td>
<a href='topics.php?delete=$topics->id'><img src='images/delete.gif' border='0' /></a>
</td>
</tr>";
}
if($userlevel == "Head"){
echo "<tr><td class=text><a href='posts.php?topic=$topics->id' target='frameright'>$topics->topic</a>";
if ($topics->locked == "Yes" ){ echo" (Locked)"; }
echo"</td>
<td>
<a href='topics.php?delete=$topics->id'><img src='images/delete.gif' border='0' /></a>
</td>
</tr>";
}
if($userlevel == "Mod"){
echo "<tr><td class=text><a href='posts.php?topic=$topics->id' target='frameright'>$topics->topic</a>";
if ($topics->locked == "Yes" ){ echo" (Locked)"; }
echo"</td>
<td>
<a href='topics.php?delete=$topics->id'><img src='images/delete.gif' border='0' /></a>
</td>
</tr>";
}
if($userlevel == "Users"){
echo "<tr><td class=text><a href='posts.php?topic=$topics->id' target='frameright'>$topics->topic</a>";
if ($topics->locked == "Yes" ){ echo" (Locked)"; }
echo"</td></tr>";
}
}
}
$delete=$_GET[delete];
if($delete) {
if($userlevel == "Admin"){
echo "<META HTTP-EQUIV=\"Refresh\" target=\"_top\" CONTENT=\"0; URL=forum.php\">";
echo"Deleted!";
mysql_query("DELETE FROM topics WHERE id='$delete'");
mysql_query("DELETE FROM posts WHERE topicid='$delete'");
mysql_query("INSERT INTO `staff_logs` (`username`, `action`, `date`) VALUES ('$username', 'Delete Forum Topic = $delete', '$datetime');") or die (mysql_error());
}
if($userlevel == "Head"){
mysql_query("INSERT INTO `staff_logs` (`username`, `action`, `date`) VALUES ('$username', 'Delete Forum Topic = $delete', '$datetime') LIMIT 1;") or die (mysql_error());
mysql_query("DELETE FROM topics WHERE id='$delete'");
mysql_query("DELETE FROM posts WHERE topicid='$delete'");
echo "<META HTTP-EQUIV=\"Refresh\" target=\"_top\" CONTENT=\"0; URL=forum.php\">";
echo"Deleted!";
}
if($userlevel == "Mod"){
mysql_query("INSERT INTO `staff_logs` (`username`, `action`, `date`) VALUES ('$username', 'Delete Forum Topic = $delete', '$datetime');") or die (mysql_error());
mysql_query("DELETE FROM topics WHERE id='$delete'");
mysql_query("DELETE FROM posts WHERE topicid='$delete'");
echo "<META HTTP-EQUIV=\"Refresh\" target=\"_top\" CONTENT=\"0; URL=forum.php\">";
echo"Deleted!";
}
if($userlevel == "User"){
echo"Nice Try!<br>You Actions Have Been Logged!";
mysql_query("INSERT INTO `user_logs` (`username`, `action`, `date`) VALUES ('$username', 'Delete Forum Topic = $delete', '$datetime');")
or die (mysql_error());
}
}
?>
</table>
Thanks,
birdbrain24