Solution 1

Main | Static vs. Dynamic Websites | Using PHP | A Simple PHP Program | Variables and Operators | Practice 1 | Solution 1 | Loops | Practice 2 | Solution 2 | Functions | Practice 3 | Solution 3 | Conditionals | Practice 4 | Solution 4

The solution to practice 1 is:

<html>
<p>You are using
<? echo "$HTTP_USER_AGENT"; ?><br>
and coming from
<? echo "$REMOTE_ADDR"; ?><br>
</html> 


Note: In the above example (and when working with varialbes in general) it is not necessary for you to put your variables in quotes ("). You could have written:

<? echo $HTTP_USER_AGENT; ?><br>

PHP has other web-related variables which you can echo back to your users. To see what variables are available to you on blender click here.

Then scroll to the table titled "Apache Environment". The file info.php runs a built-in PHP function (there will be more information on functions later) called phpinfo() which displays information particular to the webserver that is running PHP scripts.

The information you see pertains specifically to blender and is never out of date since it is updated everytime the page is loaded. Whenever you have to develop PHP on a new system it is a good idea to run this function (there will be more information on running functions later) to see what PHP resources are available to you.


jfulton [at] member.fsf.org
22 Aug 2013