Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F20615
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Authored By
stwalkerster
May 26 2017, 6:01 PM
2017-05-26 18:01:32 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
View Options
<?php
$database
=
new
PDO
(
'mysql:host=localhost;dbname=production'
,
'stwalkerster'
,
'lolnope'
);
$stmt
=
$database
->
query
(
"select id, name, date from request where status = 'Open' and emailconfirm = 'Confirmed'"
);
$result
=
$stmt
->
fetchAll
(
PDO
::
FETCH_ASSOC
);
$api
=
'http://en.wikipedia.org/w/api.php?action=query&format=json&list=users&meta=&titles=&usprop=registration&usattachedwiki=&ususers='
;
foreach
(
$result
as
$req
)
{
$url
=
$api
.
urlencode
(
$req
[
'name'
]);
$data
=
file_get_contents
(
$url
);
$obj
=
json_decode
(
$data
);
if
(!
isset
(
$obj
->
query
->
users
[
0
]->
missing
))
{
$regDate
=
new
DateTime
((
$obj
->
query
->
users
[
0
]->
registration
));
$reqDate
=
new
DateTime
(
$req
[
'date'
]);
$reason
=
'Unknown'
;
if
(
$regDate
<
$reqDate
)
{
$reason
=
'Taken'
;
}
if
(
$reqDate
<
$regDate
)
{
$reason
=
'Self-create'
;
}
echo
$req
[
'id'
]
.
"|"
.
$req
[
'name'
]
.
"|"
.
(
$obj
->
query
->
users
[
0
]->
registration
)
.
"|"
.
$req
[
'date'
]
.
"|"
.
$reason
.
"
\n
"
;
}
}
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18901
Default Alt Text
(1 KB)
Attached To
Mode
P132 (An Untitled Masterwork)
Attached
Detach File
Event Timeline
Log In to Comment