它没有将我带到成功的页面,而是停在脚本页面并在标题中给出错误“警告:无法修改标头信息 - 标头已由(输出开始于”)发送,我相信它与标头有关,并且在回声或其他东西之后有它,但我不知道如何修复它。非常感谢任何帮助
<div style="position:absolute;left:750px;top:0px;width:160px;height:41px;overflow:hidden;">
<?php
if(isset($_SESSION['userName'])){
echo 'You are already logged in as <a href="recent.php" <a>'.$_SESSION['userName'].'</a>. Not you? <a href ="logout.php"</a>logout';
}else{
echo ' Please login <a href ="login_form.php" <a> click here</a>'.' Register <a href="register.php"<a>here</a>';
}
?>
</div>
<div style="position:absolute;left:400px;top:150px;width:400px;height:141px;overflow:hidden;">
<?php
//=============Configuring Server and Database=======
$host = 'localhost';
$user = 'root';
$password = 'revilo';
//=============Data Base Information=================
$database = 'dbsneaker';
$conn = mysql_connect($host,$user,$password) or die('Server Information is not Correct'); //Establish Connection with Server
mysql_select_db($database,$conn) or die('Database Information is not correct');
//===============End Server Configuration============
//=============Starting Registration Script==========
$userName = mysql_real_escape_string($_POST['txtUser']);
$password = mysql_real_escape_string($_POST['txtPassword']);
//=============To Encrypt Password===================
//$password = md5($password);
//============New Variable of Password is Now with an Encrypted Value========
if(!trim($userName) || !trim($password)){
echo 'Please fill in the form <br> <a href="register.php"<a>Click here</a> to return to registration';
}else{
// There's no empty field
// Check user exists
$checkQuerySql = "SELECT * FROM `bladmin` WHERE `admin_usr_name` = '$userName'";
$checkQuery = mysql_query($checkQuerySql);
if(mysql_fetch_assoc($checkQuery)){
echo 'User already exists <br> <a href="register.php"<a>Click here</a> to return to registration';
}else{
if(isset($_POST['btnRegister'])) //===When I will Set the Button to 1 or Press Button to register
{
$query = "insert into bladmin(admin_usr_name,admin_pwd)values('$userName','$password')";
$res = mysql_query($query);
header('location:success_register.php');
}// User doesnt exists
}
}
?>
</div>
</div>