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 script to display in frequency all the words in the submitted paragraph. Convert...
Write a PHP script to display in frequency all the words in the submitted paragraph. Convert the string to an array of words. Count the number of times the words are used. Hint: array_count_values($arrayname) Sort the array in frequency order. Print the array to the screen. Hint: print_r($arrayname)
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,...
write java program that prompt the user to enter two numbers .the program display all numbers...
write java program that prompt the user to enter two numbers .the program display all numbers between that are divisible by 7 and 8 ( the program should swap the numbers in case the secone number id lower than first one please enter two integer number : 900 199 Swapping the numbers 224 280 336 392 448 504 560 616 672 728 784 840 896 i need it eclipse
write java program that prompt the user to enter two numbers .the program display all numbers...
write java program that prompt the user to enter two numbers .the program display all numbers between that are divisible by 7 and 8 ( the program should swap the numbers in case the secone number id lower than first one please enter two integer number : 900 199   Swapping the numbers 224 280 336 392 448 504 560 616 672 728 784 840 896 i need it eclipse
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 program in Java Swing that can Display all the name list then will generate...
Write a program in Java Swing that can Display all the name list then will generate and display the longest name out of a list of names. Thank you...
Write a MIPS assembly program that calculates the sum of all the elements in the following...
Write a MIPS assembly program that calculates the sum of all the elements in the following array: int array[10]={12,21,3,40,15,6,17,8,29,10}
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT