-
-
Save pimiento/2285f8d3100d02d992ff to your computer and use it in GitHub Desktop.
chatlogs parsing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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