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 PHP program that checks the elements of a string array named $Passwords. Use regular...
Write a PHP program that checks the elements of a string array named $Passwords. Use regular expressions to test whether each element is a strong password. For this exercise, a strong password must have at least one number, one lowercase letter, one uppercase letter, no spaces, and at least one character that is not a letter or number. (Hint: Use the [^0-9A-Za-z] character class.) The string should also be between 8 and 16 characters long. The $Passwords array should contain...
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.
Write a PHP program using HTML form. It will take Length, Width and Height of a...
Write a PHP program using HTML form. It will take Length, Width and Height of a box as input. When a button is pressed, it will calculate the Volume. If Volume is less than 25 then display the message “Small box”. If Volume is from 25 to 50, it will display the message “Medium box”. When the Volume is greater than 50, then display the message “Large box”.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT