00000008.htm
来自「一份很好的linux入门资料」· HTM 代码 · 共 87 行
HTM
87 行
<HTML><HEAD> <TITLE>BBS水木清华站∶精华区</TITLE></HEAD><BODY><CENTER><H1>BBS水木清华站∶精华区</H1></CENTER>发信人: xcec (money), 信区: Linux <BR>标 题: guestbook-->guanli.cpp <BR>发信站: BBS 水木清华站 (Mon Jan 17 13:12:21 2000) WWW-POST <BR> <BR>#include <iostream.h>
<BR>#include <stdlib.h>
<BR>#include <ctype.h>
<BR>#include <string.h>
<BR>#include "datafile.h"
<BR>#include "cgi.h"
<BR>
<BR>#define PASSWORD "xxxxxx"
<BR>
<BR>void printerror(void);
<BR>
<BR>int main()
<BR>{
<BR> CGI cgi;
<BR>
<BR> if (cgi.argnum < 1) {
<BR> printerror();
<BR> return 1;
<BR> }
<BR>
<BR> if ( strcmp(cgi.namevalue[0].value, PASSWORD) ) {
<BR> printerror();
<BR> return 1;
<BR> }
<BR>
<BR> char *p = cgi.namevalue[1].value;
<BR> while ( *p && isdigit(*p) )
<BR> p++;
<BR> if ( *p ) {
<BR> printerror();
<BR> return 1;
<BR> }
<BR>
<BR> DATAFILE datafile;
<BR> datafile.del_record( atoi(cgi.namevalue[1].value) );
<BR>
<BR> cout<<"Content-Type: text/html\n\n";
<BR> cout<<"<html>"<<endl;
<BR> cout<<"<head>"<<endl;
<BR> cout<<"<title></title>"<<endl;
<BR> cout<<"<meta http-equiv=refresh content=\"0;url=guestbook.cgi\">"<<endl;
<BR> cout<<"</head>"<<endl;
<BR> cout<<"<body>"<<endl;
<BR> cout<<"<p>"<<endl;
<BR> cout<<"<p><a href=\"guestbook.cgi\"></a>"<<endl;
<BR> cout<<"</body></html>"<<endl;
<BR> return 0;
<BR>}
<BR>
<BR>void printerror(void)
<BR>{
<BR> cout<<"Content-Type: text/html\n\n";
<BR> cout<<"<html>"<<endl;
<BR> cout<<"<head>"<<endl;
<BR> cout<<"<title></title>"<<endl;
<BR> cout<<"</head>"<<endl;
<BR> cout<<"<body>"<<endl;
<BR> cout<<"<p>, "<<endl;
<BR> cout<<"<p><a href=\"guanli.html\"></a>"<<endl;
<BR> cout<<"</body></html>"<<endl;
<BR>} <BR> <BR>-- <BR>※ 来源:·BBS 水木清华站 smth.org·[FROM: 162.105.33.162] <BR><CENTER><H1>BBS水木清华站∶精华区</H1></CENTER></BODY></HTML>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?