【发布时间】:2014-02-03 10:43:36
【问题描述】:
header(location: agentverification.php) 在 localhost 服务器上工作时,在上传到 godaddy 服务器时不起作用。我尝试编辑我的代码,但结果仍然相同。如果有人可以帮助我,我将不胜感激并提前致谢。
agentlogin.php
<form method = "post" action = "agentverification.php" >
<table>
<input type="text" name="ID" size=20 ><br></td></tr>
<tr>
<td>Password <font color=red>*</font></td>
<td><input type="password" name="pass" size=20><br></td></tr>
</table>
<input type = "hidden" name = "login">
<input type = "submit" name = "login" value = "submit" id="pop">
agentverification.php
<?php
session_start();
$link = mysqli_connect('localhost', 'root', '','db5') or die(mysqli_error());
if(isset($_POST['login']))
{
extract($_REQUEST);
$id = $_POST['ID'];
$pass = $_POST['pass'];
$query= "SELECT * FROM agentReg WHERE AgentID = '$id'";
$record = mysqli_query ($link,$query);
$check=FALSE;
while($row=mysqli_fetch_array($record))
{
if($id === $row['AgentID']&& $pass === $row['password'] )
{
$check=TRUE;
}
}
if($check == TRUE)
{
$_SESSION['AgentID'] = $id;
$_SESSION['password'] = $pass;
header("Location: agentpage.php");
}
else
{ ?> <script>
alert ("Wrong combination of ID and Password. Please try again.");
</script> <?php
session_destroy();
header("location: agentlogin.php");
}
}?>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script>
agentReg 数据库结构
CREATE TABLE agentReg
(AgentID varchar (100) primary key,
password varchar (100));
【问题讨论】:
-
你在哪里使用标题(位置:agentverification.php)?
-
我要说你已经在页面上渲染了一些东西。尝试采用
ob_start()和ob_clean()作为解决方法。 (在错误日志中查看 已发送的标头 - 如果它在那里,这应该可以解决您的问题) -
这个问题和你之前的问题有什么区别?
-
你又用可怕的格式发布了它。
-
另外,最好在发送
header('Location后die;
标签: javascript php jquery html mysql