这是我当前使用的代码,在本地主机上这个工作很好并且重定向,但是当我尝试在像altervista.org这样的免费网站上上传时,这没有更多的重定向..为什么?
<?php
$p = $_GET['azione'];
// login.php?azione=login
if($p == "login"){
if(!isset($_POST['invia'])){ ?>
<div class="loginform">
<h3>Login!</h3>
<form class="form-horizontal" method="post" action="#" id="formlogin">
<div class="control-group">
<label class="control-label" for="username"></label>
<div class="controls">
<input type="text" placeholder="Username" name="username" id="username" /><br>
</div>
</div>
<div class="control-group">
<div class="controls">
<input type="password" placeholder="Password" name="password" id="password" /><br>
</div>
</div>
<div class="control-group">
<div class="controls">
<button type="submit" class="btn btn-large" name="invia" id="login" value="Accedi">
Sign in!
</button>
<br><br>
<a href='register.php'>Sign Up Now!</a> <br><br>
<a href='forgotpass.php'>Forgot Your Password?</a>
</div>
</div>
</form>
</div>
<?php } else {
$username = mysql_real_escape_string($_POST['username']);
$password = mysql_real_escape_string($_POST['password']);
if($username == "" || $password == ""){
echo "<div class='alert alert-error'>
<strong>Sorry!</strong> Complete all fields!
</div>";
header("Refresh: 2; URL= login.php?azione=login");
} else {
$password_cript = md5($password);
$recuperadati = mysql_query("SELECT * FROM utenti WHERE username = '$username' AND password = '$password_cript'");
$verificadati = mysql_num_rows($recuperadati);
if($verificadati == 1){
$sessione = mysql_fetch_array($recuperadati);
$_SESSION['utente'] = $sessione['username'];
$_SESSION['id_user_logged'] = $sessione['id'];
echo "<div class='alert alert-success'>
You are now logged in!
</div>";
header("Refresh: 2; URL= profile.php?username=".$_SESSION['utente']."");
} else {
echo "<div class='alert alert-error'>
<strong>Sorry!</strong> Username or Password not found!
<a href='login.php?azione=login'>Try again</a> or <a href='register.php'>Sign Up now</a>
</div>";
}
}
}
// login.php?azione=logout
} elseif ($p == "logout"){
session_destroy();
echo "<div class='alert alert-success'>
Logout!
</div>";
header("Refresh: 2; URL= index.php");
}
?>
刚刚添加了login.php的完整代码,也许它可以是最大的帮助