新浪SAE 用setcookie和header出错? 400 报错 Warning : Cannot modify header information - headers already sent by (output started at /data1/www/htdocs/271/lectureland/2/user_info/dbtools.inc.php:1) in user_info/checkpwd.php on line 44
Warning : Cannot modify header information - headers already sent by (output started at /data1/www/htdocs/271/lectureland/2/user_info/dbtools.inc.php:1) in user_info/checkpwd.php on line 45
Warning : Cannot modify header information - headers already sent by (output started at /data1/www/htdocs/271/lectureland/2/user_info/dbtools.inc.php:1) in user_info/checkpwd.php on line 46
Warning : Cannot modify header information - headers already sent by (output started at /data1/www/htdocs/271/lectureland/2/user_info/dbtools.inc.php:1) in user_info/checkpwd.php on line 47
Warning : Cannot modify header information - headers already sent by (output started at /data1/www/htdocs/271/lectureland/2/user_info/dbtools.inc.php:1) in user_info/checkpwd.php on line 48
Warning : Cannot modify header information - headers already sent by (output started at /data1/www/htdocs/271/lectureland/2/user_info/dbtools.inc.php:1) in user_info/checkpwd.php on line 58
<?php require_once("dbtools.inc.php"); $database = "app_lectureland"; //获取窗体数据 $ret = $_POST["ret"]; $account = $_POST["account"]; $password = $_POST["password"]; //创建数据连接 $link = create_connection();
//检查帐号密码是否正确 $sql = "SELECT * FROM users Where account = '$account' AND password = '$password' "; $result = execute_sql($database, $sql, $link);
//如果帐号密码错误 if (mysql_num_rows($result) == 0) { //释放 $result 占用的内存 mysql_free_result($result);
//关闭数据连接
mysql_close($link);
//显示消息要求用户输入正确的帐号密码
echo "<script type='text/javascript'>";
echo "alert('帐号密码错误,请查明后再登录');";
echo "history.back();";
echo "</script>";
}
//如果帐号密码正确 else { //获取 id 字段 $id = mysql_result($result,0,"user_id"); $type = mysql_result($result,0,"user_type"); $username = mysql_result($result,0,"name"); $account = mysql_result($result,0,"account"); //释放 $result 占用的内存 mysql_free_result($result); //关闭数据连接 mysql_close($link); //将用户数据加入 cookies setcookie("user_id", $id,0,'/'); setcookie("passed", "TRUE",0,'/'); setcookie("name", $username,0,'/'); setcookie("user_type", $type,0,'/'); setcookie("account", $account,0,'/'); if(empty($ret)){ if($type == "user") { $ret='user/index.php'; } else{ $ret='admins/course.php'; } } header("location:" . $ret); //跳回原页面 } ?>
UTF-8文件,去除BOM即可######试了 不行######楼主解决了吗,我也遇到这个问题啊
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。