Skip to content

Instantly share code, notes, and snippets.

@pimiento
Forked from oxpa/jpegs.php
Created December 11, 2015 07:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pimiento/2285f8d3100d02d992ff to your computer and use it in GitHub Desktop.
Save pimiento/2285f8d3100d02d992ff to your computer and use it in GitHub Desktop.
chatlogs parsing
<?php
date_default_timezone_set('UTC');
echo '<html>';
$request=explode('/',$_SERVER['SCRIPT_NAME'],3);
$log_url=$request[2];
if (empty($log_url)) {
$upper="programming@conference.jabber.ru/".date('o/m')."/";
$log_url="programming@conference.jabber.ru/".date('o/m/d').".html";
};
$log = @file_get_contents("http://chatlogs.jabber.ru/${log_url}");
if (empty($log)) {
header("Location: /programming@conference.jabber.ru/");
};
if (substr_count($log_url,"/")>2 && substr_count($log_url,"html")>0) {
if (empty($upper)) {$upper="./";}; echo '<a href="'.$upper.'"> ./</a><br/>';
preg_match_all('/<a href="(\S+(jpe?g|png|gif)\S*|https?:\/\/imgur\S+)"[^<]*<\/a>/i', $log, $urls);
foreach (array_unique($urls[0]) as $url) {
if (strpos($url, "legendaryusa.com")) continue ; //they spammed me with emails to remove a single link
echo $url."<br/>";
}
}else {
echo $log;
};
echo '</html>';
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment