This nice PHP script will look for images based on MD5 hashes stored in a CSV file. If the image is found, it will output as HTML page with image thumbnail, IP address and link to the image. The CSV can be easily updated to add new MD5 hashes. The PHP script can be executed directly by opening the URL or a cron job can be set to send an email if the content is found.
Background: Somone kept uploading child abuse content on my site and started getting notice from hosting company and even the Interpol. Given the large no: of images uploaded per day, it was impossible to moderate every content and IP blocking is of no use since he used a new proxy/VPN every time. By using the below script I can easily find the content if he uploads again. Also can find any new images by using the IP search feature within the log.
Background: Somone kept uploading child abuse content on my site and started getting notice from hosting company and even the Interpol. Given the large no: of images uploaded per day, it was impossible to moderate every content and IP blocking is of no use since he used a new proxy/VPN every time. By using the below script I can easily find the content if he uploads again. Also can find any new images by using the IP search feature within the log.
PHP:
<html>
<?php
include('dbconnectfile.php'); //Your database config file
date_default_timezone_set('Asia/Kolkata'); // Your time zone
$time=date('Y-m-d H:i:s');
echo '<h2>Mod time '.$time.'</h2>';
$row = 1;
if (($handle = fopen("md5.csv", "r")) !== FALSE) {
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
$num = count($data);
$row++;
for ($c=0; $c < $num; $c++) {
$result = mysqli_query($link,"SELECT * FROM images where image_md5='$data[$c]';");
$find=0;
if (mysqli_num_rows($result)>0){
while($r=mysqli_fetch_array($result))
{
$find++;
$imageid=$r["image_id"];
$imagename=$r["image_name"];
$imageview=$r["image_views"];
$imagex=$r["image_extension"];
$ip=$r["image_uploader_ip"];
$imagedate=$r["image_date"];
$size=$r["image_size"];
$storid=$r["image_storage_id"];
$times=date("Y-m-d", strtotime($imagedate));
$timesp=explode('-',$times);
$search='https://sitedomain.com/search/images/?as_q=&as_epq=%22'.$imagename.'%22&as_eq=&as_stor='.$storid.'';
$storid--;
$imgurl='https://s'.$storid.'.sitedomain.com/images/'.$imagename.'.'.$imagex.''; //change to your image direct link and folder type
$imgmd='https://s'.$storid.'.sitedomain.com/images/'.$imagename.'.md.'.$imagex.'';
$ipurl='https://sitedomain.com/search/images/?as_ip='.$ip.'';
echo '<p><a href='.$search.'><img src='.$imgmd.'></a></p>';
echo '<p> Size: '.$asize.' '.$imagedate.' IP:<a href='.$ipurl.'>'.$ip.'</a> Views:'.$imageview.'<p>';
}
}
}
}
fclose($handle);
}
if ($find=1)
{
$email = "youremail@gmail.com";
$content = "Alert:Image found";
$name = "Alert";
$sender = "alert@email.com";
$subject = "Alert: Image found";
$headers = "From: $name "."<".$sender.">\r\n";
mail($email, $subject, $content, $headers );
}
?>
</html>
Last edited: