Gazelle/sections/tools/services/get_host.php
What.CD 6273679d49 86 changes from Wed Jul 27 01:50:24 2011 -0400 to Tue Aug 9 12:47:47 2011 -0400
fix typo I introduced in schedule.php
Print to LAB_CHAN if sphinx connection fails
nice bitcoin display
Corrects [#] tag for Mono  [hateradio]
bitcoin donation
Fix torrent unbookmarking
upgraded sphinxapi.php to r2876 as the site is running r2902
Added options to block Tor, Opera Turbo and Opera Mini
check for stale cache
vanity house  [clone00]
bookmark almost anything  [patapper]
new torrent edit flags  [rattvis]
permissions stuff from patappatch c
[BBCode] new [important] tag  [DutchDude]
Fixed images flowing past their boxes  [hateradio]
[BBCode] Tag for ordered lists.  [hateradio]
finally fixed that annoying textarea-resizing thing
renamed temporary tables

fixes http://what.cd/forums.php?action=viewthread&threadid=137432&page=1#post3408738
implements http://what.cd/forums.php?action=viewthread&threadid=122832
fixes http://what.cd/forums.php?action=viewthread&threadid=136553
fixes http://what.cd/forums.php?action=viewthread&threadid=112967
implements http://what.cd/forums.php?action=viewthread&threadid=110395
2011-08-09 21:03:28 +00:00

40 lines
976 B
PHP

<?
if(isset($_SERVER['http_if_modified_since'])) {
header("Status: 304 Not Modified");
die();
}
header('Expires: '.date('D, d-M-Y H:i:s \U\T\C',time()+3600*24*120)); //120 days
header('Last-Modified: '.date('D, d-M-Y H:i:s \U\T\C',time()));
if(!check_perms('users_view_ips')) { die('Access denied.'); }
$Octets = explode(".", $_GET['ip']);
if(
empty($_GET['ip']) ||
!preg_match('/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/', $_GET['ip']) ||
$Octets[0] < 0 ||
$Octets[0] > 255 ||
$Octets[1] < 0 ||
$Octets[1] > 255 ||
$Octets[2] < 0 ||
$Octets[2] > 255 ||
$Octets[3] < 0 ||
$Octets[3] > 255 ||
$Octets[0] == 127 ||
($Octets[0] == 192 && $Octets[1] == 168)
) {
die('Invalid IP.');
}
$Host = lookup_ip($_GET['ip']);
if ($Host === '') {
trigger_error("get_host() command failed with no output, ensure that the host command exists on your system and accepts the argument -W");
} elseif ($Host === false) {
print 'Could not retrieve host.';
} else {
print $Host;
}