[ Prev ]
2020-10-05

-- Practice Midterm Solutions
Question 9: Model: components that only be responsible for loading data and storing data into permanent storage. View: be responsible for drawing panel and little logic component like api call. controller: contain the most of the logic component. No storing procedure involved.
 
<?php
Controller();
function model(){ $file = 'str'.$_GET["storeStr"].'.txt'; $f = fopen($file, "w"); fwrite($f,$_GET["storeStr"]); }
function View(){ ?> <!DOCTYPE html> <html> <head>
    <title>Landing Page</title>
</head> <body>
    <h1>This is a landing page</h1>
    <form action="index.php" method="get">
        <input type="text" name="storeStr" placeholder="Type a string here">
        <input type="submit" name="action" value="Save" class="btn">
        <a href="index.php" class="btn">Return</a>
    </form>
</body> </html>
<?php }
function Controller(){
    switch($_GET["action"]){
        case "Save":
            model();
            view();
        break;
        default:
            view();
    }
} Zihao Lin, Colin Chow
(Edited: 2020-10-05)
Question 9: Model: components that only be responsible for loading data and storing data into permanent storage. View: be responsible for drawing panel and little logic component like api call. controller: contain the most of the logic component. No storing procedure involved. <?php Controller(); function model(){ $file = 'str'.$_GET["storeStr"].'.txt'; $f = fopen($file, "w"); fwrite($f,$_GET["storeStr"]); } function View(){ ?> <!DOCTYPE html> <html> <head> <title>Landing Page</title> </head> <body> <h1>This is a landing page</h1> <form action="index.php" method="get"> <input type="text" name="storeStr" placeholder="Type a string here"> <input type="submit" name="action" value="Save" class="btn"> <a href="index.php" class="btn">Return</a> </form> </body> </html> <?php } function Controller(){ switch($_GET["action"]){ case "Save": model(); view(); break; default: view(); } } Zihao Lin, Colin Chow

-- Practice Midterm Solutions
Problem #6 Alexis Huerta Janice Lu
Note: for people looking to check for WAI accessibility, you can install a web browser addon to check for you: [wave webaim website()] Draw Cubes Table
n n3
(Edited: 2020-10-05)
Problem #6 Alexis Huerta Janice Lu Note: for people looking to check for WAI accessibility, you can install a web browser addon to check for you: [wave webaim website[https://wave.webaim.org/extension/]] <nowiki> <?php $num = $_REQUEST['rows']; if(is_numeric($num)) { drawCubesTable($num); } function drawCubesTable($num) { ?> <html lang="en" dir="ltr"> <head> <meta charset="utf-8"> <title>Draw Cubes Table</title> </head> <body> <div> <table style="border: 1px solid black"> <tr style="border: 1px solid black"> <th style="border: 1px solid black"> n </th> <th style="border: 1px solid black"> n<sup>3</sup> </th> </tr> <?php for ($x = 1; $x < $num+1; $x++) { echo "<tr><td style=\"border: 1px solid black\">". $x ."</td><td style=\"border: 1px solid black\">". pow($x, 3). "</td></tr>"; } ?> </table> </div> </body> </html> <?php } </nowiki>

-- Practice Midterm Solutions
Group: #1 Question: #1
GET /index.html HTTP/1.1 User-Agent: Mozilla/4.0 (compatible; MSIE5.01; Windows NT) Host: www.saneel.com Accept-Language: en-us Accept-Encoding: gzip, deflate Connection: Keep-Alive
Group: #1 Question: #1 GET /index.html HTTP/1.1 User-Agent: Mozilla/4.0 (compatible; MSIE5.01; Windows NT) Host: www.saneel.com Accept-Language: en-us Accept-Encoding: gzip, deflate Connection: Keep-Alive

-- Practice Midterm Solutions
Group: #1 Question: #1 Domain name server (DNS) A fully qualified domain name is the computer address that have meaningful in this question is ( /index.html) IP address is the 32 bits number which is usually written as four number between 0-255 separate by periods. User search the fully qualified domain -> Internet service provider -> DNS ( /index.html) DNS will provide the IP back The request GET /index.html HTTP/1.1 Host: Saneedlda.com Accept: text/* Accept: image.gif
group: saneelda, Trevor, Luksawee
Group: #1 Question: #1 Domain name server (DNS) A fully qualified domain name is the computer address that have meaningful in this question is ( /index.html) IP address is the 32 bits number which is usually written as four number between 0-255 separate by periods. User search the fully qualified domain -> Internet service provider -> DNS ( /index.html) DNS will provide the IP back The request GET /index.html HTTP/1.1 Host: Saneedlda.com Accept: text/* Accept: image.gif group: saneelda, Trevor, Luksawee
X