Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5974143
getallheaders.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
getallheaders.php
View Options
<?php
if
(!
function_exists
(
'getallheaders'
))
{
/**
* Get all HTTP header key/values as an associative array for the current request.
*
* @return string[string] The HTTP header key/value pairs.
*/
function
getallheaders
()
{
$headers
=
array
();
$copy_server
=
array
(
'CONTENT_TYPE'
=>
'Content-Type'
,
'CONTENT_LENGTH'
=>
'Content-Length'
,
'CONTENT_MD5'
=>
'Content-Md5'
,
);
foreach
(
$_SERVER
as
$key
=>
$value
)
{
if
(
substr
(
$key
,
0
,
5
)
===
'HTTP_'
)
{
$key
=
substr
(
$key
,
5
);
if
(!
isset
(
$copy_server
[
$key
])
||
!
isset
(
$_SERVER
[
$key
]))
{
$key
=
str_replace
(
' '
,
'-'
,
ucwords
(
strtolower
(
str_replace
(
'_'
,
' '
,
$key
))));
$headers
[
$key
]
=
$value
;
}
}
elseif
(
isset
(
$copy_server
[
$key
]))
{
$headers
[
$copy_server
[
$key
]]
=
$value
;
}
}
if
(!
isset
(
$headers
[
'Authorization'
]))
{
if
(
isset
(
$_SERVER
[
'REDIRECT_HTTP_AUTHORIZATION'
]))
{
$headers
[
'Authorization'
]
=
$_SERVER
[
'REDIRECT_HTTP_AUTHORIZATION'
];
}
elseif
(
isset
(
$_SERVER
[
'PHP_AUTH_USER'
]))
{
$basic_pass
=
isset
(
$_SERVER
[
'PHP_AUTH_PW'
])
?
$_SERVER
[
'PHP_AUTH_PW'
]
:
''
;
$headers
[
'Authorization'
]
=
'Basic '
.
base64_encode
(
$_SERVER
[
'PHP_AUTH_USER'
]
.
':'
.
$basic_pass
);
}
elseif
(
isset
(
$_SERVER
[
'PHP_AUTH_DIGEST'
]))
{
$headers
[
'Authorization'
]
=
$_SERVER
[
'PHP_AUTH_DIGEST'
];
}
}
return
$headers
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Oct 3, 17:09 (1 d, 3 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
dd/1d/eca44ffa1f1c8a84f5a42c707a57
Default Alt Text
getallheaders.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment