Home > Backend Development > PHP Tutorial > session_start有关问题

session_start有关问题

WBOY
Release: 2016-06-13 12:38:08
Original
1009 people have browsed it

session_start问题
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, click here.;
  }
}
?>  
我在开头就设置了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, click here.;


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

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template