php缓存问题,一个简单的登陆界面

zhangyutao101 2009-08-21 12:54:45
php缓存问题, 一个简单的登陆界面,在firefox下好用,在IE下不能用啊。本人第一次用php编程,请大家说详细点,不要见笑啊。下面是代码:
<?php
ob_start();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>登陆</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<META HTTP-EQUIV=”Pragma” CONTENT=”no-cache”>
<LINK
href="images/public.css" type=text/css rel=stylesheet>
<LINK
href="images/login.css" type=text/css rel=stylesheet>
<STYLE type=text/css>
</STYLE>
<META content="MSHTML 6.00.2900.5848" name=GENERATOR>
</HEAD>
<BODY>
<?php
session_start();
$str=$_SESSION[check_pic];
$str=iconv('utf-8','gb2312',$str);//把编码格式为utf-8的session转换为编码格式为gb2312
echo $str ;
if($_POST['txtSN'])
{
if($_POST['txtSN']==$str)
{
echo '验证码正确:',$str;
}
else{echo '验证码错误:',$str;}
} */
if (isset($_REQUEST['submitted'])) {
date_default_timezone_set('PRC');
$link = mysql_connect('localhost', 'root', '000');
mysql_query("set names 'utf-8'");
mysql_query("SET CHARACTER_SET_CLIENT=utf8");
mysql_query("SET CHARACTER_SET_RESULTS=utf8");
mysql_select_db('shopex',$link);
$result=mysql_query($sql);
if (!empty($_POST['txtUserName'])) {
$UserName = trim(stripslashes($_POST['txtUserName']));
} else {
echo '<p><font color="red" size="+1">You forgot to enter your password!</font></p>';
echo "<script>alert('\用户名不能为\空');</script>";
$UserName = FALSE;
}
if (!empty($_POST['txtUserPassword'])) {
$UserPassword = trim(stripslashes($_POST['txtUserPassword']));
} else {
$UserPassword = FALSE;
echo "<script>alert('\密码不能为\空');</script>";
}
if ($UserName && $UserPassword) {
$query0 = "SELECT username, userpass FROM sdb_operators WHERE username='$UserName' ";
$result0 = mysql_query ($query0) or trigger_error("Query: $query\n<br />MySQL Error: " . mysql_error());
if (@mysql_num_rows($result0) == 1) {
$query = "SELECT username, userpass FROM sdb_operators WHERE (username='$UserName' AND userpass=md5('$UserPassword')) ";
$result = mysql_query ($query) or trigger_error("Query: $query\n<br />MySQL Error: " . mysql_error());
}else { echo "<script>alert('\用户名不存\在');</script>";
}
if (@mysql_num_rows($result) == 1) {
ob_end_clean();
header("Location: index.php\n");
flush() ;

exit();

} else { echo "<script>alert('\密码不正\确');</script>";
// ob_flush();

}

}

mysql_close();
}
?>
<DIV id=div1>
<form action=" " method="post" name="form1" target="_self">
<TABLE id=login height="100%" cellSpacing=0 cellPadding=0 width=800
align=center>
<TBODY>
<TR id=main>
<TD>
<TABLE height="100%" cellSpacing=0 cellPadding=0 width="100%">
<TBODY>
<TR>
<TD colSpan=4> </TD>
</TR>
<TR height=30>
<TD width=380> </TD>
<TD> </TD>
<TD> </TD>
<TD> </TD>
</TR>
<TR height=40>
<TD rowSpan=4> </TD>
<TD>用户名:<?php $str?></TD>
<TD>
<INPUT class=textbox id=txtUserName name=txtUserName>
</TD>
<TD width=120> </TD>
</TR>
<TR height=40>
<TD>密 码:</TD>
<TD>
<INPUT class=textbox id=txtUserPassword type=password
name=txtUserPassword>
</TD>
<TD width=120> </TD>
</TR>
<TR height=40>
<TD>验证码:</TD>
<TD vAlign=center colSpan=2>
<INPUT id=txtSN size=4 name=txtSN maxlength="4">
  <IMG src="yzh.php" > <A id=LinkButton1
href="#">不清楚,再来一张</A></TD>
</TR>
<TR height=40>
<TD></TD>
<TD align=right>
<INPUT id=btnLogin type=submit value=" 登 录 " name=btnLogin>
<input type="hidden" name="submitted" value="TRUE" />
</TD>
<TD width=120> </TD>
</TR>
<TR height=110>
<TD colSpan=4> </TD>
</TR>
</TBODY>
</TABLE>
</TD>
</TR>
<TR id=root height=104>
<TD> </TD>
</TR>
</TBODY>
</TABLE>
</form>
</DIV>
<DIV id=div2 style="DISPLAY: none"></DIV>
</CONTENTTEMPLATE>
</BODY>
</HTML>
为什么我把 header("Location: index.php\n");注释掉,还可以跳转。我知道是缓存的问题,把cookie还有临时文件都清除了,也不能用。请大家帮帮忙啊,着急中。
firefox与IE缓存到底怎么回事啊??
...全文
147 点赞 收藏 5
写回复
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
LuciferStar 2009-08-21
奇怪,既然HTML代码是utf8,为什么还要转成GB2312再处理?
你网页文本直接保存成UTF8好了。
回复
zhangyutao101 2009-08-21
我试了,不行啊。
回复
CunningBoy 2009-08-21
缓存就是临时文件,清除之后,关闭IE,再重新打开你的页面试。
回复
zhangyutao101 2009-08-21
你说的我不明白啊,我把IE的所有临时信息都清除了。cookie与缓存, 我知道不是一回事,但具体不明白啊,
回复
CunningBoy 2009-08-21
缓存清除后有没有重新打开页面试?
回复
发动态
发帖子
基础编程
创建于2007-09-28

2.1w+

社区成员

从PHP安装配置,PHP入门,PHP基础到PHP应用
申请成为版主
社区公告
暂无公告