企业实训作业

<!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;
}
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值