cgi无法重定向到一个新的页面???

lzz1991 2012-12-26 09:04:08
#include"cgic.h"

#include"cgic.c"

#include<iostream>

using namespace std;

int cgiMain()

{

char user[20],password[20];
cgiFormString("user",user,20);
cgiFormString("password",password,20);
string strOfuser(user);
string strOfpassword(password);
string str1("chen");
string str2("123");
if(cgiFormSubmitClicked("redir")==cgiFormSuccess){

if(strOfuser.compare(str1)==0 && strOfpassword.compare(str2)==0)
{
cgiHeaderLocation("/var/www/index.html");
}
else
{
cgiHeaderLocation("/var/www/redir.html");
}
}
cgiHeaderContentType("text/html");
return 0;

}



<TITLE>短信平台登录</TITLE>

<FORM METHOD="post"ACTION="/cgi-bin/xs.cgi"

<p align="center">短信平台登录 </p>

<div>

用户名:<INPUT type="text" name="user"><p>

密码: <input TYPE="password" NAME="password"><p>

<input type="submit" name="redir" value="确定"/>

<input type="RESET" VALUE="取消"/〉<p>

</div>



</FORM>

400 Bad Request

Your client has issued a malformed or illegal request.
为什么在调用cgiHeaderLocation()函数时出错???这个是在linux下的boa服务器运行
...全文
487 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
飞天狐213 2013-09-23
  • 打赏
  • 举报
回复
顶,坐等高手,
qchwuscdn 2013-03-14
  • 打赏
  • 举报
回复
您这问题解决了吗?我也遇到了! 网上说,任何cgiout使用前需要使用函数“cgiHeaderContentType("text/html");”加上后,直接就在页面上出现“Location:index.html”的文件输出,如何才能定位到index.html页面呢?谢谢!

2,204

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 CGI
社区管理员
  • CGI社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧