`
guoyiqi
  • 浏览: 1001718 次
社区版块
存档分类
最新评论

C语言 cgi(3)

 
阅读更多

1
cs3157 – Advanced Programming
Summer 2014, Project 1, 150 points
June 17, 2014
Follow these step-by-step instructions. This homework must be submitted electronically by
Sunday night July 6th, 11pm. Please start early, so we can help if you get stuck.
In this project you will be making use of c’s pointers, arrays, dynamic memory allocation, i/o and your
perl knowledge etc.
Goal: the overall goal of your project is to develop a website which allows you to coordinate a shared
calendar between users. Any user can create a meeting (think of a class) which a specific schedule
(weekly, monthly, etc). A meeting has a title, subject, time, address, and description associated with it.
Creativity counts, so feel free to improvise as long as you cover the general gist of the assignment.
I am breaking down the assignment into section parts and then into steps to allow you to manage the
project more efficiently. In addition we will be doing some of the work in class.
Do not forget to comment, and create a makefile for the project. Please break the project into relevant .h
and .c files so that it is easier to maintain and debug. In you readme make sure to note what each file does,
and how each step is related to a specific file. You should submit final files which everything working (as
much as you can). In addition, if you will need to demonstrate a working website to the TA either via
showing it on your laptop or on a publicly available webspace. The front end cgi can be perl if you like,
but the underlying data should be in c/c++ as relevant. For all design decisions please document in the
README file.
Step 1 (15 points) Initial Login Page
Create a single cgi file which when loaded up for the first time presents the user with a login form (that is
there is no external html page only output from the cgi on empty input).
The form should contain a user field box and password field box. When typed, the password should show
stars and not text. You should name this file MainProject1.c and create a MainProject1.h. The form action
destination should point to the script itself.
The top of the page should contain the title. The bottom of the main page you should display some
information about yourself (and link to your homepage if you have one). Feel free to make it as fancy as
you like.
Step 2 (25 points) Create account
Add a link to the initial page saying “click here to create an account”. This should call a
CreateAccount.cgi program which will ask the user for their name, password, and email and add it to a
password file.
The password file is a simple text file with the following format:
USER=MD5PASSWORD=email
USER2=MD5PASSWORD2=email2
2
Each password is kept as an md5 of the password, and = can not be part of the user name.
Before adding a new user to the file you should check if it is in the file already. If its not you can append
it to the end.
Verify this works by creating 2 accounts, and then visually inspecting the password.txt file.
When this script is done, it should spit out the original login page. You can do this by calling the
appropriate function which renders the page from the other.c file (ask me if this isn’t clear). This is why
we split out the html page into a separate function in class.
You should use pointers, make sure you are freeing the memory. As discussed in class, use any md5
library you want.
Step 3 (30 points) Main page
If the original cgi is presented with a user name and password, you need to verify it in the password file.
If it is verified, you will now create a subdirectory in the system to store appointments for the user (only
done first time).
Now the user is presented with the following links:
1) add new meeting
this will allow the user to add a new meetings into the system with another form
2) view all meetings
this will show all current meetings added to the system by this user
3) system information
show some information such as how many meetings are in the system and how many users
for each of the above steps you should be calling the original script. Which means you need to embed
information in the link when you call yourself. For example you can create a link for a test.cgi and pass
information:
<a href=”test.cgi?todo=newmeet”>Click here for new appointment</a>
that will pass in a query string with todo set to “newmeet” so your script can check for that combination
and act appropriately.
Now add appropriate forms for a new meeting. Here you will collect the start date, start time, end date,
end time, subject, and text info about the meeting. You need to decide how to save the meeting
information as a file. For example you can choose each meeting as a separate file in a unique directory
(made up from the usersname) and name them with the “startdate-starttime.app.txt”.
For the view all meetings you can simply spit back a large html page with all the information….you
should look into html tables as a way of organizing the information nicer.
System information should run through all users directories and collect the correct stats info.
3
Step 4 (30 points) Navigation page
We want to add a browser-able calendar feature. The idea is that once a user logs in, they can browse
through an html calendar (basically a large html table with 7 columns (ie day of week) and be able to click
on a entry to add an event.
You will be creating a calendar class which will be able to take a month to display and be able to print out
the month correctly.
The English calendar has probably the simplest rules for figuring out how many days per month. Trickier
is to figure out what the day of the week is…..if you can’t think of a trick please email me for hints…
Note that the cells in the calendar page should be passing in information to whatever cgi component or
argument is responsible for creating events.
Step 5 (30 points) Search Engine
We will now add a search capability for the specific user’s schedule. Present a form which allows the user
to query their
1) entire schedule history (show all appointments)
2) all schedules between 2 dates (starting and end date)
3) all schedule between 2 dates (starting and end) and between specific times (example : all
appointments between july 1 2014 and july 20 2014, between 10:00 am and 11:00 am
4) search through the text info for specific string.
This might require you to reorganize the appointment representation on the back end. No reason why
the data might not be stored in multiple forms to help search.
In order to do this step cleanly, create a search class which has specific functions to help specific
searches. For example step 2 and 3 are related and can be coded as one function if you play around
with the times.
Step 6 (30 points) Find a free spot
In this step you want the user to be able to schedule a group appointment between X users on the system.
You will need to allow the user to check off specific users on the system (will need to list all current
users).
Then the user can input a starting date (july 15, 2014), starting time (11am) and length of time (3 hour
appointment (meeting) ).
The system needs to search though all the users and find the first occurring timeslot where everyone is
free for the length of the appointment.
You need to show both first free timeslot and first date which has that time and free time slot.
So for the above example, you might return
1) July 15, 2014 at 6:00pm everyone is free for 3 hours.
2) July 20, 2014 at 11am everyone is free for 3 hours.
4
The user can then click on one of the above and it will insert a group appointment into everyone’s
schedule.
Good Luck and Extra Credit for graphics and originality.
Submit your project.
You need to submit the following files for this homework: README, Makefile, plus all the files
generated above. Submit it over courseworks.

分享到:
评论

相关推荐

    C语言CGI编程

    ### C语言CGI编程知识点详解 #### 一、公共网关接口(CGI)概述 公共网关接口(Common Gateway Interface,简称CGI)是一种用于Web服务器与外部应用程序之间的通信标准,它允许Web服务器调用外部程序处理客户端的...

    C语言写CGI程序详细教程

    C语言写CGI程序详细教程 CGI(Common Gateway Interface,公共网关接口)是一种标准的web服务器和脚本程序之间的接口协议。CGI程序可以用任何编程语言编写,如Shell脚本语言、Perl、Fortran、Pascal、C语言等。但是...

    C语言CGI编写WEB查询系统

    ### C语言CGI编写WEB查询系统 #### 一、CGI概述 公共网关界面(Common Gateway Interface,简称CGI)是一种编程规范,它定义了Web服务器如何与外部应用程序(即CGI程序)进行交互的标准接口。通过CGI,Web服务器...

    C语言CGI的学习资料

    **C语言CGI(Common Gateway Interface)学习指南** CGI,即通用网关接口,是一种标准,用于将Web服务器与各种脚本语言或应用程序连接起来,以动态生成网页内容。在C语言中实现CGI,可以让你创建更复杂的Web应用...

    用C语言进行CGI程序设计

    3. **标准输出**:处理完用户的请求后,CGI程序需要通过标准输出将结果返回给Web服务器。这些结果通常以HTML格式编码,以便Web服务器能将其作为响应发送回给客户端浏览器。 在课程设计的任务中,客户端浏览器会显示...

    C语言CGI商业程序,可上传图片存入mysql数据库

    总结来说,"C语言CGI商业程序,可上传图片存入mysql数据库"是一个结合了C语言编程、CGI技术和MySQL数据库的Web应用解决方案。它提供了一种方式让用户通过Web界面上传图片,并将这些图片的信息安全地存储在MySQL...

    嵌入式系统C语言CGI设计与应用.pdf

    总结来说,嵌入式系统中C语言CGI的设计与应用是网络远程控制技术中一个重要的领域。通过CGI技术,可以实现对嵌入式系统网络接口的远程管理与控制,其优点在于技术成熟、语言无关且具有较好的平台兼容性。在具体的...

    用C语言编写CGI程序

    下面是一个简单的C语言CGI程序示例,用于演示如何处理表单数据: ```c #include #include int main() { int i, n; printf("Content-type: text/plain\n\n"); if (getenv("CONTENT_LENGTH")) { n = atoi...

    c语言多用户登录功能cgi

    c语言编写的多用户登录功能cgi程序,适用于嵌入式,需编译。需要在程序同目录下创建文件user.txt并写入用户名密码用于验证,格式为:用户名空格密码空格用户名空格密码

    c语言写的CGI 计数器

    c语言写的CGI 计数器 在linux 下运行的,要自己加一个count.dat的文件,不然会访问失败的。

    c语言编写的cgi程序

    3. **HTTP协议**:理解GET请求是理解CGI程序的关键。GET请求将数据附加到URL后面,以问号(?)分隔,每个参数由等号(=)分隔。CGI程序需要解析这些参数,提取出有用的信息。 4. **CGI接口**:`cgiapi.c`和`cgiapi....

    cgi-util C语言写CGI库

    在这个案例中,我们讨论的是`cgi-util`,一个用C语言编写的CGI库。 `cgi-util`库为C语言开发者提供了一系列方便的函数和结构,帮助他们快速、有效地编写CGI程序。C语言是系统级编程的首选语言,因此这个库对于那些...

    C语言编写的CGI开发库(linux)

    3. **响应生成**:使用`cgi_printf()`或`cgi_puts()`向HTTP响应体写入数据,可以生成HTML或其他内容。 4. **Cookie操作**:`cgi_set_cookie()`和`cgi_get_cookie()`分别用于设置和获取Cookie信息。 5. **错误处理*...

    c语言 cgi 示例

    C语言CGI程序的核心部分通常包括以下步骤: 1. **环境变量解析**:CGI程序首先需要获取来自HTTP请求的环境变量,如QUERY_STRING(GET方法传递的参数)、REQUEST_METHOD(GET或POST请求类型)和CONTENT_TYPE(POST...

    用c语言进行cgi程序设计.rar_CGI程序设计_cgi_cgi c语言

    在本资源中,我们探讨的是如何使用C语言来编写CGI程序。 C语言是一种强大且高效的编程语言,适用于系统级编程和网络应用。在CGI编程中,C语言能够提供对底层操作系统接口的直接访问,使得开发者可以精确控制程序的...

    C语言开发CGI初步了解

    3. **C语言CGI示例**:以下是一个简单的C语言CGI程序示例,用于展示如何接收表单数据并输出结果: ```c #include #include int main() { char *query_string = getenv("QUERY_STRING"); if (query_string !=...

    CGI之C语言篇.pdf

    以下是一个简单的C语言CGI程序示例: ```c #include #include int main(void) { char *data; long m, n; // 设置HTTP响应头 printf("%s%c%c", "Content-Type:text/html;charset=gb2312", 13, 10); printf...

    c语言开发的cgi简单论坛源码

    【标题】:“C语言开发的CGI简单论坛源码”是一个基于C语言实现的CGI(Common Gateway Interface)应用程序,用于构建一个基本的在线论坛。这个项目是学习CGI编程和C语言结合的理想实例,因为它提供了对用户管理、...

Global site tag (gtag.js) - Google Analytics