<?php
/*************************************************************************
* 427BB - PHP & MySQL Forum *
* Copyright (C) 2003-2006 Ben Brown *
* *
* 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; version 2 of the License. *
* *
* 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. *
* *
* A Copy of the GNU General Public License can be found in the file *
* 'liscence.txt' in the root of the forum directory. *
*************************************************************************/
include 'getvars.php';
include 'func_chk.php';
if ($auth != TRUE) {
header ("Location: ./");
exit;
}
if (isset($_POST['cancel'])) {
$refer = $_POST['refer'];
header ("Location: " . $refer);
}
include 'header.php';
$add = FALSE;
if (isset($_POST['ignore_user'])) {
$user = $_POST['user'];
$add = TRUE;
} elseif (isset($_REQUEST['ignore_user'])) {
$user = $_REQUEST['ignore_user'];
$add = TRUE;
}
if ($add == TRUE) {
$a_user = addslashes($user);
$s_user = addslashes($username);
$sql = "SELECT UserName FROM " . $t_prefix . "Personal WHERE UserName='$a_user'";
$res = mysql_query($sql);
$chk = mysql_result($res, 0);
echo "<div class=messtitle>Add $user to ignore list</div>
<div class=mess>";
if ($chk == NULL) {
echo "User $user does not exist.";
} else {
$sql = "INSERT INTO " . $t_prefix . "IgnoredUsers SET User='$s_user', Ignores='$chk'";
if (!mysql_query($sql)) {
echo "Error: Could not add user to ignore list.";
echo "<br>" . mysql_error();
} else {
echo "User $user added to Ignore List";
}
}
echo "</div>";
}
if (isset($_REQUEST['remove_user'])) {
$user = $_REQUEST['remove_user'];
echo "<div class=messtitle>Remove $user from your Ignore List</div>
<div class=mess>
Are you sure you want to remove $user from your Ignore List?
<form action=\"" . $_SERVER['PHP_SELF'] . "\" method=post>
<input type=hidden name=user value=\"$user\">
<input type=hidden name=refer value=\"" . $_SERVER['HTTP_REFERER'] . "\">
<input type=submit name=conf_rem_user value=\"Yes\"> <input type=submit name=cancel value=\"No\">
</form>
</div>";
include 'footer.php';
exit;
}
if (isset($_POST['conf_rem_user'])) {
$user = $_POST['user'];
$r_user = addslashes($user);
$s_user = addslashes($username);
echo "<div class=messtitle>Remove $user from your Ignore List.</div>
<div class=mess>";
$sql = "DELETE FROM " . $t_prefix . "IgnoredUsers WHERE User='$s_user' && Ignores='$r_user'";
if (!mysql_query($sql)) {
echo "Error: could not remove $user from list.";
} else {
echo "User $user Removed from your Ignore List successfully.";
}
echo "</div>";
}
echo "<div class=messtitle>Ignore List</div>
<div class=mess>";
$s_user = addslashes($username);
$sql = "SELECT Ignores FROM " . $t_prefix . "IgnoredUsers WHERE User='$s_user' ORDER BY Ignores ASC";
$res = mysql_query($sql);
while ($row = mysql_fetch_row($res)) {
$ignored[] = stripslashes($row[0]);
}
$count = count($ignored);
if ($count == 0) {
echo "You are not currently ignoring any users.";
} else {
echo "You are currently ignoring the following user";
if ($count != 1) {
echo "s";
}
echo ":
<table border=0 width=$table_width>";
foreach ($ignored as $user) {
echo "\n<tr>
<td class=tdleft>$user</td>
<td class=tdleft><a href=\"profile.php?user=$user\">View Profile</a></td>
<td class=tdleft><a href=\"" . $_SERVER['PHP_SELF'] . "?remove_user=$user\">Remove From List</a></td>
</tr>";
}
echo "</table>";
}
echo "</div>
<div class=messtitle>Add to Ignore List</div>
<div class=mess>
<form action=\"" . $_SERVER['PHP_SELF'] . "\" method=post>
<table border=0>
<tr>
<td>Username:</td>
<td><input type=text name=user></td>
<td><input type=submit name=ignore_user value=\"Add\"></td>
</tr>
</table>
</form>
</div>";
include 'footer.php';
?>