Seite 1 von 1

Server Variablen abfragen

Verfasst: 14.12.2014 10:43
von GodHunter
Hallo,

wie kommt man mit request_var an die Server Variablen, also z.B. $_Server('REMOTE_USER') oder beim File Upload an Daten wie $_FILES['Filedata']['tmp_name']?
Mit request_var komme ich hier glaube ich nicht weiter, habe aber nix passendes zum Thema gefunden.

Re: Server Variablen abfragen

Verfasst: 15.12.2014 15:34
von regazer
Meinst Du sowas wie

Code: Alles auswählen

<?php
echo "Admin: ".$_SERVER["SERVER_ADMIN"]."<br />";
echo "Server-Name: ".$_SERVER["SERVER_NAME"]."<br />";
echo "Server-Port: ".$_SERVER["SERVER_PORT"]."<br />";
echo "Server-Protokoll: ".$_SERVER["SERVER_PROTOCOL"]."<br />";
echo "Server-Signatur: ".$_SERVER["SERVER_SIGNATURE"]."<br />";
echo "Server-Software: ".$_SERVER["SERVER_SOFTWARE"];
?>
?

gefunden bei http://www.winkelb.com/index.php?id=php-server-abfragen
über google mit dem simplen Suchbegriff php serverdaten abfragen :lol:

Oder vielleicht sowas wie auf http://phpsysinfo.github.io/phpsysinfo/ - das habe ich mir aber nicht weiter angesehen.

Beschreibe das Anliegen bitte mal etwas genauer. Wozu sollen die Angaben dienen? Vielleicht gibt es schon eine fertige Lösung.

Vielleicht hilft Dir das hier weiter Wie man request_var (nicht) benutzen sollte ?

Re: Server Variablen abfragen

Verfasst: 18.12.2014 00:26
von regazer
Ich habe hier noch ein Script gefunden, das diverse Server-Variablen verfügbar macht (falls sie überhaupt geliefert werden, was nicht immer zutrifft):

Code: Alles auswählen

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Servervariablen</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body style="color: black; background-color: #CCC;">
<?php
echo '<font face="Courier" size=2>';
// Erkenntnisse aus "MySQL 5 für Schnelleinsteiger", Kapitel 9 :
echo 'AUTH_TYPE &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : '; if(isset ($_SERVER["AUTH_TYPE"]))echo $_SERVER["AUTH_TYPE"];  echo'<br />';
echo 'CONTENT_LENGTH &nbsp; &nbsp;&nbsp; : '; if(isset ($_SERVER["CONTENT_LENGTH"])) echo $_SERVER["CONTENT_LENGTH"]; echo'<br />';
echo 'CONTENT_TYPE &nbsp; &nbsp; &nbsp;&nbsp; : '; if(isset ($_SERVER["CONTENT_TYPE"]))echo $_SERVER["CONTENT_TYPE"]; echo'<br />';
echo 'GATEWAY_INTERFACE &nbsp; : '; if(isset ($_SERVER["GATEWAY_INTERFACE"]))echo $_SERVER["GATEWAY_INTERFACE"]; echo'<br />';
echo 'HTTP_ACCEPT &nbsp; &nbsp; &nbsp; &nbsp; : '; if(isset ($_SERVER["HTTP_ACCEPT"]))echo $_SERVER["HTTP_ACCEPT"]; echo'<br />';
echo 'HTTP_COOKIE &nbsp; &nbsp; &nbsp; &nbsp; : '; if(isset ($_SERVER["HTTP_COOKIE"]))echo $_SERVER["HTTP_COOKIE"]; echo'<br />';
echo 'HTTP_REFERER &nbsp; &nbsp; &nbsp;&nbsp; : '; if(isset ($_SERVER["HTTP_REFERER"]))echo $_SERVER["HTTP_REFERER"]; echo'<br />';
echo 'HTTP_USER_AGENT &nbsp; &nbsp; : '; if(isset ($_SERVER["HTTP_USER_AGENT"]))echo $_SERVER["HTTP_USER_AGENT"]; echo'<br />';
echo 'PATH_INFO &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : '; if(isset ($_SERVER["PATH_INFO"]))echo $_SERVER["PATH_INFO"]; echo'<br />';
echo 'PATH_TRANSLATED &nbsp; &nbsp; : '; if(isset ($_SERVER["PATH_TRANSLATED"]))echo $_SERVER["PATH_TRANSLATED"]; echo'<br />';
echo 'QUERY_STRING &nbsp; &nbsp;&nbsp; &nbsp; : '; if(isset ($_SERVER["QUERY_STRING"]))echo $_SERVER["QUERY_STRING"]; echo'<br />';
echo 'REMOTE_ADDR &nbsp; &nbsp; &nbsp; &nbsp; : '; if(isset($_SERVER["REMOTE_ADDR"]))echo $_SERVER["REMOTE_ADDR"];; echo'<br />';
echo 'REMOTE_HOST &nbsp; &nbsp; &nbsp; &nbsp; : '; if(isset ($_SERVER["REMOTE_HOST"]))echo $_SERVER["REMOTE_HOST"]; echo'<br />';
echo 'REMOTE_IDENT &nbsp; &nbsp;&nbsp; &nbsp; : '; if(isset ($_SERVER["REMOTE_IDENT"]))echo $_SERVER["REMOTE_IDENT"]; echo'<br />';
echo 'REMOTE_USER &nbsp; &nbsp; &nbsp; &nbsp; : '; if(isset ($_SERVER["REMOTE_USER"]))echo $_SERVER["REMOTE_USER"]; echo'<br />';
echo 'REQUEST_METHOD &nbsp;&nbsp; &nbsp; : '; if(isset ($_SERVER["REQUEST_METHOD"]))echo $_SERVER["REQUEST_METHOD"]; echo'<br />';
echo 'SCRIPT_NAME &nbsp; &nbsp; &nbsp; &nbsp; : '; if(isset ($_SERVER["SCRIPT_NAME"]))echo $_SERVER["SCRIPT_NAME"]; echo'<br />';
echo 'SERVER_NAME &nbsp; &nbsp; &nbsp; &nbsp; : '; if(isset ($_SERVER["SERVER_NAME"]))echo $_SERVER["SERVER_NAME"]; echo'<br />';
echo 'SERVER_PORT &nbsp; &nbsp; &nbsp; &nbsp; : '; if(isset ($_SERVER["SERVER_PORT"]))echo $_SERVER["SERVER_PORT"]; echo'<br />';
echo 'SERVER_PROTOCOL &nbsp; &nbsp; : '; if(isset ($_SERVER["SERVER_PROTOCOL"]))echo $_SERVER["SERVER_PROTOCOL"]; echo'<br />';
echo 'SERVER_SOFTWARE &nbsp; &nbsp; : '; if(isset ($_SERVER["SERVER_SOFTWARE"]))echo $_SERVER["SERVER_SOFTWARE"]; echo'<br />';
echo '</font>';
?>
</body>
</html>
Vielleicht läßt sich davon was brauchen.