bad-dj
05-03-2007, 11:01 PM
Hi there i can not get like the shoutouts to delete its flat file and i have chmoded it here is the code
<?php
//start the session again
session_start();
//include our config file
include 'shoutconfig.php';
//grab the auth session var
$auth = $_SESSION['auth'];
//grab the is_admin session var
$is_admin = $_SESSION['is_admin'];
//grab the action var from the url
$action = $_GET['action'];
//are we authed?
if ( $auth != 1 ) die("Unauthorized access!");
//open the file
$read_file = file("messages.php");
//open switch statement to: set the bg, set welcome
switch ($action) {
//if the action was set to complaints
case "complaints":
//set the background
$bg = "complaints";
//set the welcome message
$welcome_msg = "Complaints";
break;
case "contests":
$bg = "contests";
$welcome_msg = "Contests";
break;
case "jokes":
$bg = "jokes";
$welcome_msg = "Jokes";
break;
case "requests":
$bg = "requests";
$welcome_msg = "Requests";
break;
case "shouts":
$bg = "shouts";
$welcome_msg = "Shouts";
break;
//now for the messy one - the all function
case "all":
//remember that we're viewing all the messages
$viewing_all = 1;
//set the welcome message
$welcome_msg = "All Messages";
//set the background
$bg = "none";
break;
//user wants to logout
case "logout":
//destroy the session
session_destroy();
//echo an exit message
echo "<body bgcolor='#336699'><center><font face='verdana' color='white'>You have now been logged out!</font></center></body>";
//die
die();
//we'll revisit that later. now for the default
default:
$viewing_all = 1;
$welcome_msg = "All Messages";
$bg = "none";
break;
}
//check if something has been deleted
if ( ($delete != '') && is_array($select) ) {
//for each part of the array
foreach ( $select as $key => $val ) {
//if the box was ticked
if ( $val != '' ) {
//loop through the file
foreach ( $read_file as $fkey => $line ) {
//explode the line
$current_line = explode("|", $line);
//if the id from the line matches the id from the selection
if ( $current_line['0'] == $key ) {
$read_file[$fkey] = '';
$modif = 1;
}
}
}
}
if ($modif) {
$open_file = "messages.php";
$txt = '';
foreach ( $read_file as $line ) {
if ( $line != '' ) $txt .= $line;
}
$fp = fopen("$open_file", "w");
flock($fp, 1);
fputs($fp, $txt);
flock($fp, 3);
fclose($fp);
die("<meta http-equiv='refresh' content='0'>");
}
}
//now to explode the file into well formatted arrays
//start with a counter var for number of loops
$explode_iterations = 0;
//counter var for array storage
$storage_progress = 0;
//for each line in the opened file
foreach ( $read_file as $line ) {
//if statement to skip the first line
if ( $explode_iterations >= 1 ) {
//explode the line we're on
$current_line = explode("|", $line );
//put the exploded id into the ids array
$ids[$storage_progress] = $current_line['0'];
//put the exploded type of message into the types array
$types[$storage_progress] = $current_line['1'];
//put the exploded from data into the from array
$senders[$storage_progress] = $current_line['2'];
//put the exploded message into the messages array
$messages[$storage_progress] = $current_line['3'];
//put the exploded ip is the ips array
$ips[$storage_progress] = $current_line['4'];
//increment the progress counter
++$storage_progress;
//unset the current line
unset($current_line);
}
//increment the iterations counter
$explode_iterations = $explode_iterations + 1;
}
//data exploded - w00t
//reset the counter var
$explode_iterations = 0;
//set other counter vars - one per topic
$complaints_progress = 0;
$contests_progress = 0;
$jokes_progress = 0;
$requests_progress = 0;
$shouts_progress = 0;
//explode data into seperate arrays
foreach ( $read_file as $line ) {
//if statement to skip the first line
if ( $explode_iterations >= 1 ) {
//explode the line we're on
$current_line = explode("|", $line );
//begin another switch to write into the appropriate array
switch ($current_line['1']) {
case "complaint":
//write the id of the message into the complaints ids
$complaints_ids[$complaints_progress] = $current_line['0'];
//write the sender into complaints from
$complaints_senders[$complaints_progress] = $current_line['2'];
//write the message into complaints messages
$complaints_messages[$complaints_progress] = $current_line['3'];
//put the exploded ip is the ips array
$complaints_ips[$complaints_progress] = $current_line['4'];
//iterate the counter
++$complaints_progress;
//break the switch
break;
case "contest":
//write the id of the message into the complaints ids
$contests_ids[$contests_progress] = $current_line['0'];
//write the sender into contests from
$contests_senders[$contests_progress] = $current_line['2'];
//write the message into contests messages
$contests_messages[$contests_progress] = $current_line['3'];
//write the ip into contests ipss
$contests_ips[$contests_progress] = $current_line['4'];
//iterate the counter
++$contests_progress;
//break the switch
break;
case "joke":
//write the id of the message into the complaints ids
$jokes_ids[$jokes_progress] = $current_line['0'];
//write the sender into jokes from
$jokes_senders[$jokes_progress] = $current_line['2'];
//write the message into jokes messages
$jokes_messages[$jokes_progress] = $current_line['3'];
//write the ip into contests ip
$jokes_ips[$jokes_progress] = $current_line['4'];
//iterate the counter
++$jokes_progress;
//break the switch
break;
case "request":
//write the id of the message into the complaints ids
$requests_ids[$requests_progress] = $current_line['0'];
//write the sender into requests from
$requests_senders[$requests_progress] = $current_line['2'];
//write the message into requests messages
$requests_messages[$requests_progress] = $current_line['3'];
//write the ip into requests ip
$requests_ips[$requests_progress] = $current_line['4'];
//iterate the counter
++$requests_progress;
//break the switch
break;
case "shout":
//write the id of the message into the complaints ids
$shouts_ids[$shouts_progress] = $current_line['0'];
//write the sender into shouts from
$shouts_senders[$shouts_progress] = $current_line['2'];
//write the message into shouts messages
$shouts_messages[$shouts_progress] = $current_line['3'];
//write the ip into shouts ips
$shouts_ips[$shouts_progress] = $current_line['4'];
//iterate the counter
++$shouts_progress;
//break the switch
break;
}
//unset the current line
unset($current_line);
}
//increment the iterations counter
$explode_iterations = $explode_iterations + 1;
}
//count the number of lines
$number_of_msgs = count($read_file) - 2;
//count the number of complaints
$number_of_complaints = count($complaints_ids) - 1;
//count the number of complaints
$number_of_contests = count($contests_ids) - 1;
//count the number of complaints
$number_of_jokes = count($jokes_ids) - 1;
//count the number of complaints
$number_of_requests = count($requests_ids) - 1;
//count the number of complaints
$number_of_shouts = count($shouts_ids) - 1;
//time to send the start of the document to the browser
?>
<html>
<head>
<title><?php echo $site_name; ?></title>
<style type="text/css">
.header {
font-family: "Trebuchet MS";
font-size: 16;
color: #336699;
font-weight: bold;
padding-left: 40px;
}
.theader {
font-family: "Trebuchet MS";
font-size: 14;
color: #000000;
text-align: center;
font-weight: bold;
}
.mtheader {
font-family: "Trebuchet MS";
font-size: 14;
color: #000000;
padding-left: 20px;
font-weight: bold;
}
.verticalalign {
vertical-align: middle;
}
.text {
font-family: Arial;
font-size: 12;
color: #000000;
text-align: center;
}
.ntext {
font-family: Arial;
font-size: 12;
color: #000000;
text-align: center;
cursor: hand;
}
.mtext {
font-family: Arial;
font-size: 12;
color: #000000;
padding-left: 20px;
}
.button {
border: 1px solid black;
background: transparent;
color: black;
font-family: Arial;
font-size: 12;
width: 45;
}
.textfield {
border: 1px solid black;
background: transparent;
color: black;
font-family: Arial;
font-size: 12;
width: 90%;
}
.tfooter {
text-align: right;
padding-right: 5px;
}
.ban a {
color: white;
text-decoration: none;
}
.theader a {
font-family: "Trebuchet MS";
font-size: 12;
color: #000000;
text-decoration: none;
}
</style>
<meta http-equiv="expires" content="0">
</head>
<body style="padding: 0; margin: 0;">
<span class="header">
<?php echo $site_name; ?>: Viewing <?php echo $welcome_msg; ?>
</span>
<span style="float: right;" class="theader">
<img src="bullet.gif"><a href="cpanel.php" style="padding-left: 5px;">Control Panel</a>
</span>
<p />
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>?action=<?php echo $action; ?>">
<table width="100%" border="0" rules="none">
<tr height="32" background="<?php echo $bg; ?>.gif">
<td width="125" class="theader" background="<?php echo $bg; ?>.gif">
Name
</td>
<td class="mtheader" background="<?php echo $bg; ?>.gif">
Message
</td>
<td width="50" class="theader" background="<?php echo $bg; ?>.gif">
Delete
</td>
</tr>
<?php
//if we're using all the messgaes
if ( $viewing_all == 1 ) {
//set up a counter for the printing
$printed = 0;
//loop through each part of the messages array
while ( $printed <= $number_of_msgs ) {
//echo the start of the line
?>
<tr height="32" style="background-image: url(<?php echo $types[$printed]; ?>s.gif);">
<td width="125" class="text" style="background-image: url(<?php echo $types[$printed]; ?>s.gif);">
<?php echo $senders[$printed]; ?> <span class="ban"><a href="goban.php?ip=<?php echo $ips[$printed]; ?>">[Ban]</a></span>
</td>
<td class="mtext" style="background-image: url(<?php echo $types[$printed]; ?>s.gif);">
<?php echo $messages[$printed]; ?>
<td width="50" class="theader" style="background-image: url(<?php echo $types[$printed]; ?>s.gif);">
<input type="checkbox" name="select[<?php echo $ids[$printed]; ?>]" value="<?php echo $ids[$printed]; ?>">
</td>
</tr>
<?php
//increment the printed variable
++$printed;
}
}
//we're not viewing them all so we're only viewing one type
else {
//switch to decide which array to print from
switch ($action) {
case "complaints":
//set up a counter for the printing
$printed = 0;
//loop through each part of the messages array
while ( $printed <= $number_of_complaints ) {
//echo the start of the line
?>
<tr height="32" background="none.gif">
<td width="125" class="text" background="none.gif">
<?php echo $complaints_senders[$printed]; ?> <span class="ban"><a href="goban.php?ip=<?php echo $complaints_ips[$printed]; ?>">[Ban]</a></span>
</td>
<td class="mtext">
<?php echo $complaints_messages[$printed]; ?>
</td>
<td width="50" class="theader" background="none.gif">
<input type="checkbox" name="select[<?php echo $complaints_ids[$printed]; ?>]" value="<?php echo $complaints_ids[$printed]; ?>">
</td>
</tr>
<?php
//increment the printed variable
++$printed;
}
break;
case "contests":
//set up a counter for the printing
$printed = 0;
//loop through each part of the messages array
while ( $printed <= $number_of_contests ) {
//echo the start of the line
?>
<tr height="32" background="none.gif">
<td width="125" class="text" background="none.gif">
<?php echo $contests_senders[$printed]; ?> <span class="ban"><a href="goban.php?ip=<?php echo $contests_ips[$printed]; ?>">[Ban]</a></span>
</td>
<td class="mtext">
<?php echo $contests_messages[$printed]; ?>
</td>
<td width="50" class="theader" background="none.gif">
<input type="checkbox" name="select[<?php echo $contests_ids[$printed]; ?>]" value="<?php echo $contests_ids[$printed]; ?>">
</td>
</tr>
<?php
//increment the printed variable
++$printed;
}
break;
case "jokes":
//set up a counter for the printing
$printed = 0;
//loop through each part of the messages array
while ( $printed <= $number_of_jokes ) {
//echo the start of the line
?>
<tr height="32" background="none.gif">
<td width="125" class="text" background="none.gif">
<?php echo $jokes_senders[$printed]; ?> <span class="ban"><a href="goban.php?ip=<?php echo $jokes_ips[$printed]; ?>">[Ban]</a></span>
</td>
<td class="mtext" background="none.gif">
<?php echo $jokes_messages[$printed]; ?>
</td>
<td width="50" class="theader">
<input type="checkbox" name="select[<?php echo $jokes_ids[$printed]; ?>]" value="<?php echo $jokes_ids[$printed]; ?>">
</td>
</tr>
<?php
//increment the printed variable
++$printed;
}
break;
case "requests":
//set up a counter for the printing
$printed = 0;
//loop through each part of the messages array
while ( $printed <= $number_of_requests ) {
//echo the start of the line
?>
<tr height="32" background="none.gif">
<td width="125" class="text" background="none.gif">
<?php echo $requests_senders[$printed]; ?> <span class="ban"><a href="goban.php?ip=<?php echo $requests_ips[$printed]; ?>">[Ban]</a></span>
</td>
<td class="mtext">
<?php echo $requests_messages[$printed]; ?>
</td>
<td width="50" class="theader" background="none.gif">
<input type="checkbox" name="select[<?php echo $requests_ids[$printed]; ?>]" value="<?php echo $requests_ids[$printed]; ?>">
</td>
</tr>
<?php
//increment the printed variable
++$printed;
}
break;
case "shouts":
//set up a counter for the printing
$printed = 0;
//loop through each part of the messages array
while ( $printed <= $number_of_shouts ) {
//echo the start of the line
?>
<tr height="32" background="none.gif">
<td width="125" class="text" background="none.gif">
<?php echo $shouts_senders[$printed]; ?> <span class="ban"><a href="goban.php?ip=<?php echo $shouts_ips[$printed]; ?>">[Ban]</a></span>
</td>
<td class="mtext">
<?php echo $shouts_messages[$printed]; ?>
</td>
<td width="50" class="theader" background="none.gif">
<input type="checkbox" name="select[<?php echo $shouts_ids[$printed]; ?>]" value="<?php echo $shouts_ids[$printed]; ?>">
</td>
</tr>
<?php
//increment the printed variable
++$printed;
}
break;
}
}
//send the rest of this table
?>
<tr height="32" background="<?php if ( $viewing_all == 1 ) echo "none"; else echo $bg; ?>.gif">
<td width="125" class="theader" background="<?php if ( $viewing_all == 1 ) echo "none"; else echo $bg; ?>.gif">
</td>
<td class="tfooter" colspan="2" background="<?php if ( $viewing_all == 1 ) echo "none"; else echo $bg; ?>.gif">
<input type="submit" value="Delete" class="button" name="delete">
</td>
</tr>
</table>
</form>
<p />
<table width="100%" border="0" rules="none">
<tr height="32">
<td class="theader" background="none.gif" width="12.5%" style="border-right:1px solid black;">
Navigation:
</td>
<td class="ntext" background="none.gif" width="12.5%" onClick="document.location='<?php echo $_SERVER['PHP_SELF']; ?>?action=all'">
All
</td>
<td class="ntext" background="complaints.gif" width="12.5%" onClick="document.location='<?php echo $_SERVER['PHP_SELF']; ?>?action=complaints'">
Complaints
</td>
<td class="ntext" background="contests.gif" width="12.5%" onClick="document.location='<?php echo $_SERVER['PHP_SELF']; ?>?action=contests'">
Contests
</td>
<td class="ntext" background="jokes.gif" width="12.5%" onClick="document.location='<?php echo $_SERVER['PHP_SELF']; ?>?action=jokes'">
Jokes
</td>
<td class="ntext" background="requests.gif" width="12.5%" onClick="document.location='<?php echo $_SERVER['PHP_SELF']; ?>?action=requests'">
Requests
</td>
<td class="ntext" background="shouts.gif" width="12.5%" onClick="document.location='<?php echo $_SERVER['PHP_SELF']; ?>?action=shouts'">
Shouts
</td>
<td class="ntext" background="none.gif" width="12.5%" style="border-left:1px solid black;" onClick="document.location='<?php echo $_SERVER['PHP_SELF']; ?>?action=logout'">
Logout
</td>
</tr>
</table>
<?php
//if this user is an admin
if ( $is_admin == 1 ) {
//echo the adduser form
?>
<p />
<center>
<form method="post" action="adduser.php">
<table width="300" rules="none">
<tr background="none.gif" height="32">
<td class="theader" colspan="2" background="none.gif">
Add A New User!
</td>
</tr>
<tr background="none.gif" height="32">
<td width="50%" class="text" background="none.gif">
Username:
</td>
<td width="50%" class="theader" background="none.gif">
<input type="text" name="newuser" class="textfield">
</td>
</tr>
<tr background="none.gif" height="32">
<td width="50%" class="text" background="none.gif">
Password:
</td>
<td width="50%" class="theader" background="none.gif">
<input type="password" name="newpass" class="textfield">
</td>
</tr>
<tr background="none.gif" height="32">
<td colspan="2" class="text" background="none.gif">
<input type="submit" value="Go" class="button">
</td>
</tr>
</table>
</form>
</center>
<?php
}
?>
</body>
</html>
<?php
//start the session again
session_start();
//include our config file
include 'shoutconfig.php';
//grab the auth session var
$auth = $_SESSION['auth'];
//grab the is_admin session var
$is_admin = $_SESSION['is_admin'];
//grab the action var from the url
$action = $_GET['action'];
//are we authed?
if ( $auth != 1 ) die("Unauthorized access!");
//open the file
$read_file = file("messages.php");
//open switch statement to: set the bg, set welcome
switch ($action) {
//if the action was set to complaints
case "complaints":
//set the background
$bg = "complaints";
//set the welcome message
$welcome_msg = "Complaints";
break;
case "contests":
$bg = "contests";
$welcome_msg = "Contests";
break;
case "jokes":
$bg = "jokes";
$welcome_msg = "Jokes";
break;
case "requests":
$bg = "requests";
$welcome_msg = "Requests";
break;
case "shouts":
$bg = "shouts";
$welcome_msg = "Shouts";
break;
//now for the messy one - the all function
case "all":
//remember that we're viewing all the messages
$viewing_all = 1;
//set the welcome message
$welcome_msg = "All Messages";
//set the background
$bg = "none";
break;
//user wants to logout
case "logout":
//destroy the session
session_destroy();
//echo an exit message
echo "<body bgcolor='#336699'><center><font face='verdana' color='white'>You have now been logged out!</font></center></body>";
//die
die();
//we'll revisit that later. now for the default
default:
$viewing_all = 1;
$welcome_msg = "All Messages";
$bg = "none";
break;
}
//check if something has been deleted
if ( ($delete != '') && is_array($select) ) {
//for each part of the array
foreach ( $select as $key => $val ) {
//if the box was ticked
if ( $val != '' ) {
//loop through the file
foreach ( $read_file as $fkey => $line ) {
//explode the line
$current_line = explode("|", $line);
//if the id from the line matches the id from the selection
if ( $current_line['0'] == $key ) {
$read_file[$fkey] = '';
$modif = 1;
}
}
}
}
if ($modif) {
$open_file = "messages.php";
$txt = '';
foreach ( $read_file as $line ) {
if ( $line != '' ) $txt .= $line;
}
$fp = fopen("$open_file", "w");
flock($fp, 1);
fputs($fp, $txt);
flock($fp, 3);
fclose($fp);
die("<meta http-equiv='refresh' content='0'>");
}
}
//now to explode the file into well formatted arrays
//start with a counter var for number of loops
$explode_iterations = 0;
//counter var for array storage
$storage_progress = 0;
//for each line in the opened file
foreach ( $read_file as $line ) {
//if statement to skip the first line
if ( $explode_iterations >= 1 ) {
//explode the line we're on
$current_line = explode("|", $line );
//put the exploded id into the ids array
$ids[$storage_progress] = $current_line['0'];
//put the exploded type of message into the types array
$types[$storage_progress] = $current_line['1'];
//put the exploded from data into the from array
$senders[$storage_progress] = $current_line['2'];
//put the exploded message into the messages array
$messages[$storage_progress] = $current_line['3'];
//put the exploded ip is the ips array
$ips[$storage_progress] = $current_line['4'];
//increment the progress counter
++$storage_progress;
//unset the current line
unset($current_line);
}
//increment the iterations counter
$explode_iterations = $explode_iterations + 1;
}
//data exploded - w00t
//reset the counter var
$explode_iterations = 0;
//set other counter vars - one per topic
$complaints_progress = 0;
$contests_progress = 0;
$jokes_progress = 0;
$requests_progress = 0;
$shouts_progress = 0;
//explode data into seperate arrays
foreach ( $read_file as $line ) {
//if statement to skip the first line
if ( $explode_iterations >= 1 ) {
//explode the line we're on
$current_line = explode("|", $line );
//begin another switch to write into the appropriate array
switch ($current_line['1']) {
case "complaint":
//write the id of the message into the complaints ids
$complaints_ids[$complaints_progress] = $current_line['0'];
//write the sender into complaints from
$complaints_senders[$complaints_progress] = $current_line['2'];
//write the message into complaints messages
$complaints_messages[$complaints_progress] = $current_line['3'];
//put the exploded ip is the ips array
$complaints_ips[$complaints_progress] = $current_line['4'];
//iterate the counter
++$complaints_progress;
//break the switch
break;
case "contest":
//write the id of the message into the complaints ids
$contests_ids[$contests_progress] = $current_line['0'];
//write the sender into contests from
$contests_senders[$contests_progress] = $current_line['2'];
//write the message into contests messages
$contests_messages[$contests_progress] = $current_line['3'];
//write the ip into contests ipss
$contests_ips[$contests_progress] = $current_line['4'];
//iterate the counter
++$contests_progress;
//break the switch
break;
case "joke":
//write the id of the message into the complaints ids
$jokes_ids[$jokes_progress] = $current_line['0'];
//write the sender into jokes from
$jokes_senders[$jokes_progress] = $current_line['2'];
//write the message into jokes messages
$jokes_messages[$jokes_progress] = $current_line['3'];
//write the ip into contests ip
$jokes_ips[$jokes_progress] = $current_line['4'];
//iterate the counter
++$jokes_progress;
//break the switch
break;
case "request":
//write the id of the message into the complaints ids
$requests_ids[$requests_progress] = $current_line['0'];
//write the sender into requests from
$requests_senders[$requests_progress] = $current_line['2'];
//write the message into requests messages
$requests_messages[$requests_progress] = $current_line['3'];
//write the ip into requests ip
$requests_ips[$requests_progress] = $current_line['4'];
//iterate the counter
++$requests_progress;
//break the switch
break;
case "shout":
//write the id of the message into the complaints ids
$shouts_ids[$shouts_progress] = $current_line['0'];
//write the sender into shouts from
$shouts_senders[$shouts_progress] = $current_line['2'];
//write the message into shouts messages
$shouts_messages[$shouts_progress] = $current_line['3'];
//write the ip into shouts ips
$shouts_ips[$shouts_progress] = $current_line['4'];
//iterate the counter
++$shouts_progress;
//break the switch
break;
}
//unset the current line
unset($current_line);
}
//increment the iterations counter
$explode_iterations = $explode_iterations + 1;
}
//count the number of lines
$number_of_msgs = count($read_file) - 2;
//count the number of complaints
$number_of_complaints = count($complaints_ids) - 1;
//count the number of complaints
$number_of_contests = count($contests_ids) - 1;
//count the number of complaints
$number_of_jokes = count($jokes_ids) - 1;
//count the number of complaints
$number_of_requests = count($requests_ids) - 1;
//count the number of complaints
$number_of_shouts = count($shouts_ids) - 1;
//time to send the start of the document to the browser
?>
<html>
<head>
<title><?php echo $site_name; ?></title>
<style type="text/css">
.header {
font-family: "Trebuchet MS";
font-size: 16;
color: #336699;
font-weight: bold;
padding-left: 40px;
}
.theader {
font-family: "Trebuchet MS";
font-size: 14;
color: #000000;
text-align: center;
font-weight: bold;
}
.mtheader {
font-family: "Trebuchet MS";
font-size: 14;
color: #000000;
padding-left: 20px;
font-weight: bold;
}
.verticalalign {
vertical-align: middle;
}
.text {
font-family: Arial;
font-size: 12;
color: #000000;
text-align: center;
}
.ntext {
font-family: Arial;
font-size: 12;
color: #000000;
text-align: center;
cursor: hand;
}
.mtext {
font-family: Arial;
font-size: 12;
color: #000000;
padding-left: 20px;
}
.button {
border: 1px solid black;
background: transparent;
color: black;
font-family: Arial;
font-size: 12;
width: 45;
}
.textfield {
border: 1px solid black;
background: transparent;
color: black;
font-family: Arial;
font-size: 12;
width: 90%;
}
.tfooter {
text-align: right;
padding-right: 5px;
}
.ban a {
color: white;
text-decoration: none;
}
.theader a {
font-family: "Trebuchet MS";
font-size: 12;
color: #000000;
text-decoration: none;
}
</style>
<meta http-equiv="expires" content="0">
</head>
<body style="padding: 0; margin: 0;">
<span class="header">
<?php echo $site_name; ?>: Viewing <?php echo $welcome_msg; ?>
</span>
<span style="float: right;" class="theader">
<img src="bullet.gif"><a href="cpanel.php" style="padding-left: 5px;">Control Panel</a>
</span>
<p />
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>?action=<?php echo $action; ?>">
<table width="100%" border="0" rules="none">
<tr height="32" background="<?php echo $bg; ?>.gif">
<td width="125" class="theader" background="<?php echo $bg; ?>.gif">
Name
</td>
<td class="mtheader" background="<?php echo $bg; ?>.gif">
Message
</td>
<td width="50" class="theader" background="<?php echo $bg; ?>.gif">
Delete
</td>
</tr>
<?php
//if we're using all the messgaes
if ( $viewing_all == 1 ) {
//set up a counter for the printing
$printed = 0;
//loop through each part of the messages array
while ( $printed <= $number_of_msgs ) {
//echo the start of the line
?>
<tr height="32" style="background-image: url(<?php echo $types[$printed]; ?>s.gif);">
<td width="125" class="text" style="background-image: url(<?php echo $types[$printed]; ?>s.gif);">
<?php echo $senders[$printed]; ?> <span class="ban"><a href="goban.php?ip=<?php echo $ips[$printed]; ?>">[Ban]</a></span>
</td>
<td class="mtext" style="background-image: url(<?php echo $types[$printed]; ?>s.gif);">
<?php echo $messages[$printed]; ?>
<td width="50" class="theader" style="background-image: url(<?php echo $types[$printed]; ?>s.gif);">
<input type="checkbox" name="select[<?php echo $ids[$printed]; ?>]" value="<?php echo $ids[$printed]; ?>">
</td>
</tr>
<?php
//increment the printed variable
++$printed;
}
}
//we're not viewing them all so we're only viewing one type
else {
//switch to decide which array to print from
switch ($action) {
case "complaints":
//set up a counter for the printing
$printed = 0;
//loop through each part of the messages array
while ( $printed <= $number_of_complaints ) {
//echo the start of the line
?>
<tr height="32" background="none.gif">
<td width="125" class="text" background="none.gif">
<?php echo $complaints_senders[$printed]; ?> <span class="ban"><a href="goban.php?ip=<?php echo $complaints_ips[$printed]; ?>">[Ban]</a></span>
</td>
<td class="mtext">
<?php echo $complaints_messages[$printed]; ?>
</td>
<td width="50" class="theader" background="none.gif">
<input type="checkbox" name="select[<?php echo $complaints_ids[$printed]; ?>]" value="<?php echo $complaints_ids[$printed]; ?>">
</td>
</tr>
<?php
//increment the printed variable
++$printed;
}
break;
case "contests":
//set up a counter for the printing
$printed = 0;
//loop through each part of the messages array
while ( $printed <= $number_of_contests ) {
//echo the start of the line
?>
<tr height="32" background="none.gif">
<td width="125" class="text" background="none.gif">
<?php echo $contests_senders[$printed]; ?> <span class="ban"><a href="goban.php?ip=<?php echo $contests_ips[$printed]; ?>">[Ban]</a></span>
</td>
<td class="mtext">
<?php echo $contests_messages[$printed]; ?>
</td>
<td width="50" class="theader" background="none.gif">
<input type="checkbox" name="select[<?php echo $contests_ids[$printed]; ?>]" value="<?php echo $contests_ids[$printed]; ?>">
</td>
</tr>
<?php
//increment the printed variable
++$printed;
}
break;
case "jokes":
//set up a counter for the printing
$printed = 0;
//loop through each part of the messages array
while ( $printed <= $number_of_jokes ) {
//echo the start of the line
?>
<tr height="32" background="none.gif">
<td width="125" class="text" background="none.gif">
<?php echo $jokes_senders[$printed]; ?> <span class="ban"><a href="goban.php?ip=<?php echo $jokes_ips[$printed]; ?>">[Ban]</a></span>
</td>
<td class="mtext" background="none.gif">
<?php echo $jokes_messages[$printed]; ?>
</td>
<td width="50" class="theader">
<input type="checkbox" name="select[<?php echo $jokes_ids[$printed]; ?>]" value="<?php echo $jokes_ids[$printed]; ?>">
</td>
</tr>
<?php
//increment the printed variable
++$printed;
}
break;
case "requests":
//set up a counter for the printing
$printed = 0;
//loop through each part of the messages array
while ( $printed <= $number_of_requests ) {
//echo the start of the line
?>
<tr height="32" background="none.gif">
<td width="125" class="text" background="none.gif">
<?php echo $requests_senders[$printed]; ?> <span class="ban"><a href="goban.php?ip=<?php echo $requests_ips[$printed]; ?>">[Ban]</a></span>
</td>
<td class="mtext">
<?php echo $requests_messages[$printed]; ?>
</td>
<td width="50" class="theader" background="none.gif">
<input type="checkbox" name="select[<?php echo $requests_ids[$printed]; ?>]" value="<?php echo $requests_ids[$printed]; ?>">
</td>
</tr>
<?php
//increment the printed variable
++$printed;
}
break;
case "shouts":
//set up a counter for the printing
$printed = 0;
//loop through each part of the messages array
while ( $printed <= $number_of_shouts ) {
//echo the start of the line
?>
<tr height="32" background="none.gif">
<td width="125" class="text" background="none.gif">
<?php echo $shouts_senders[$printed]; ?> <span class="ban"><a href="goban.php?ip=<?php echo $shouts_ips[$printed]; ?>">[Ban]</a></span>
</td>
<td class="mtext">
<?php echo $shouts_messages[$printed]; ?>
</td>
<td width="50" class="theader" background="none.gif">
<input type="checkbox" name="select[<?php echo $shouts_ids[$printed]; ?>]" value="<?php echo $shouts_ids[$printed]; ?>">
</td>
</tr>
<?php
//increment the printed variable
++$printed;
}
break;
}
}
//send the rest of this table
?>
<tr height="32" background="<?php if ( $viewing_all == 1 ) echo "none"; else echo $bg; ?>.gif">
<td width="125" class="theader" background="<?php if ( $viewing_all == 1 ) echo "none"; else echo $bg; ?>.gif">
</td>
<td class="tfooter" colspan="2" background="<?php if ( $viewing_all == 1 ) echo "none"; else echo $bg; ?>.gif">
<input type="submit" value="Delete" class="button" name="delete">
</td>
</tr>
</table>
</form>
<p />
<table width="100%" border="0" rules="none">
<tr height="32">
<td class="theader" background="none.gif" width="12.5%" style="border-right:1px solid black;">
Navigation:
</td>
<td class="ntext" background="none.gif" width="12.5%" onClick="document.location='<?php echo $_SERVER['PHP_SELF']; ?>?action=all'">
All
</td>
<td class="ntext" background="complaints.gif" width="12.5%" onClick="document.location='<?php echo $_SERVER['PHP_SELF']; ?>?action=complaints'">
Complaints
</td>
<td class="ntext" background="contests.gif" width="12.5%" onClick="document.location='<?php echo $_SERVER['PHP_SELF']; ?>?action=contests'">
Contests
</td>
<td class="ntext" background="jokes.gif" width="12.5%" onClick="document.location='<?php echo $_SERVER['PHP_SELF']; ?>?action=jokes'">
Jokes
</td>
<td class="ntext" background="requests.gif" width="12.5%" onClick="document.location='<?php echo $_SERVER['PHP_SELF']; ?>?action=requests'">
Requests
</td>
<td class="ntext" background="shouts.gif" width="12.5%" onClick="document.location='<?php echo $_SERVER['PHP_SELF']; ?>?action=shouts'">
Shouts
</td>
<td class="ntext" background="none.gif" width="12.5%" style="border-left:1px solid black;" onClick="document.location='<?php echo $_SERVER['PHP_SELF']; ?>?action=logout'">
Logout
</td>
</tr>
</table>
<?php
//if this user is an admin
if ( $is_admin == 1 ) {
//echo the adduser form
?>
<p />
<center>
<form method="post" action="adduser.php">
<table width="300" rules="none">
<tr background="none.gif" height="32">
<td class="theader" colspan="2" background="none.gif">
Add A New User!
</td>
</tr>
<tr background="none.gif" height="32">
<td width="50%" class="text" background="none.gif">
Username:
</td>
<td width="50%" class="theader" background="none.gif">
<input type="text" name="newuser" class="textfield">
</td>
</tr>
<tr background="none.gif" height="32">
<td width="50%" class="text" background="none.gif">
Password:
</td>
<td width="50%" class="theader" background="none.gif">
<input type="password" name="newpass" class="textfield">
</td>
</tr>
<tr background="none.gif" height="32">
<td colspan="2" class="text" background="none.gif">
<input type="submit" value="Go" class="button">
</td>
</tr>
</table>
</form>
</center>
<?php
}
?>
</body>
</html>