Главная | Обратная связь | Поможем написать вашу работу!
МегаЛекции

Извлечение переменной окружения HTTP_X_FORWARDED_FOR




<?php
echo getenv(HTTP_X_FORWARDED_FOR);
?>

Элемент $_SERVER['SCRIPT_FILENAME']

В элемент $_SERVER['SCRIPT_FILENAME'] помещается абсолютный путь к файлу от корня диска. Так, если сервер работает под управлением операционной системы Windows, то такой путь может выглядеть следующим образом "d:main estindex.php", т.е. путь указывается от диска, в UNIX-подобной операционной системы путь указывается от корневой директории /, например "/var/share/www/test/index.php".

Элемент $_SERVER['SERVER_NAME']

В элемент $_SERVER['SERVER_NAME'] помещается имя сервера, как правило, совпадающее с доменным именем сайта, расположенного на нём. Например,

www.softtime.ru

Содержимое элемента $_SERVER['SERVER_NAME'] часто совпадает с содержимым элемента $_SERVER['HTTP_HOST']. Помимо имени сервера суперглобальный массив $_SERVER позволяет выяснить ещё ряд параметров сервера, например IP-адрес сервера, прослушиваемый порт, какой Web-сервер установлен и версию HTTP протокола. Эта информация помещается в элементы $_SERVER['SERVER_ADDR'], $_SERVER['SERVER_PORT'], $_SERVER['SERVER_SOFTWARE'] и $_SERVER['SERVER_PROTOCOL'], соответственно. Ниже приводится пример с использованием данных элементов.

Использование элементов массива $_SERVER

<?php
echo "Имя сервера - ".$_SERVER['SERVER_NAME']."<br />";
echo "IP-адрес сервера - ".$_SERVER['SERVER_ADDR']."<br />";
echo "Порт сервера - ".$_SERVER['SERVER_PORT']."<br />";
echo "Web-сервер - ".$_SERVER['SERVER_SOFTWARE']."<br />";
echo "Версия HTTP-протокола - ".$_SERVER['SERVER_PROTOCOL']."<br />";
?>

Элемент $_SERVER['REQUEST_METHOD']

В элемент $_SERVER['REQUEST_METHOD'] помещается метод запроса, который применяется для вызова скрипта: GET или POST.

<?php
echo $_SERVER['REQUEST_METHOD']; // GET
?>

Элемент $_SERVER['QUERY_STRING']

В элемент $_SERVER['QUERY_STRING'] заносятся параметры, переданные скрипту, если строка запроса представляет собой адрес

http://www.mysite.ru/test/index.php?id=1&test=wet&id_theme=512

то в элемент $_SERVER['QUERY_STRING'] попадёт весь текст после знака "?". Например, при обращении к скрипту, представленному ниже, помещая в строке запроса произвольный текст после знака "?" получим страницу с введённым текстом.

<?php
echo $_SERVER['QUERY_STRING']; // id=1&test=wet&id_theme=512
?>

Элемент $_SERVER['PHP_SELF']

В элемент $_SERVER['PHP_SELF'] помещается имя скрипта, начиная от корневой директории виртуального хоста, т.е. если строка запроса представляет собой адрес

http://www.mysite.ru/test/index.php?id=1&test=wet&id_theme=512

то элемент $_SERVER['PHP_SELF'] будет содержать фрагмент "/test/index.php". Как правило, этот же фрагмент помещается в элемент $_SERVER['SCRIPT_NAME'].

Элемент $_SERVER['REQUEST_URI']

В элемент $_SERVER['REQUEST_URI'] содержит имя скрипта, начиная от корневой директории виртуального хоста и параметры, т.е. если строка запроса представляет собой адрес:

http://www.mysite.ru/test/index.php?id=1&test=wet&id_theme=512

то элемент $_SERVER['REQUEST_URI'] будет содержать фрагмент "/test/index.php?id=1&test=wet&id_theme=512". Для того, чтобы восстановить в скрипте полный адрес, который помещён в строке запроса, достаточно использовать комбинацию элементов массива $_SERVER, представленную ниже

Полный адрес к скрипту

<?php
echo "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
?>

Пример:
<?php

 

echo "Ваш ip адрес: ".$_SERVER["REMOTE_ADDR"];

echo "<br>Ваша ОС: ".$_SERVER["HTTP_USER_AGENT"];

echo "<br>Document root: ".$_SERVER['DOCUMENT_ROOT'];

echo "<br>Http accept: ".$_SERVER['HTTP_ACCEPT'];

echo "<br>accept language: ".$_SERVER['HTTP_ACCEPT_LANGUAGE'];

echo "<br>http host: ".$_SERVER['HTTP_HOST'];

if (isset($_SERVER['HTTP_REFERER'])) {

echo "<br>http referer: ".$_SERVER['HTTP_REFERER'];

}

echo "<br>scropt filenale: ".$_SERVER['SCRIPT_FILENAME'];

echo "<br>server name: ".$_SERVER['SERVER_NAME'];

echo "<br>request method: ".$_SERVER['REQUEST_METHOD'];

echo "<br>Query string: ".$_SERVER['QUERY_STRING'];

echo "<br>php self: ".$_SERVER['PHP_SELF'];

echo "<br>Request URI: ".$_SERVER['REQUEST_URI'];

echo "<br>server port: ".$_SERVER['SERVER_PORT'];

?>

 

_____________________________________________________________________________

Инструкция INCLUDE

Подключает другой файл к текущему, включая переменные и значения.

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

_____________________________________________________________________________

 

 

Поделиться:





Воспользуйтесь поиском по сайту:



©2015 - 2024 megalektsii.ru Все авторские права принадлежат авторам лекционных материалов. Обратная связь с нами...