<?php
if(preg_match('/android|blackberry|ipad|iphone|ipod/i', $_SERVER['HTTP_USER_AGENT'])){
header("location:http://m.thaicreate.com/");
exit;
}
?>
DOCUMENT_ROOT แสดง Path Root Directory Home
GATEWAY_INTERFACE แสดงค่าอินเทอร์เฟชของ Cgi
HTTP_ACCEPT_LANGUAGE ภาษาที่ใช้
HTTP_CONNECTION สถานภาพการ คอนเน็กต์
HTTP_USER_AGENT แสดงประเภทของโปรแกรมที่เรียกเข้ามา เช่น IE
PATH_INFO แสดงชื่อเอกสาร
PATH_TRANSLATED แสดง Path ของเอกสาร
QUERY_STRING แสดงค่าใน Query String
REMOTE_ADDR แสดงค่า IP Address ของเครื่องที่เข้ามา
REMOTE_PORT แสดง Port เครื่องที่เข้ามา
REQUEST_METHOD แสดงค่ารับส่งว่าเป็น Get หรือ Post
SCRIPT_NAME แสดงชื่อเอกสาร
SERVER_NAME แสดงชื่อ Server
SERVER_PORT แสดง Port ของ Server
SERVER_PROTOCOL แสดง โปรโตคอลของ Server
SERVER_SOFTWARE แสดง โปรแกรมของ Server
Sample
PageServer.php
<html>
<head>
<title>ThaiCreate.Com Tutorial</title>
</head>
<body>
<?php
echo "\$_SERVER[\"HTTP_ACCEPT\"] = ".$_SERVER["HTTP_ACCEPT"]."<br>";
echo "\$_SERVER[\"HTTP_ACCEPT_LANGUAGE\"] = ".$_SERVER["HTTP_ACCEPT_LANGUAGE"]."<br>";
echo "\$_SERVER[\"HTTP_ACCEPT_ENCODING\"] = ".$_SERVER["HTTP_ACCEPT_ENCODING"]."<br>";
echo "\$_SERVER[\"HTTP_USER_AGENT\"] = ".$_SERVER["HTTP_USER_AGENT"]."<br>";
echo "\$_SERVER[\"HTTP_HOST\"] = ".$_SERVER["HTTP_HOST"]."<br>";
echo "\$_SERVER[\"HTTP_CONNECTION\"] = ".$_SERVER["HTTP_CONNECTION"]."<br>";
echo "\$_SERVER[\"PATH\"] = ".$_SERVER["PATH"]."<br>";
echo "\$_SERVER[\"SystemRoot\"] = ".$_SERVER["SystemRoot"]."<br>";
echo "\$_SERVER[\"COMSPEC\"] = ".$_SERVER["COMSPEC"]."<br>";
echo "\$_SERVER[\"PATHEXT\"] = ".$_SERVER["PATHEXT"]."<br>";
echo "\$_SERVER[\"WINDIR\"] = ".$_SERVER["WINDIR"]."<br>";
echo "\$_SERVER[\"SERVER_SIGNATURE\"] = ".$_SERVER["SERVER_SIGNATURE"]."<br>";
echo "\$_SERVER[\"SERVER_SOFTWARE\"] = ".$_SERVER["SERVER_SOFTWARE"]."<br>";
echo "\$_SERVER[\"SERVER_NAME\"] = ".$_SERVER["SERVER_NAME"]."<br>";
echo "\$_SERVER[\"SERVER_ADDR\"] = ".$_SERVER["SERVER_ADDR"]."<br>";
echo "\$_SERVER[\"SERVER_PORT\"] = ".$_SERVER["SERVER_PORT"]."<br>";
echo "\$_SERVER[\"REMOTE_ADDR\"] = ".$_SERVER["REMOTE_ADDR"]."<br>";
echo "\$_SERVER[\"DOCUMENT_ROOT\"] = ".$_SERVER["DOCUMENT_ROOT"]."<br>";
echo "\$_SERVER[\"SERVER_ADMIN\"] = ".$_SERVER["SERVER_ADMIN"]."<br>";
echo "\$_SERVER[\"SCRIPT_FILENAME\"] = ".$_SERVER["SCRIPT_FILENAME"]."<br>";
echo "\$_SERVER[\"REMOTE_PORT\"] = ".$_SERVER["REMOTE_PORT"]."<br>";
echo "\$_SERVER[\"GATEWAY_INTERFACE\"] = ".$_SERVER["GATEWAY_INTERFACE"]."<br>";
echo "\$_SERVER[\"SERVER_PROTOCOL\"] = ".$_SERVER["SERVER_PROTOCOL"]."<br>";
echo "\$_SERVER[\"REQUEST_METHOD\"] = ".$_SERVER["REQUEST_METHOD"]."<br>";
echo "\$_SERVER[\"QUERY_STRING\"] = ".$_SERVER["QUERY_STRING"]."<br>";
echo "\$_SERVER[\"REQUEST_URI\"] = ".$_SERVER["REQUEST_URI"]."<br>";
echo "\$_SERVER[\"SCRIPT_NAME\"] = ".$_SERVER["SCRIPT_NAME"]."<br>";
echo "\$_SERVER[\"PHP_SELF\"] = ".$_SERVER["PHP_SELF"]."<br>";
echo "\$_SERVER[\"REQUEST_TIME\"] = ".$_SERVER["REQUEST_TIME"]."<br>";
echo "\$_SERVER[\"argv\"] = ".$_SERVER["argv"]."<br>";
echo "\$_SERVER[\"argc\"] = ".$_SERVER["argc"]."<br>";
?>
</body>
</html>
<html>
<head>
<title>ThaiCreate.Com Tutorial</title>
</head>
<body>
<?php
echo "\$_SERVER[\"HTTP_ACCEPT\"] = ".$_SERVER["HTTP_ACCEPT"]."<br>";
echo "\$_SERVER[\"HTTP_ACCEPT_LANGUAGE\"] = ".$_SERVER["HTTP_ACCEPT_LANGUAGE"]."<br>";
echo "\$_SERVER[\"HTTP_ACCEPT_ENCODING\"] = ".$_SERVER["HTTP_ACCEPT_ENCODING"]."<br>";
echo "\$_SERVER[\"HTTP_USER_AGENT\"] = ".$_SERVER["HTTP_USER_AGENT"]."<br>";
echo "\$_SERVER[\"HTTP_HOST\"] = ".$_SERVER["HTTP_HOST"]."<br>";
echo "\$_SERVER[\"HTTP_CONNECTION\"] = ".$_SERVER["HTTP_CONNECTION"]."<br>";
echo "\$_SERVER[\"PATH\"] = ".$_SERVER["PATH"]."<br>";
echo "\$_SERVER[\"SystemRoot\"] = ".$_SERVER["SystemRoot"]."<br>";
echo "\$_SERVER[\"COMSPEC\"] = ".$_SERVER["COMSPEC"]."<br>";
echo "\$_SERVER[\"PATHEXT\"] = ".$_SERVER["PATHEXT"]."<br>";
echo "\$_SERVER[\"WINDIR\"] = ".$_SERVER["WINDIR"]."<br>";
echo "\$_SERVER[\"SERVER_SIGNATURE\"] = ".$_SERVER["SERVER_SIGNATURE"]."<br>";
echo "\$_SERVER[\"SERVER_SOFTWARE\"] = ".$_SERVER["SERVER_SOFTWARE"]."<br>";
echo "\$_SERVER[\"SERVER_NAME\"] = ".$_SERVER["SERVER_NAME"]."<br>";
echo "\$_SERVER[\"SERVER_ADDR\"] = ".$_SERVER["SERVER_ADDR"]."<br>";
echo "\$_SERVER[\"SERVER_PORT\"] = ".$_SERVER["SERVER_PORT"]."<br>";
echo "\$_SERVER[\"REMOTE_ADDR\"] = ".$_SERVER["REMOTE_ADDR"]."<br>";
echo "\$_SERVER[\"DOCUMENT_ROOT\"] = ".$_SERVER["DOCUMENT_ROOT"]."<br>";
echo "\$_SERVER[\"SERVER_ADMIN\"] = ".$_SERVER["SERVER_ADMIN"]."<br>";
echo "\$_SERVER[\"SCRIPT_FILENAME\"] = ".$_SERVER["SCRIPT_FILENAME"]."<br>";
echo "\$_SERVER[\"REMOTE_PORT\"] = ".$_SERVER["REMOTE_PORT"]."<br>";
echo "\$_SERVER[\"GATEWAY_INTERFACE\"] = ".$_SERVER["GATEWAY_INTERFACE"]."<br>";
echo "\$_SERVER[\"SERVER_PROTOCOL\"] = ".$_SERVER["SERVER_PROTOCOL"]."<br>";
echo "\$_SERVER[\"REQUEST_METHOD\"] = ".$_SERVER["REQUEST_METHOD"]."<br>";
echo "\$_SERVER[\"QUERY_STRING\"] = ".$_SERVER["QUERY_STRING"]."<br>";
echo "\$_SERVER[\"REQUEST_URI\"] = ".$_SERVER["REQUEST_URI"]."<br>";
echo "\$_SERVER[\"SCRIPT_NAME\"] = ".$_SERVER["SCRIPT_NAME"]."<br>";
echo "\$_SERVER[\"PHP_SELF\"] = ".$_SERVER["PHP_SELF"]."<br>";
echo "\$_SERVER[\"REQUEST_TIME\"] = ".$_SERVER["REQUEST_TIME"]."<br>";
echo "\$_SERVER[\"argv\"] = ".$_SERVER["argv"]."<br>";
echo "\$_SERVER[\"argc\"] = ".$_SERVER["argc"]."<br>";
?>
</body>
</html>