function geoip_load_shared_mem in Smart IP 7.2
Same name and namespace in other branches
- 6.2 includes/geoip.inc \geoip_load_shared_mem()
File
- includes/
geoip.inc, line 241
Code
function geoip_load_shared_mem($file) {
$fp = fopen($file, "rb");
if (!$fp) {
print "error opening {$file}: {$php_errormsg}\n";
exit;
}
$s_array = fstat($fp);
$size = $s_array['size'];
if ($shmid = @shmop_open(GEOIP_SHM_KEY, "w", 0, 0)) {
shmop_delete($shmid);
shmop_close($shmid);
}
$shmid = shmop_open(GEOIP_SHM_KEY, "c", 0644, $size);
shmop_write($shmid, fread($fp, $size), 0);
shmop_close($shmid);
}