日期:2014-05-17  浏览次数:20772 次

session_start问题
<?php
session_start();
echo fuck; 
if ($_POST['submit']=='Register'){
  header('Location:sign_in.php');
}
$db=mysql_connect('localhost','bp6am','123') or die('Unable to connect.');
mysql_select_db('web',$db) or die(mysql_error($db));
if (!isset($_SESSION['logged']) || $_SESSION['logged']!=1){
  $query='select user_name from user where user_name="'.$_POST['username'].'" AND password="'.$_POST['password'].'"';
  $result=mysql_query($query,$db) or die(mysql_error($db));
  if (mysql_num_rows($result)==1) {
  echo fuck;
  $_SESSION['username']=$user_name;
  $_SESSION['logged']=1;
  echo fuck;
  header ('Refresh: 5;Location:index.php');
  }
  else{
  $_SESSION['username']='';
  $_SESSION['logged']=0;
  echo You entered in a wrong user name or password, please check. If you want to register,<a herf="http://localhost/register.php"> click here</a>.;
  }
}
?>  
我在开头就设置了session_start();
在这之前没有任何输出,但是提示我HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request.如果session_start正确的话,fuck应该是可以打出来的。
求指教。
另:这是我自己写的登录模块,不知道有没有安全方面的隐患?
谢谢

------解决方案--------------------
打开 php 的错误显示功能,你会看到这一行出致命错
echo You entered in a wrong user name or password, please check. If you want to register,<a herf="http://localhost/register.php"> click here</a>.;


我的异常网推荐解决方案:The server encountered an internal error () that prevented it from fulfilling this request.,http://www.aiyiweb.com/java-web/317.html