==iNFO==
Mod Name: Advanced Blacklist
Mod Version: BETA
Mod Author: bheesham
Mod Description: A better blacklist.
Mod Notes: Okay, instead of that hard to understand
text... I'm just going to type it out so that normal
people can understand it. XD
==/iNFO==
==iNSTaLL==
K, now then.
Here's the code for admin_whitelist();
==CODE==
function admin_whitelist() {
$bwurl = $_POST['bwurl'];
$bwsub = $_POST['bwsub'];
$remove = $_POST['remove'];
if($bwsub) {
if($bwurl) {
@mysql_query("INSERT INTO wcddl_whitelist VALUES ('".mysql_real_escape_string($bwurl)."')");
echo 'URL has been whitelisted.';
}
if($remove) {
$fishpan = 0;
foreach($remove as $url) {
mysql_query("DELETE FROM wcddl_whitelist WHERE url = '".mysql_real_escape_string($url)."'");
$fishpan++;
}
echo $fishpan.' sites were Removed from the whitelist.';
}
}
echo '<form action="" method="post"><table width="100%">
<tr><td>URL</td><td align="right">Remove</td></tr>';
$get = mysql_query("SELECT url FROM wcddl_whitelist");
while($row = mysql_fetch_assoc($get)) {
echo '<tr><td><a href="http://'.$row['url'].'" target="_blank">'.$row['url'].'</a></td><td align="right"><input type="checkbox" name="remove[]" value="'.$row['url'].'"></td></tr>';
}
echo '<tr><td colspan="2" align="right"><input type="submit" value="Remove Selected" name="bwsub"></td></tr>
</table></form><br>
<form action="" method="post"><table width="100%">
<tr><td align="center">whitelist an URL</td></tr>
<tr><td align="center">DO NOT INCLUDE WWW., HTTP:// or a directory! ONLY THE HOST NAME<br><input type="text" name="bwurl"></td></tr>
<tr><td align="center"><input type="submit" value="whitelist" name="bwsub"></td></tr></table></form>';
}
==/CODE=
Now then. here is the code for admin_blacklist();
==CODE==
function admin_blacklist() {
echo <<<TMP
<a href="?go=blacklist&add">Add site to blacklist</a><br><br>
<a href="?go=blacklist&view">View the blacklist</a><br><br>
TMP;
if (isset($_GET['add'])) {
if (isset($_POST['addblacklist']) && !empty($_POST['blurl']) && !empty($_POST['blreason'])) {
$blurl = $_POST['blurl'];
$blurl = purl(str_replace("www.","",$blurl),"host");
$blurl = htmlentities($blurl);
$blurl = addslashes($blurl);
$blurl = strtolower($blurl);
$blreason = $_POST['blreason'];
$blreason = str_replace("\r\n", '<br />', $blreason);
$blreason = str_replace("\n", '<br />', $blreason);
$blreason = str_replace("\r", '<br />', $blreason);
$blreason = addslashes($blreason);
$time = time();
if (!empty($blurl)) {
$exists = mysql_query('SELECT * FROM wcddl_blacklist WHERE url="'.addslashes($blurl).'"');
if (mysql_num_rows($exists)==0) {
mysql_query('INSERT INTO wcddl_blacklist (url,date,reason) VALUES ("'.$blurl.'", "'.$time.'", "'.$blreason.'")');
$sid = mysql_query("SELECT id FROM wcddl_sites WHERE url = '".mysql_real_escape_string($blurl)."'");
$sid = mysql_result($sid,"id");
mysql_query("DELETE FROM wcddl_downloads WHERE sid = '".mysql_real_escape_string($sid)."'");
mysql_query("DELETE FROM wcddl_queue WHERE sid = '".mysql_real_escape_string($sid)."'");
echo $blurl.' has been added to the blacklist for:<br> '. stripslashes($blreason) . '<br><br><br>';
}
else
{
echo "$blurl is already blacklisted.<br><br><br>";
}
}
else
{
echo "ERROR! Please take a look at the URL again... make sure that it has the HTTP:// in front of it.<br><br><br>";
}
}
echo <<<TMP
<form action="" method="post">
<small>Site URL (You need to add the HTTP:// infront, the script will validate it):<small><br>
<input type="text" name="blurl" /><br><br>
<small>Reason (HTML is allowed. Just dont use \'s):</small><br>
<textarea name="blreason" style="width: 50%;" rows="10"></textarea><br><br>
<input type="submit" name="addblacklist">
</form>
TMP;
echo '<br /><br />';
echo 'Quick BL<br /><br />';
echo '
<p style="float: left;">
No link back<br />
<textarea cols="5" rows="5" onfocus="this.select();">You do not link back to <a href="index.php">File Empire</a>.
You <strong>MUST</strong> link back to us. Get the code <a href="submit.php">here</a>.
<br />
Be sure to read the <a href="submit.php">Rules</a> carefully.
</textarea>
</p>
<p style="float: right;">
Down or not funtioning<br />
<textarea cols="5" rows="5" onfocus="this.select();">Your site is either down or not functioning properly.
Email the webmaster when the issue has been resolved.
<br />
Be sure to read the <a href="submit.php">Rules</a> carefully.</textarea>
</p>
<br />
<p style="float: left;">
Spam<br />
<textarea cols="5" rows="5" onfocus="this.select();">Your site has submitted spam.
<br />
Be sure to read the <a href="submit.php">Rules</a> carefully.</textarea>
</p>
<p style="float: right;">
Does not exist<br />
<textarea cols="5" rows="5" onfocus="this.select();">The site does not exist.
<br />
Be sure to read the <a href="submit.php">Rules</a> carefully.</textarea>
</p>
<p style="float: left">
Duplicate Site<br />
<textarea cols="5" rows="5" onfocus="this.select();">This is a duplicate of another site.
<br />
Be sure to read the <a href="submit.php">Rules</a> carefully.</textarea>
</p>
<p style="float: right">
Does not link directly to download page.<br />
<textarea cols="5" rows="5" onfocus="this.select();">You do not link directly to the download page.
<br />
Be sure to read the <a href="submit.php">Rules</a> carefully.</textarea>
</p>
<p style="float: left">
Submits duplicate downloads<br />
<textarea cols="5" rows="5" onfocus="this.select();">You submit duplicate downloads.
<br />
Be sure to read the <a href="submit.php">Rules</a> carefully.</textarea>
</p>
';
}
if (isset($_GET['view'])) {
if (isset($_POST['delete'])) {
mysql_query('DELETE FROM wcddl_blacklist WHERE id="'.$_POST['delete'].'"');
echo 'Deleted site with ID ' . $_POST['delete'] . ' the blacklist.';
}
if (isset($_POST['edit'])) {
echo '<form action="" method="post">';
$getble = mysql_query('SELECT * FROM wcddl_blacklist WHERE id="'.$_POST['edit'].'"');
if (mysql_num_rows($getble) == 1) {
while($dude = mysql_fetch_assoc($getble)) {
echo <<<TMP
<input type="hidden" name="id" value="{$dude[id]}"><br>
<small>Site URL (Include the HTTP:// again please):</small><br>
<input type="text" name="blurl" value="http://{$dude[url]}" /><br>
<small>Reason (NO HTML just BBCode!)</small><br>
<textarea name="blreason" style="width: 50%;" rows="10">{$dude[reason]}</textarea><br><br>
TMP;
}
}
echo '<input type="submit" name="fined" value="Finish Editing" />';
echo '</form>';
}
$getbl = mysql_query('SELECT * FROM wcddl_blacklist ORDER BY id DESC');
if (mysql_num_rows($getbl) != 0) {
echo '<form action="" method="post"><table style="width: 100%;">';
echo '<tr><td style="width: 50%;">URL - Date</td><td style="width: 25%;">DELETE</delete></tr>';
while($bl = mysql_fetch_assoc($getbl)) {
$date = date('d-m-Y', $bl[date]);
echo <<<TMP
<tr>
<td><a href="http://{$bl[url]}">{$bl[url]} - {$date}</td>
<td><input type="submit" name="delete" value="{$bl[id]}" style="width: 100%;" /></td>
</tr>
TMP;
}
echo '</table></form>';
}
else
{
echo "No sites in blacklist";
}
}
}
==/CODE==
And yes, You replace the old code with the new codes above.
Now then. If you DO NOT have any sites in your blacklist... then you can use this code.
==CODE==
SET FOREIGN_KEY_CHECKS=0;
DROP TABLE IF EXISTS `wcddl_blacklist`;
CREATE TABLE `wcddl_blacklist` (
`id` int(11) NOT NULL auto_increment,
`url` varchar(255) NOT NULL,
`date` varchar(255) NOT NULL,
`reason` mediumtext NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
==/CODE==
If you already have a blacklist... then you'll have to insert each URL in with this query...
Later on there may be an easier way... but I doubt it cuz i have other stuff i want to code.
==CODE==
INSERT INTO wcddl_blacklist (url,date,reason) VALUES ('[SITE URL]', '1255541430', "[REASON]")
==/CODE==
When you're inserting sites... make sure that there is NO trailing slashes OR http://www. OR http:// in them.
So if You wanted to blacklist lets say... http://www.warezcoders.com/forum
OR <-- Yes.. there is an alternative.
You can copy all of the URL's that you blacklisted already into a text file, then use
the admin panel of the BlackList to add them. A lot faster. A lot easier.
If you have too much sites in your blacklist then.. its gunna be a long day for you if you really want to use it.
You would actually put just warezcoders.com
get it? if you dont, read it over again.
Well... now its time to show the user the blacklist. Or else this would kind of been useless.
Here is the code for that. Make sure tht you include funcs.php
==CODE==
<form action="" method="post">
<p>
Site URL (http:// is required): <input type="text" name="blurl" value="http://" /> <input type="submit" name="blsear" />
</p>
</form>
<table style="width: 100%;">
<tbody>
<tr>
<th style="width: 30%">URL</th>
<th style="width: 70%">Reason & Date</th>
</tr>
<?php
$where = null;
if (isset($_POST['blsear'])) {
$blurl = $_POST['blurl'];
$where = ' WHERE url LIKE "%'.$blurl.'%"';
}
}
$getbl = mysql_query('SELECT * FROM wcddl_blacklist '.$where.' ORDER BY id DESC LIMIT 50');
$alternate = 0;
if ($alternate == 0) {
echo '<tr>';
$alternate = 1;
}
else
{
echo '<tr>';
$alternate = 0;
}
$date = date('d-m-Y', $inf['date']);
echo <<<TMP
<td style="border-bottom: 2px solid;">{$inf['url']}</td>
<td style="border-bottom: 2px solid;"><p>$reason <br>Blacklisted on: $date</p></td>
</tr>
TMP;
}
}
else
{
echo '<tr><td style="color: #FFF;" colspan="2">No search met your criteria.</td></tr>';
}
?>
</tbody>
</table>
==/CODE==
O, it would be great if you could link back to my site.
http://file-empire.com/
if you dont... then don't expect me to give any support.
==/iNSTaLL==
==MaNuaL iNSTRuCTiONS==
None. Just try to link back to
http://file-empire.com on your website.
==/MaNuaL iNSTRuCTiONS==