<!doctype html>
if(cgiFormSubmitClicked(“login”) == cgiFormSuccess){
cgiFormString(“username”, username,sizeof(username));
cgiFromString(“pwq”,pwq,sizeof(pwq));
cgiFormString(“sex”,sex,sizeof(sex));
cgiFormString(“desc”,desc,sizeof(desc));
cgiFormString(“quyu”,quyu,sizeof(quyu;
cgiHeaderContentType(“text/html;charset=gbk”);
//printf(username);
//printf(pwq);
fprintf(cgiOut,"");
fprintf(cgiOut,“用户名:%s, 性别:%s”,username,quyu);
fprintf(cgiOut,");
return 0;
}
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include"cgic.h"
int cgiMain(){
char model[32]={0};
char fun[32]={0};
//project01.cgi?model=user&fun=login
//project01.cgi?model=user&fun=register
if (cgiFromString(“model”,model,sizeof(model))!=cgiFornString{
cgiHeaderContentType(“text/html;charset=gbk”);
printf("model参数必传“);
return0;
}
if (cgiFromString(“fun”,fun,sizeof(fun))!=cgiFornSuccess{
cgiHeaderContenType(“text/html;charset=gbk”);
printf("fun参数必传“);
return0;
}
if(strcmp(model,“user”)==0){
if(strcmp(fun,“toLogin”)==0);
}
else if(strcmp(fun,“login”)==0){
char username[256];
char pwd[250];
cgiFormString(“username”,username,sizeof(username));
cgiFormString(“pwd”,pwd,sizeof(pwd));
//查询数据库对比用户名密码
if(strcmp(username,“zq”)==0&&strcmp(pwd,“123”)==0){
cgiHeaderContentType(“text/html;charset=gbk”);
printf(“登录成功”)
return 0;
}
else{
cgiHeaderContentType("text/html;charset=“gbk”);
printf(“用户名或密码错误”);
return 0;
}
}