以下错误不断出现,我不确定问题是什么,它说输出已经发送:
警告:无法修改标题信息 - 已在/ home / unix / student12 / w1376540 / public_html / messages中发送的标题(在/home/unix/student12/w1376540/public_html/messages/title_bar.php:7中开始输出)第24行/login.php
以下代码如下: 的login.php:
<?php include 'connect.php'; ?>
<?php include 'functions.php'; ?>
<?php include 'title_bar.php'; ?>
<html>
<head>
<title>Login - Private Message System</title>
</head>
<body>
<div>
<h3> Login- Private message system </h3>
<form method='post'>
<?php
if(isset($_POST['login'])){
$username = $_POST['username'];
$password = md5($_POST['password']);
if(empty($username) or empty($password)){
$message= "Fields empty";
} else{
$check_login = mysql_query("SELECT id FROM `users` WHERE `username`='$username' AND `password`='$password'");
if(mysql_num_rows($check_login)==1){
$run_login = mysql_fetch_array($check_login);
$user_id = $run_login['id'];
$_SESSION['user_id'] = $user_id;
header('location: index.php');
} else{
$message = "Username or password incorrect";
}
}
echo "<p>$message</p>";
}
?>
Username :<br/>
<input type ='text' name='username'/>
<br/><br/>
Password : <br/>
<input type='password' name='password'/>
<br/><br/>
<input type='submit' name="login" value='Log in'/>
</form>
</div>
</body>
</html>
title_bar.php:
<?php
if(loggedin()){
?>
<a href='index.php'>home</a>
<a href='messages.php'>messages</a>
<a href='logout.php'>logout</a>
<?php
}else{
?>
<a href='index.php'>home</a>
<a href='login.php'>Log in</a>
<a href='register.php'>Register</a>
<?php
}
?>