Subversion Repositories vgwhois

Rev

Rev 77 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 77 Rev 148
Line 3... Line 3...
3
 
3
 
4
#
4
#
5
#  VGWhoIs (ViaThinkSoft Global WhoIs, a fork of generic Whois / gwhois)
5
#  VGWhoIs (ViaThinkSoft Global WhoIs, a fork of generic Whois / gwhois)
6
#  Maintenance / Developer utilities
6
#  Maintenance / Developer utilities
7
#
7
#
8
#  (c) 2012-2019 by Daniel Marschall, ViaThinkSoft <info@daniel-marschall.de>
8
#  (c) 2012-2024 by Daniel Marschall, ViaThinkSoft <info@daniel-marschall.de>
9
#
9
#
10
#  License: https://www.gnu.org/licenses/gpl-2.0.html (GPL version 2)
10
#  License: https://www.gnu.org/licenses/gpl-2.0.html (GPL version 2)
11
#
11
#
12
 
12
 
13
error_reporting(E_ALL | E_NOTICE | E_STRICT | E_DEPRECATED);
13
error_reporting(E_ALL | E_NOTICE | E_STRICT | E_DEPRECATED);
Line 41... Line 41...
41
function rir_download_report($url, $outfile, $do_md5_check = true) {
41
function rir_download_report($url, $outfile, $do_md5_check = true) {
42
	if (($do_md5_check) && (file_exists($outfile))) {
42
	if (($do_md5_check) && (file_exists($outfile))) {
43
		$md5_ist  = md5_file($outfile);
43
		$md5_ist  = md5_file($outfile);
44
		$md5_soll = rir_get_md5_sum($url);
44
		$md5_soll = rir_get_md5_sum($url);
45
		if ($md5_soll == $md5_ist) {
45
		if ($md5_soll == $md5_ist) {
-
 
46
			@unlink("$outfile.fail");
46
			touch("$outfile.success");
47
			@touch("$outfile.success");
47
			return true;
48
			return true;
48
		}
49
		}
49
	}
50
	}
50
 
51
 
51
	$cont = file_get_contents($url);
52
	$cont = file_get_contents($url);
52
 
53
 
53
	if (!$cont) {
54
	if (!$cont) {
-
 
55
		@unlink("$outfile.success");
54
		touch("$outfile.fail");
56
		@touch("$outfile.fail");
55
		return false;
57
		return false;
56
	}
58
	}
57
 
59
 
58
	if ($do_md5_check) {
60
	if ($do_md5_check) {
59
		$md5_ist = md5($cont);
61
		$md5_ist = md5($cont);
60
		if (!isset($md5_soll)) $md5_soll = rir_get_md5_sum($url);
62
		if (!isset($md5_soll)) $md5_soll = rir_get_md5_sum($url);
61
		if ($md5_soll != $md5_ist) {
63
		if ($md5_soll != $md5_ist) {
-
 
64
			@unlink("$outfile.success");
62
			touch("$outfile.fail");
65
			@touch("$outfile.fail");
63
			return false;
66
			return false;
64
		}
67
		}
65
	}
68
	}
66
 
69
 
67
	$h = fopen($outfile, 'w');
70
	$h = fopen($outfile, 'w');
68
	if (!$h) return false;
71
	if (!$h) return false;
69
	if (!fwrite($h, $cont)) {
72
	if (!fwrite($h, $cont)) {
-
 
73
		@unlink("$outfile.success");
70
		touch("$outfile.fail");
74
		@touch("$outfile.fail");
71
		return false;
75
		return false;
72
	}
76
	}
73
	fclose($h);
77
	fclose($h);
74
 
78
 
-
 
79
	@unlink("$outfile.fail");
75
	touch("$outfile.success");
80
	@touch("$outfile.success");
76
	return true;
81
	return true;
77
}
82
}
78
 
83
 
79
$rirs[] = 'iana';
84
$rirs[] = 'iana';
80
 
85