session_start有關問題

來源:互聯網
上載者:User
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.daimami.com/java-web/317.html
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.