I would like to call my site like this.
http://user:password@domain.com/
In PHP I tried to get user and Password via $_SERVER["PHP_AUTH_USER"]. But this is not set. How do I get access to the variable?
Please: I know that there are other possibilities to transport username etc. like domain.com/file.php?USR='hello' ... My approach is to get a solution by sending it with ...@ in front of the domain. THX in advance for any hint.
var_dump($_SERVER) gives the following:
array(38) {
["PATH"]=>
string(60) "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
["USER"]=>
string(8) "12345"
["HOME"]=>
string(20) "/www/htdocs/12345"
["FCGI_ROLE"]=>
string(9) "RESPONDER"
["UNIQUE_ID"]=>
string(27) "dhdhgdh-0rIG@VoNnAAAABA"
["HTTP_AUTHORIZATION"]=>
string(0) ""
["HTTP_HOST"]=>
string(17) "host.de"
["HTTP_USER_AGENT"]=>
string(77) "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0"
["HTTP_ACCEPT"]=>
string(74) "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"
["HTTP_ACCEPT_LANGUAGE"]=>
string(23) "de,en-US;q=0.7,en;q=0.3"
["HTTP_ACCEPT_ENCODING"]=>
string(13) "gzip, deflate"
["HTTP_CONNECTION"]=>
string(10) "keep-alive"
["HTTP_COOKIE"]=>
string(177) "hys_autoplay=false; _pk_id.2.459d=c9b4d5b7244b15e8.1582627031.1.1582627031.1582627031.; PHPSESSID=69c09a014b52db27b8a23ba739440e97; PIWIK_SESSID=2245baf1d465642b8b63c605cccd2c5c"
["HTTP_UPGRADE_INSECURE_REQUESTS"]=>
string(1) "1"
["SERVER_SIGNATURE"]=>
string(0) ""
["SERVER_SOFTWARE"]=>
string(6) "Apache"
["SERVER_NAME"]=>
string(17) "domain.de"
["SERVER_ADDR"]=>
string(12) "85.12.123.25"
["SERVER_PORT"]=>
string(2) "80"
["REMOTE_ADDR"]=>
string(13) "101.12.12.193"
["DOCUMENT_ROOT"]=>
string(36) "/www/htdocs/12345/hunting/"
["REQUEST_SCHEME"]=>
string(4) "http"
["CONTEXT_PREFIX"]=>
string(0) ""
["CONTEXT_DOCUMENT_ROOT"]=>
string(36) "/www/htdocs/12345/hunting/"
["SERVER_ADMIN"]=>
string(27) "webmaster@hunting.com"
["SCRIPT_FILENAME"]=>
string(53) "/www/htdocs/12345/domain/test/analyser.php"
["REMOTE_PORT"]=>
string(5) "10412"
["GATEWAY_INTERFACE"]=>
string(7) "CGI/1.1"
["SERVER_PROTOCOL"]=>
string(8) "HTTP/1.1"
["REQUEST_METHOD"]=>
string(3) "GET"
["QUERY_STRING"]=>
string(0) ""
["REQUEST_URI"]=>
string(18) "/test/analyser.php"
["SCRIPT_NAME"]=>
string(18) "/test/analyser.php"
["PHP_SELF"]=>
string(18) "/test/analyser.php"
["REQUEST_TIME_FLOAT"]=>
float(1584465038.95)
["REQUEST_TIME"]=>
int(1584465038)
["argv"]=>
array(0) {
}
["argc"]=>
int(0)
}
My htaccess:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
</IfModule>