跳至主要內容

Assignment 07 Server-side Quizzing System

AI悦创原创2023年4月3日1v1java 1v1纽约大学一对一NYU 1v1web 一对一数据结构一对一留学生辅导留学生作业辅导1v1java 1v1纽约大学一对一NYU 1v1web 一对一留学生辅导留学生作业辅导大约 15 分钟...约 4517 字

"quiz.php"

"save.php"

"results.php"

Note: The majority of this assignment uses only HTML, CSS and PHP - very little (if any) JavaScript is necessary to solve this problem. I've outlined the technologies needed for each feature below.

注意:本任务主要使用 HTML、CSS 和 PHP,解决此问题几乎不需要(或完全不需要)JavaScript。我已经在下面列出了实现每个功能所需的技术。

For this assignment you will be creating a simple 'quizzing system' similar to the quizzes you can participate in on social media sites. The program starts off by allowing the user to answer a series of at least 4 questions. When the user clicks a button to submit their answers their answers are sent to a PHP program to be tabulated and saved to the server. The PHP page will then display the results of the quiz in a visually appealing way.

对于这个任务,您将创建一个类似于社交媒体网站上的问答系统的简单"答题系统"。程序首先让用户回答至少 4 个问题。当用户点击一个按钮提交答案时,答案将被发送到一个 PHP 程序进行整理并保存到服务器上。然后,PHP页面将以视觉上吸引人的方式显示测验结果。

At any time the user can click on a hyperlink to view aggregate results for the quiz. If they click on this link a new PHP page will be loaded which will display a bar chart summary of all results that have been gathered so far.

用户可以随时点击一个超链接查看测验的汇总结果。如果他们点击这个链接,将加载一个新的PHP页面,该页面将显示到目前为止收集到的所有结果的条形图汇总。

In addition, every time a client takes the quiz their result should be saved as a cookie on the client's computer - if they choose to come back to the page they will see their previous result. They can elect to take the quiz again which start the process over again.

此外,每当一个客户参加测验时,他们的结果应该作为一个cookie保存在客户端计算机上 - 如果他们选择返回页面,他们将看到他们之前的结果。他们可以选择再次参加测验,从而重新开始整个过程。

Here's a quick video that shows the basic features of the system:

这是一个简短的视频,展示了系统的基本功能:

网页结构如下从上到下:

The web page structure is as follows:

<h1>Which Simpson Character Am I?</h1>

<h2>What's your ideal job?</h2>

选择框内容:

默认显示:Select a job

Working at a bakery

French tutor

Prank phone call specialist

Collage professor

<h2>What is your favorite food?</h2>

默认显示:Select a food

Donuts

Apple ple

Krusty Flakes

Anything organic and locally sourced

<h2>What is your favorite hobby?</h2>

默认显示:Select a hobby

Watching TV

Kniting

Skateboarding

Reading

<h2>What is your biggest fear?</h2>

默认显示:Select a fear

Sock puppets

Flying

I'm fearless, man

Getting anything below an A in school

按钮 What Simpsons Character am I?

点击 What Simpsons Character am I? 显示对应的图片:

Bart.png
Homer.png
Lisa.png
Marge.png

图片下面显示 Try again 回到页面点击。

Part A

For convenience I am breaking up this assignment into two parts. Part A should be attempted before Part B as it contains only the basic functionality necessary to create a server-side application. Part B should be attempted after our second server-side programming class.

为了方便起见,我将这个任务分为两部分。A部分应在B部分之前尝试,因为它只包含创建服务器端应用所需的基本功能。在我们的第二堂服务器端编程课之后,应尝试B部分。

In Part A you will be setting up a form that will prompt the user to answer a series of questions. After this the user's data will be submitted to a PHP program which will tabulate the results and display them to the user. All of the programmatic work for this part of the assignment will be done on the server using PHP. Do not use any JavaScript for this part of the assignment!.

在A部分,您将设置一个表单,提示用户回答一系列问题。之后,用户的数据将提交给一个PHP程序,该程序将整理结果并显示给用户。这部分任务的所有编程工作将在服务器上使用PHP完成。在这个任务部分不要使用任何JavaScript!

You can download all of the artwork used in the sample project here (but you are welcome to use your own graphics / content items)

您可以在这里下载示例项目中使用的所有艺术作品(但您也可以使用自己的图形/内容项目)。assignment07_images.zip

Here's what you should work on for Part A:

这是您应该在A部分完成的任务:

Part B

相关信息

This part should only be attempted after our second week of server-side programming! Many of the features written here have already been built for Part A. At the end of the program you only need to turn in Part B, which will include all of the features of Part A.

这部分仅在我们进行第二周的服务器端编程后才尝试!许多这里编写的功能已经在Part A中构建。在程序结束时,您只需要提交Part B,其中将包括Part A的所有功能。

For full credit your program should do the following:

要获得满分,您的程序应执行以下操作:

Thoroughly test your work and make sure that it meets the requirements set forth above. When you are finished, post your project to the i6 server and link it from your main menu page. We should be able to visit your 'webdev' folder and click on the link associated with this macro assignment to visit your project. Also create a ZIP archive of your work and submit it to Brightspace under the 'Assignment 07' category.「彻底测试您的工作,并确保它符合上述要求。完成后,请将您的项目发布到i6服务器,并从主菜单页面链接到它。我们应该能够访问您的“webdev”文件夹并单击与此宏任务相关联的链接以访问您的项目。还要创建您的工作的ZIP归档,并将其提交到Brightspace“作业07”类别下。」

Grading Rubric (20 points)

相关信息

Important: Ensure that you have set up the permissions on your data folder on the i6 server so that we can run your program! If your program works fine locally when we download it but it fails on the server it most likely has to do with a permissions issue. You will lose points if your program does not work on the server, and you cannot earn those points back after your program has been scored, so please test your program thoroughly before submitting it to be graded.

重要提示:确保您已在i6服务器上设置了数据文件夹的权限,以便我们可以运行您的程序!如果您的程序在我们下载它时在本地运行良好,但在服务器上运行失败,那么它很可能与权限问题有关。如果您的程序在服务器上无法正常工作,则会失去一定的分数,评分后无法恢复这些分数,因此请在提交评分前彻底测试您的程序。

CriteriaPoints
Layout (index.php): * Some kind of header element * A form with at least 3 questions. * A button to submit the form * A visually appealing look / feel to the page (i.e. don't use an unstyled page - change the font family, colors, etc) * A link to 'results.php' at the bottom of the page2
Layout (results.php) * Some kind of header element * At least four bars corresponding to the four possible outcomes of your quiz. * Each bar should be colored differently and contain the name of the outcome inside of the bar. Default all bars to 100% of the width of the page. * A visually appealing look / feel to the page (i.e. don't use an unstyled page - change the font family, colors, etc)1.5
* Each quiz question should default to a neutral value (i.e. 'select an answer') * The user should be able to adjust their answers to the quiz using standard HTML form UI elements. * Clicking on the 'submit' button should send the data to another file for processing.1.5
During the processing phase, the value of each quiz question should be analyzed. If the user misses a question the quiz should not be scored and some kind of error message should appear to the user.1
If each question has been successfully answered the result of the quiz can be calculated. This can be as easy as assigning a point for each answer. Whichever result gets the highest number is the winner. If there is a tie just pick one of the winners (it doesn't need to be random or anything fancy - just pick one)2
Save the answer to a text file on the server using file_put_contents3
Upon a successful submission a visually appealing representation of the user's result should appear1
Upon successfully filling out the quiz the form should no longer display - only the results should show up (due to the presence of the cookie). If the user goes away from the page and visits again the cookie should "remind" the PHP file of its previous value and you should display the user's previous result.3
The user should be able to click a "Take Again?" button - if they do this the program should show the quiz and let the user start over.1
Result Logic: * When this page loads it should open up the result file that was created by 'index.php' using file_get_contents * The page should contain a series of 'div' elements to represent each item the user could vote for in the quiz * The width of each 'div' element should correspond to the percentage of votes that item received (i.e. in my example pikachu might have gotten 10%, squirtle 20%, charmander 30% and bulbasaur 40%) * There should be a link back to the 'index.php' page to allow the user to re-vote, if desired.4

欢迎关注我公众号:AI悦创,有更多更好玩的等你发现!

公众号:AI悦创【二维码】

AI悦创·编程一对一

AI悦创·推出辅导班啦,包括「Python 语言辅导班、C++ 辅导班、java 辅导班、算法/数据结构辅导班、少儿编程、pygame 游戏开发」,全部都是一对一教学:一对一辅导 + 一对一答疑 + 布置作业 + 项目实践等。当然,还有线下线上摄影课程、Photoshop、Premiere 一对一教学、QQ、微信在线,随时响应!微信:Jiabcdefh

C++ 信息奥赛题解,长期更新!长期招收一对一中小学信息奥赛集训,莆田、厦门地区有机会线下上门,其他地区线上。微信:Jiabcdefh

方法一:QQ

方法二:微信:Jiabcdefh

你认为这篇文章怎么样?
  • 0
  • 0
  • 0
  • 0
  • 0
  • 0
评论
  • 按正序
  • 按倒序
  • 按热度
通知
关于编程私教&加密文章