<?php
include_once("functions.php");
include('config.php');
include("session.php");
include("header.php");
$user = loadUser($_SESSION['login'],$link,$table_users);
if(!$_SESSION["loggedIn"] || !$user['admin']){ echo "You don't have enough privileges to view this page."; exit; }
?>
<div id="submenu"><a href="plugins.php" class="sub"><?php echo"$lang_plugins"; ?></a></div>
<div id="side">
<div class="title"> </div>
<div class="box"><?php
if(!empty($messages)){
displayErrors($messages);
}
elseif($_GET[message] && empty($messages)){
displayMessage($_GET[message]);
}
else{
echo "$lang_message050";
}
?>
</div></div>
<div id="main">
<h1><?php echo "$lang_manage_spam"; ?></h1><br />
<?php
if($_POST["newspamword"]){
if(!$_POST[spamword]){
$messages[]="$lang_message049";
}
if(empty($messages)) {
$spamword = addslashes($_POST[spamword]);
$query="INSERT INTO $table_spamwords (spamword) VALUES ('$spamword')";
$result=mysql_query($query, $link) or die("Died inserting spamword into db. Error returned if any: ".mysql_error());
header("Location: spamwords.php?message=Added Spamword");
ob_end_flush();
}
}
?>
<form action="<?php echo $_SERVER["PHP_SELF"]?>" method="POST">
<fieldset id="titlediv">
<legend><?php echo "$lang_add_spam"; ?></legend>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="text">
<tr>
<td width="75%"><input name="spamword" type="text" id="spamword"></td>
<td width="25%"><div class="right"><input type="submit" name="newspamword" value="<?php echo "$lang_submit"; ?>"></div></td>
</tr>
</table>
</fieldset>
</form>
<br />
<form name="form1" method="post" action="schredder.php">
<input name="table" type="hidden" value="<?php echo "$table_spamwords"; ?>">
<fieldset id="titlediv">
<legend><?php echo "$lang_spamwords"; ?></legend>
<div class="text">
<?php
$query = "SELECT * FROM $table_spamwords ORDER BY spamword ASC";
$result = mysql_query($query,$link) or die("Could not load list of spamwords.");
$spamwords = arrayMaker($result);
if(!$spamwords){
echo "$lang_no_results";
}
?>
<ul class="List">
<?php
foreach($spamwords as $spamdata){
$spamword = stripslashes($spamdata[spamword]);
?>
<li>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="text">
<tr>
<td width="75%"><?php echo "$spamword"; ?></td>
<td width="25%"><div class="right"><input type="checkbox" name="id[]" value="<?php echo "$spamdata[id]"; ?>"></div></td>
</tr>
</table>
</li>
<?php
}
?>
</ul>
<?php
if($spamwords){
?>
<div class="right"><input type="submit" name="Submit" value="$lang_delete"></div><br />
<?php } ?>
</div>
</fieldset>
</form>
</div>
<?php
include('footer.php');
?>