我已经得到以下内容并且在我的localhost中运行正常。同样我在网络服务器上试过,但header("Location:xxxx");
似乎没有起作用。我这里有什么不对吗?我已经发布了一些以前的帖子并尝试纠正空白区域等;但没有快乐。有什么建议?谢谢。
这是代码:
<th><?php
$db = mysqli_connect('xxxxxgemysql.com', 'headpass', 'headpass1', 'headpass');
if(mysqli_connect_errno()) {die('The connection to the database could not be established.');}
if(isset($_POST['submitLog']))
{
if(isset($_SESSION['loggedUser']))
{echo 'A login already exists with user '.$_SESSION['loggedUser'].'. <a href="logout.php" style="color:#1E65C9; font-family:Palatino Linotype; text-decoration:none;" > Log off</a> first';}
else {
$un_cuser = $_POST['textfield'];
$un_cpwd = $_POST['password2'];
if($un_cuser== '')
{echo 'User name is required';}
elseif($un_cpwd == '')
{echo 'Password is required';}
else
{
$SQL_log = "SELECT un,pw FROM userlogs WHERE un='$un_cuser'";
$result_log = mysqli_query($db,$SQL_log) or die ("SQL Error : Log-ER_001");
$row_log = mysqli_fetch_array($result_log);
if($row_log == '')
{echo 'Sorry!';}
elseif($un_cpwd == $row_log['pw'])
{
$result_log_b = mysqli_query($db,"SELECT un AS fnam FROM userlogs WHERE un='$un_cuser'");
$row_log_b = mysqli_fetch_assoc($result_log_b);
$sum_log_b = $row_log_b['fnam'];
$_SESSION['loggedUser'] = $row_log_b['fnam'];
header('Location:http://www.google.com');}else
{echo 'Password error!';}}}}?></th>
答案 0 :(得分:1)