logo  
 
 
 
 
 
 
 
     
   

Handout #1 - CSCI 2442

01 - Plug in your USB drive at home and note which drive letter is used. Run the setup_xampp.bat script mentioned in the in-class handout if the drive letters are different, then start PortableApps and click the xampp_start icon. Open the PortableApps version of Firefox and enter the loopback address (127.0.0.1) in the URL field. You should see the xampp welcome screen if everything is configured correctly. Click the Status link on the left side and printout this page. Next, select View -> Page Source and printout the source code view of this webpage. Circle or highlight the three php files used in the three frame tags found in this page.

02 - Next, click the phoinfo() link on the left side of the page. Find the variable called DOCUMENT_ROOT on this page and note the value to which the variable is set. Write this value neatly on the Status printout from Step 01.

03 - Navigate to the DOCUMENT_ROOT directory and rename both index.html and index.php to oldindex.html and oldindex.php respectively. Create a new index.php file in this directory using the following code:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Website for Darren Pearson - CSCI 2442</title>
</head>
<body style="background-color: blue; color: yellow">
<center>
    <?php
        // Assignment #1 - CSCI 2442
        // by Darren Pearson
        $firstname = "Darren";
        $lastname = "Pearson";
        echo "<h1>Welcome to the homepage of $firstname $lastname </h1>";
    ?>
<p style="text-align: center"><img src="photo1.jpg" alt="Darren Pearson" /></p>
<p style="text-align: center"><a href="xampp/index.php">XAMPP Documentation</a></p>
</center>
</body>
</html>

Replace every occurance of "Darren Pearson" with your name. Feel free to change the color scheme as desired. Also, find a photo of yourself, place it in the same directory as this file and rename the file photo1.jpg. Save the file as index.php. Make sure file extensions are turned on and you do NOT save the file with either a txt or htm extension. Start Firefox and set the URL to the loopback address and printout the browser view. Next, select View -> Page Source. Print out the source code results and write "Server Source Code View for YOUR NAME" on the top of this printout. Note the differences between the source code printout and the php code you typed in.

04 - Click the xampp_stop icon inside the PortableApps menu, then try viewing the localhost address in Firefox. You should receive an "Unable to Connect to Server" message. Navigate to the DOCUMENT_ROOT directory, then right click on the index.php and choose the Open With -> Firefox option. Printout the browser view, then select View -> Page Source. Print out the source code results and write "Local Source Code View for YOUR NAME" on the top of this printout.

A working example of this code can be found HERE

BACK