Showing posts with label Exercise 06. Show all posts
Showing posts with label Exercise 06. Show all posts

Friday, May 29, 2009

Exercise 6: Answer

1 and 2 combined An image of the webpage output and the code that produced it:

Wednesday, May 27, 2009

Exercise 6: First attempt

Well found it: " ?> It definitely helps when you get the syntax correct. The answer to my question was sourced from http://au2.php.net/manual/en/reserved.variables.server.php In my mission to find out how to use php, I created the hello_world application. It didnt provide any surprises at all. And no problems either.

Exercise 6: First attempt

Well just going from the notes I thought I would just create a html file and open it in a browser. (did I tell you that what I know about php was what was written in the exercise?) So I dutifully copied the exercise code into notepad, saved it as exercise6.html, and opened it in IE8. I am sure that you will all be as surprised as I was to see that the screen was blank. Well so much for the short cut. Ok off to the web site http://php.net. I have now downloaded and installed WampServer 2.0h available from http://www.wampserver.com/en/download.php This has loaded Apache 2.2.11,PHP 5.2.9, SQLitemanager,MySQL 5.1.33 Phpmyadmin As to what I do with any of this. I am sitting here scratching my head with not the first clue as to what needs to happen now. I have WAMP started and online. Well finally I have gotten the page to display. It doesnt work but thats another issue. I am surprised that I have any hair left. None of that was obvious. (Although in hindsite it should have been). My MySQL issues are continuing however. I get the following message Access denied for user 'root'@'localhost' (using password:NO) trying to find the connection string settings in the php.ini file is like looking for a needle in a haystack. I think i would rather find the needle. When trying to display the file for exercise 6 I was getting the Undefined variable REMOTE_ADDR which makes sense as Ken said in the notes that this is the UNIX environment variable. So I should be able to change it with the php equivalent of _SERVER["REMOTE_ADDR"] WRONG! Maybe it is a good time to ask for help. What is wrong with this code ?????: "; ?> What should this look like?

Sunday, May 17, 2009

Exercise 6: Some server practice with PHP

  1. In this exercise with can call up and examine some environment variables on the server. The code below has the UNIX environment variable for storing your remote Internet address. UNIX environment variable are recognised by the use of upper case letters. Try the same code by replacing with $REMOTE_ADDR $SERVER_NAME, or $PHP_SELF
    <HTML>
    <HEAD>
    </HEAD>
    <BODY>
    <?php
    echo "You are connected from: ",$REMOTE_ADDR;
    echo "<BR>";
    ?>
    </BODY>
    </HTML>
  2. Create a web application called "hello_world.php" which contains in the body:
    <?php
    $myvar = "Hello World!";
    echo $myvar;
    ?>