Question

In: Computer Science

Write a PHP Program to display all the $_SERVER elements

Write a PHP Program to display all the $_SERVER elements

Solutions

Expert Solution

CODE

<?php

$indicesServer = array('PHP_SELF',

'argv',

'argc',

'GATEWAY_INTERFACE',

'SERVER_ADDR',

'SERVER_NAME',

'SERVER_SOFTWARE',

'SERVER_PROTOCOL',

'REQUEST_METHOD',

'REQUEST_TIME',

'REQUEST_TIME_FLOAT',

'QUERY_STRING',

'DOCUMENT_ROOT',

'HTTP_ACCEPT',

'HTTP_ACCEPT_CHARSET',

'HTTP_ACCEPT_ENCODING',

'HTTP_ACCEPT_LANGUAGE',

'HTTP_CONNECTION',

'HTTP_HOST',

'HTTP_REFERER',

'HTTP_USER_AGENT',

'HTTPS',

'REMOTE_ADDR',

'REMOTE_HOST',

'REMOTE_PORT',

'REMOTE_USER',

'REDIRECT_REMOTE_USER',

'SCRIPT_FILENAME',

'SERVER_ADMIN',

'SERVER_PORT',

'SERVER_SIGNATURE',

'PATH_TRANSLATED',

'SCRIPT_NAME',

'REQUEST_URI',

'PHP_AUTH_DIGEST',

'PHP_AUTH_USER',

'PHP_AUTH_PW',

'AUTH_TYPE',

'PATH_INFO',

'ORIG_PATH_INFO') ;

echo '<table cellpadding="10">' ;

foreach ($indicesServer as $arg) {

if (isset($_SERVER[$arg])) {

echo '<tr><td>'.$arg.'</td><td>' . $_SERVER[$arg] . '</td></tr>' ;

}

else {

echo '<tr><td>'.$arg.'</td><td>-</td></tr>' ;

}

}

echo '</table>' ;


Related Solutions

Write a program that will read a line of text. Display all the letters that occure...
Write a program that will read a line of text. Display all the letters that occure in the text, one per line and in alphabetical order, along with the number of times each letter occurs in the text. Use an array of base type int of length 26, so that the element at index 0 contains the number of a’s, the element at index 1 contains the number of b’s, and so forth, Alloow both upperCase and lower Case. Define...
PHP Question: Write the PHP code to list out all of the dates of the current...
PHP Question: Write the PHP code to list out all of the dates of the current month and assign them to their given days. As an example, for the month of October 2020, the output should look something like this: October 2020       Monday: 5, 12, 19, 26 Tuesday: 6, 13, 20, 27 Wednesday: 7, 14, 21, 28 Thursday: 1, 8, 15, 22, 29 Friday: 2, 9, 16, 23, 30 Saturday: 3, 10, 17, 24, 31 Sunday: 4, 11, 18,...
Using python Write a program that displays all of states in the U.S. and display each...
Using python Write a program that displays all of states in the U.S. and display each state that begins with the letter A.
Specifications: Write a Java program called LifeRaft.java that will do all of the following: Display a...
Specifications: Write a Java program called LifeRaft.java that will do all of the following: Display a title Ask the user to enter the following values: The type of plane(Boeing 747 or Airbus A300) The number of passengers on board the Plane The number of crew aboard the plane The maximum number of people that can be carried by one liferaft assuming all the liferafts on the plane are the same size The actual number of liferafts that are available on...
Write a C++ program to display toy name
Write a C++ program to display toy name
ONLY IN C LANGUAGE Write a C program to print all the unique elements of an...
ONLY IN C LANGUAGE Write a C program to print all the unique elements of an array. Print all unique elements of an array Enter the number of elements to be stored in the array: 4 Input 4 elements in the arrangement: element [0]: 3 element [1]: 2 element [2]: 2 element [3]: 5 Expected output: The only items found in the array are: 3 5
I need a MIPS Assembly program that "Display the elements of the linked list in reverse...
I need a MIPS Assembly program that "Display the elements of the linked list in reverse order." It needs subprogram and those subprogram does not have t registers.
Write a php program that writes numbers to a file. The file type should be .txt...
Write a php program that writes numbers to a file. The file type should be .txt and the file name should be numbers.tx. The numbers.txt should contain 10 random integers between 1 to 100 after the file is written.
Java Program Use for loop 1.) Write a program to display the multiplication table of a...
Java Program Use for loop 1.) Write a program to display the multiplication table of a given integer. Multiplier and number of terms (multiplicand) must be user's input. Sample output: Enter the Multiplier: 5 Enter the number of terms: 3 5x0=0 5x1=5 5x2=10 5x3=15 2 Create a program that will allow the user to input an integer and display the sum of squares from 1 to n. Example, the sum of squares for 10 is as follows: (do not use...
Program in C: Write a program in C that reorders the elements in an array in...
Program in C: Write a program in C that reorders the elements in an array in ascending order from least to greatest. The array is {1,4,3,2,6,5,9,8,7,10}. You must use a swap function and a main function in the code. (Hint: Use void swap and swap)
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT