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 : C:/nginx/html/JimMartinson/_Archive/MMDT1146/Labs/Lab03/ |
Upload File : |
<? // JimMartinson/MMDT1146/Labs/Lab03.phpinc include('Course/courseInfo.phpinc'); include('../../classInfo.phpinc'); $evaluationNumber = 3; $evaluationType = "Lab"; $evaluationTitle = "A Simple Form"; if ( !isset($assignmentSuffix) ) $assignmentSuffix = ''; $evaluationName = $evaluationType.twoDigit($evaluationNumber).$assignmentSuffix; $f_uId = formValue('uId'); if ( $f_uId ) $userId = $f_uId; if ( !isset($userId) ) $userId = $_SESSION['userId']; $title = $evaluationName.": ".$evaluationTitle; $headTitle = '_CST_ - '.$courseNumber.' '.$courseTitle.' - '.$title; $pageTitle = $courseNumber.' '.$courseTitle.'<br>'.$title; $pageMenu = 'Course/courseMenu.phpinc'; $smallTitle = true; $js='openCenteredWindow'; $smallTitle = true; include('common/pageHeader.phpinc'); $sectionTitle = $title; include('common/sectionHeader.phpinc'); include('Gradebook/EvaluationSubmission_BEGIN.phpinc'); $uploadFilename = $evaluationName.'.zip'; ?> <?=$f_message?> <a name="Lab"></a> <fieldset><legend>Description</legend> Demonstrate the use of a form and form processing with PHP.<br> <?=$gradeNote?> </fieldset> <? $ShowSpanCountBefore = false; #$ShowSpanCountBefore = true; ?> <style type="text/css"> b { white-space:nowrap; } <? if ( !$ShowSpanCountBefore ) { ?>//<? } ?> span.count:before { content:counters(item, "-"); color:#FF0000; } entry, kbd, tt, samp, var { padding:0; white-space:nowrap; } comment { color:#0c0; background-color:#ffc; } /* comment */ samp { color:#c00; } /* attibute */ kbd { background-color:#ffc; color:#609; } /* attibute value */ tt { color:#00c; } /* tag */ var { color:#00f; font-style:normal; } /* variable */ entry { background-color:#ffc; color:#f00; } /* PHP start stop */ </style> <? /** / tt = tag samp = attribute kbd = attribute value /**/ ?> <fieldset><legend><?=$evaluationType?> <?=$evaluationNumber?> assignment</legend> <ol id="main" class="count"> <li>Create a <b><?=$evaluationName?></b> directory in the <b>Data_WWW/MMDT1146</b> directory and place all work for this lab in that folder.</li> <li>Create a PHP page named <b><?=$evaluationName?>.php</b> containing the following: <ol> <li>A <tt>title</tt> of <kbd><?=$evaluationType?> <?=$evaluationNumber?> - <?=$userFullName?></kbd>.</li> <li>An <tt>h1</tt> tag containing the title above.</li> <li>A form containing the following: <br>Note: All form elements should have text to identify what they are for. <ol> <li>Form attributes of: <ol> <li><samp>action="<kbd><entry><?=</entry>$_SERVER['PHP_SELF']<entry>?></entry></kbd>"</samp>.</li> <li><samp>name="<kbd>simple_form_<?=$userFileName?></kbd>"</samp>.</li> <li><samp>method="<kbd>post</kbd>"</samp>.</li> </ol> </li> <li>Three <tt>input</tt> elements of <samp>type="<kbd>hidden</kbd>"</samp>: <ol> <li><samp>name="<kbd>form</kbd>"</samp> and <samp>value="<kbd>simple_form_<?=$userFileName?></kbd>"</samp>.</li> <li><samp>name="<kbd>uuid</kbd>"</samp> and <samp>value="<kbd><entry><?=</entry>uuid()<entry>?></entry></kbd>"</samp>.</li> <li><samp>name="<kbd>submitted</kbd>"</samp> and <samp>value="<kbd><entry><?=</entry>$submit<entry>?></entry></kbd>"</samp>.</li> </ol> </li> <li>Standard <tt>input</tt> elements of: <ol> <li><samp>type="<kbd>text</kbd>"</samp>, <samp>name="<kbd>name</kbd>"</samp>, and <samp>value="<kbd><entry><?=</entry>$name<entry>?></entry></kbd>"</samp>.</li> <li><samp>type="<kbd>password</kbd>"</samp>, <samp>name="<kbd>password</kbd>"</samp>, and <samp>value="<kbd><entry><?=</entry>$password<entry>?></entry></kbd>"</samp>.</li> <li><samp>type="<kbd>text</kbd>"</samp>, <samp>name="<kbd>emailAddress</kbd>"</samp>, and <samp>value="<kbd><entry><?=</entry>$emailAddress<entry>?></entry></kbd>"</samp>.</li> <li>Three <samp>type="<kbd>radio</kbd>"</samp>, <samp>name="<kbd>age</kbd>"</samp> with values of: <ol> <li><kbd>0-17</kbd>.</li> <li><kbd>18-64</kbd>.</li> <li><kbd>65+</kbd>.</li> </ol> Each radio button should have text following that is the same as the value so people know what choice they are making. <br> Each radio button should remain checked after the form is submitted if it was checked. </li> <li>Four <samp>type="<kbd>checkbox</kbd>"</samp>, <samp>name="<kbd>like[]</kbd>"</samp> with values of: <ol> <li><kbd>html</kbd>.</li> <li><kbd>jim</kbd>.</li> <li><kbd>school</kbd>.</li> <li><kbd>sports</kbd>.</li> </ol> The checkboxes should be preceded by the text <code>I like:</code> and text following so people know what choices they are making. <br> Each checkbox should remain checked after the form is submitted if it was checked. </li> </ol> </li> <li>A <tt>textarea</tt> with <samp>name="<kbd>comments</kbd>"</samp> and content of <entry><?=</entry>$comments<entry>?></entry>.</li> <li>A <samp>submit</samp> button with <samp>value="<kbd>Submit</kbd>"</samp>. <br>Note that although I call this a button I do not mean <samp>type="<kbd>button</kbd>"</samp>. <br><tt>input</tt> elements of <samp>type="<kbd>button</kbd>"</samp> do not submit a form unless javascript is used. </li> </ol> </li> <li>Include this PHP function after the form: <pre class="code"> function uuid() { $uuid = md5(getmypid().uniqid(rand()).$_SERVER['SERVER_NAME']); return $uuid; }</pre> This is needed so the <samp>hidden</samp> element <samp>uuid</samp> gets its <samp>value</samp>. <br>Note: we are not using this yet but will when we understand how to use <code>sessions</code> and the <var>$_SESSION</var> array variable. </li> </ol> </li> <li>Create a page named <b><?=$evaluationName?>_Begin.php</b>. <ol> <li>Write code so that all form values that use PHP variables for their value are pre-loaded with an empty string or zero value so there are no form errors.</li> <li>Note: <var>$submit</var> should be set to <kbd>false</kbd> if the page was entered without a form submit.</li> <li>Use an <code>require</code> statement in the <b><?=$evaluationName?>.php</b> page to include the <b><?=$evaluationName?>_Begin.php</b> page.</li> <li>This page can be included if the page was called with or without a form submission.</li> </ol> </li> <li>Create a page named <b><?=$evaluationName?>_Verify.php</b>. <ol> <li>Write code so that all form values when submitted are validated and if not valid an error is displayed. <br>Valid values for each element are: <table> <tr><th>Variable name</th><th>Valid values</th></tr> <tr><td><var>$name</var></td><td>Contains more than zero characters and up to 30 characters</td></tr> <tr><td><var>$password</var></td><td>Contains at least one lower case letter, one upper case letter, one number, and is 8-16 characters in length.</td></tr> <tr><td><var>$emailAddress</var></td><td>Contains text that follows the rules of a valid email address.</td></tr> <tr><td><var>$age</var></td><td>Only '0-17', '18-64', or '65+'.</td></tr> <tr><td><var>$like</var></td><td>Only 'html', 'jim', 'school', and/or 'sports'. Note that this will be an array of 0-4 elements.</td></tr> <tr><td><var>$comments</var></td><td>Containing text of 0-255 characters in length.</td></tr> </table> </li> <li>Note: <var>$submit</var> should be set to <kbd>true</kbd> if the page was entered by a form submit.</li> <li>Use an <code>require</code> statement in the <b><?=$evaluationName?>.php</b> page to include the <b><?=$evaluationName?>_Verify.php</b> page.</li> <li>This page should only be included if the page was called by a form submission.</li> </ol> <div id="show_page" class="inline"><a href="#" onClick="divHide('show_page'); divShow('hide_page'); return false;">See an example of what my page looked like before the <b><?=$evaluationName?>_Begin.php</b> was written:</a></div> <div id="hide_page" class="hidden"><a href="#" onClick="divHide('hide_page'); divShowInline('show_page'); return false;">Hide the example.</a> <? include('common/Browser/Browser.phpinc'); BrowserBegin('Lab 3 - Jim Martinson','http://mmdt1146.loc/Lab03/Lab03.php',414); ?> <img src="Lab03_sample.jpg" width="393" height="442" alt="Lab 3 example"> <? BrowserEnd(); ?> </div> </li> <li>Do extensive testing to ensure your pages perform as directed.</li> <li>Turn in your assignment: <ol type="a"> <li>Zip up your <b><?=$evaluationName?></b> folder into a file named <b><?=$uploadFilename?></b>.</li> <li>Browse and select your <b><?=$uploadFilename?></b> file: <input type="file" name="fileUpload"></li> <li>Then <input type="submit" name="f_subtask" value="Submit"> for grading.</li> </ol> </li> </ol> <?=$gradeNote?> </fieldset> <? /** / ?> <br><code>code</code> <codechange>codechange</codechange> <codeold>codeold</codeold> <comment>comment</comment> <entry>entry</entry> <kbd>kbd</kbd> <samp>samp</samp> <tt>tt</tt> <ttchange>ttchange</ttchange> <var>var</var> <? /**/ include('Gradebook/EvaluationSubmission_END.phpinc'); $deductionPoints = $evaluationInfo['evaluationPoints'] / 10; if ( $deductionPoints == 1 ) { $deductionPoints = '1 point'; } else { $deductionPoints = $deductionPoints.' points'; } ?> <fieldset><legend>Grading Criteria</legend> Demonstrated assignment effectively: <b><?=$evaluationInfo['evaluationPoints']?></b> points. <br> There are some things I expect. If they are incorrect you will lose the following: <br> Work submitted incorrectly: -<?=$deductionPoints?>. <br> Work submitted late: -<?=$deductionPoints?> per week. <br> Re-submission of work for grading: -<?=$deductionPoints?> per submission. <br> I reserve the right <b>not</b> to apply the deduction points at my absolute discretion. </fieldset> <fieldset><legend>NOTES:</legend> <b>We will be using the following in every html page throughout this class:</b> <ul> <li>The HTML 5 DOCTYPE: <tt><!DOCTYPE html></tt>.</li> <li>An html tag with <samp>lang</samp> attribute: <tt><html <samp>lang="<kbd>en</kbd>"</samp>></tt>.</li> <li>A <tt>title</tt> tag.</li> <li>The meta character set tag <tt><meta <samp>charset="<kbd>utf-8</kbd>"</samp>></tt>.</li> <li>An <tt>h1</tt> heading tag with the same content as in the <tt>title</tt> tag.</li> </ul> </fieldset> <? include('../../ReferencesResources.phpinc'); include('common/sectionFooter.phpinc'); ?>