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(3)

时间: 2024-12-27 20:18:59

C语言 cgi(3)的相关文章

C语言 cgi(2)

1Columbia Universitycs3157 – Advanced ProgrammingSummer 2014, Lab #3, 40 pointsJune 10, 2014This lab is due June 23rd 11:59 pm.• lab in C. We will be using Makefiles.• Don’t forget to FREE up any memory you request!!• Make sure you complete the relev

C语言cgi(1)

1Columbia Universitycs3157 – Advanced ProgrammingSummer 2014, Lab #2, 60ish pointsJune 9, 2014Follow these step-by-step instructions. This lab must be submitted electronically by Monday June16th, 11:55 pm.The point of the labs is to teach and reinfor

几种语言的CGI编程

为了了解PHP.JSP.ASP出现之前人们写网站的方法,洒家研究了一波CGI,使用C.Python.batch.shell script语言写了几个简单的网页. CGI即通用网关接口,指web服务器调用编程语言编写的程序的一个接口.洒家用的是Apache的CGI,QUERY_STRING.REMOTE_ADDR.REQUEST_URI等参数是通过环境变量传递给CGI程序的,请求主体(POST数据)作为CGI程序的标准输入(stdin),而CGI程序的标准输出(stdout)作为HTTP响应的部分

CGI(通用网关接口)

公共网关接口 CGI(Common Gateway Interface) 是WWW技术中最重要的技术之一,有着不可替代的重要地位.CGI是外部应用程序(CGI程序)与Web服务器之间的接口标准,是在CGI程序和Web服务器之间传递信息的规程.CGI规范允许Web服务器执行外部程序,并将它们的输出发送给Web浏览器,CGI将Web的一组简单的静态超媒体文档变成一个完整的新的交互式媒体. Common Gateway Interface,简称CGI.在物理上是一段程序,运行在服务器上,提供同客户端H

cgic 写CGI程序

CGIC是C语言CGI库函数,用于编写CGI程序 CGIC 主要完成以下功能: * 对数据进行语法分析 * 接收以 GET 和 PSOT 两种方式发送的数据 * 把 FORM 中的不同域连接成连续的串 * 为检索 FORM 数据而提供字符串 , 整数 , 浮点以及单项和多项选择功能 * 为数字字段提供边界检测 * 把 CGI 环境变量加载到非空的 C 串中 * 为调试而捕捉 CGI 状态 如何写CGIC应用程序 任何cgic 应用程序必须连接到cgic.c,如果在Linux 下可以用Makefi

Java技术简介及Tomcat部署

Tomcat 引言: 开发语言如:PHP,可以用smarty框架. 另外最流行框架有mvc框架: data           数据 bussiness      业务 presentation   展示 而像这种能使用框架的语言,尤其适合开发web站点. C语言相比PHP,首先,c语言与服务器硬件以及OS关系非常紧密,很难使用框架,并且移植平台困难,而且代码维护成本相当高.但正是由于硬件.系统紧密结合,所以开发出来程序运行速度相当快.如可开发驱动等等. API:application prog

http协议详解和httpd基本介绍

httpd是Apache超文本传输协议(HTTP)服务器的主程序.被设计为一个独立运行的后台进程,它会建立一个处理请求的子进程或线程的池. 要了解httpd就需要先了解下各种协议. http:Hyper Text Transfer Protocol,超文本传输协议 html:Hyper Text Mark Language,超文本标记语言 CGI:Common Gateway Interface,通用网关接口,http和程序解释器的链接协议 http协议版本: http 0.9: 仅用于传输ht

第二十天 TCP 及socket通信原理、http协议及web服务、httpd核心配置详解

一.TCP及socket通信原理详解 二.http协议及web服务原理(一) 三.http协议及web服务原理(二) 四.httpd核心配置详解 1.tcp.udp是一种传输协议,实现进程地址标记,套接字是一个虚拟设备,用来表明主机上的某个进程      众所周知:0-1023:管理员才有权限使用,永久地分配给某应用使用(由IANA分配)      注册端口:1024-41951:只有一部分被注册,分配原则上非特别严格.      动态端口或私有端口:41952-65535:由内核分配临时端口,

DICOM医学图像处理:WEB PACS初谈

背景: 周末看到了一篇原公司同事的文章,讲的是关于新的互联网形势下的PACS系统.正好上一篇专栏文章也提到了有想搭建一个worklist服务器的冲动,所以就翻箱倒柜将原本学生时代做课题时搭建的简易Web PACS找了出来,借着再次搭建的机会学习一下Web PACS相关的技术,例如WADO标准.CGI或者FastCGI等技术. WEB PACS技术浅谈: WEB PACS是一种利用互联网技术,跨越了医院和地域限制的,可随意查询和获取DICOM对象的PACS系统.目前常见的方式有两种:第一种是通过W