www: add some infra to ban or remove content.
SVN revision: 81115
This commit is contained in:
parent
153e4fbaf6
commit
f4ce52bf03
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
function get_ip()
|
||||
{
|
||||
if (getenv("REMOTE_ADDR")) $ip = getenv("REMOTE_ADDR");
|
||||
else $ip = "UNKNOWN";
|
||||
return $ip;
|
||||
}
|
||||
|
||||
$img = "";
|
||||
if (isset($_GET['image']))
|
||||
$img = $_GET['image'];
|
||||
|
||||
$file = "/var/www/www/ss/" . $img;
|
||||
$ignore_file = "/var/www/www/ss/ignore-" . $img;
|
||||
$abuse_file = "/var/www/www/ss/abuse-" . $img;
|
||||
|
||||
if ($img[0] == "e" && file_exists($file) && !file_exists($ignore_file))
|
||||
{
|
||||
$already = false;
|
||||
$auth = md5($img . get_ip());
|
||||
|
||||
$count = 0;
|
||||
$fh = fopen($abuse_file, "r");
|
||||
if ($fh)
|
||||
{
|
||||
while (!feof($fh))
|
||||
{
|
||||
$tmp = fgets($fh);
|
||||
if ($auth == $tmp)
|
||||
{
|
||||
// Don't let people vote multiple time somehow
|
||||
$already = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
fclose($fh);
|
||||
}
|
||||
|
||||
if ($count > 10)
|
||||
{
|
||||
rename("/var/www/www/ss/ip-" . $img,
|
||||
"/var/www/www/ss/ban/ip-" . $img);
|
||||
rename("/var/www/www/ss/abuse-" . $img,
|
||||
"/var/www/www/ss/ban/abuse-" . $img);
|
||||
rename("/var/www/www/ss/th-" . $img,
|
||||
"/var/www/www/ss/ban/th-" . $img);
|
||||
rename("/var/www/www/ss/" . $img,
|
||||
"/var/www/www/ss/ban/" . $img);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!already)
|
||||
{
|
||||
$fh = fopen($abuse_file, "a");
|
||||
fwrite($fh, $auth . "\n");
|
||||
fclose($fh);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
header("Location: http://www.enlightenment.org/ss/");
|
||||
die();
|
||||
?>
|
|
@ -0,0 +1,49 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
|
||||
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>Enlightenment Screenshots</title>
|
||||
<link href="index.css" rel="stylesheet" type="text/css"></link>
|
||||
</head>
|
||||
<body bgcolor=#ffffff alink=#88bbff link=#000000 vlink=#888888>
|
||||
<?php
|
||||
function get_ip()
|
||||
{
|
||||
if (getenv("REMOTE_ADDR")) $ip = getenv("REMOTE_ADDR");
|
||||
else $ip = "UNKNOWN";
|
||||
return $ip;
|
||||
}
|
||||
|
||||
$auth_file = "/var/www/www/ss/tmp/ip-" . $img;
|
||||
$auth_expire = 60 * 60; // You have one hour to remove your content
|
||||
|
||||
$img = "";
|
||||
if (isset($_GET['image']))
|
||||
$img = $_GET['image'];
|
||||
|
||||
if (time() - filemtime($auth_file) < $auth_expire)
|
||||
{
|
||||
$auth = md5($img . get_ip());
|
||||
|
||||
$fh = fopen($auth_file, "r");
|
||||
$head = fgets($fh);
|
||||
fclose($fh);
|
||||
}
|
||||
else
|
||||
{
|
||||
$auth = false;
|
||||
$head = true;
|
||||
}
|
||||
|
||||
print "<a href=http://www.enlightenment.org/ss/" . $img . ">";
|
||||
print "<img src=" . $img " border=1>";
|
||||
print "</a>\n";
|
||||
|
||||
if ($head == $auth)
|
||||
{
|
||||
print "<a href=remove.php?image=" . $img . ">Remove content</a>\n";
|
||||
}
|
||||
print "<a href=ban.php?image=" . $img . ">Alert content</a>\n";
|
||||
?>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
function get_ip()
|
||||
{
|
||||
if (getenv("REMOTE_ADDR")) $ip = getenv("REMOTE_ADDR");
|
||||
else $ip = "UNKNOWN";
|
||||
return $ip;
|
||||
}
|
||||
|
||||
$img = "";
|
||||
if (isset($_GET['image']))
|
||||
$img = $_GET['image'];
|
||||
|
||||
$file = "/var/www/www/ss/" . $img;
|
||||
$ignore_file = "/var/www/www/ss/ignore-" . $img;
|
||||
$abuse_file = "/var/www/www/ss/abuse-" . $img;
|
||||
|
||||
if ($img[0] == "e" && file_exists($file) && !file_exists($ignore_file))
|
||||
{
|
||||
if (time() - filemtime($auth_file) < $auth_expire)
|
||||
{
|
||||
$auth = md5($img . get_ip());
|
||||
|
||||
$fh = fopen($auth_file, "r");
|
||||
$head = fgets($fh);
|
||||
fclose($fh);
|
||||
|
||||
if ($auth == $head)
|
||||
{
|
||||
rename("/var/www/www/ss/ip-" . $img,
|
||||
"/var/www/www/ss/kill/ip-" . $img);
|
||||
rename("/var/www/www/ss/abuse-" . $img,
|
||||
"/var/www/www/ss/kill/abuse-" . $img);
|
||||
rename("/var/www/www/ss/th-" . $img,
|
||||
"/var/www/www/ss/kill/th-" . $img);
|
||||
rename("/var/www/www/ss/" . $img,
|
||||
"/var/www/www/ss/kill/" . $img);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
header("Location: http://www.enlightenment.org/ss/");
|
||||
die();
|
||||
?>
|
Loading…
Reference in New Issue