Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117885641
IP4Net.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
853 B
Referenced Files
None
Subscribers
None
IP4Net.php
View Options
<?php
namespace
App
;
use
Illuminate\Database\Eloquent\Model
;
use
Illuminate\Support\Facades\DB
;
class
IP4Net
extends
Model
{
protected
$table
=
"ip4nets"
;
protected
$fillable
=
[
'rir_name'
,
'net_number'
,
'net_mask'
,
'net_broadcast'
,
'country'
,
'serial'
,
'created_at'
,
'updated_at'
];
public
static
function
getNet
(
$ip
,
$mask
=
32
)
{
$query
=
"
SELECT id FROM ip4nets
WHERE INET_ATON(net_number) <= INET_ATON(?)
AND INET_ATON(net_broadcast) >= INET_ATON(?)
ORDER BY INET_ATON(net_number), net_mask DESC LIMIT 1
"
;
$results
=
DB
::
select
(
$query
,
[
$ip
,
$ip
]);
if
(
sizeof
(
$results
)
==
0
)
{
return
null
;
}
return
\App\IP4Net
::
find
(
$results
[
0
]->
id
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, Apr 6, 2:08 AM (1 w, 2 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
f1/ad/c257ee761b6687cc4da2e48e9076
Default Alt Text
IP4Net.php (853 B)
Attached To
Mode
rK kolab
Attached
Detach File
Event Timeline