Erro ao redirecionar página
Boa tarde pessoal.
Tenho uma página de login que redireciona o Usuário a sua página inicial se o login estiver correto. O problema é: ela funciona normal localmente, porém quando upo pro servidor a página de login não redireciona para a página inicial, simplesmente a página de login fica toda em branco e não vai pra canto nenhum.
e eu ainda tentei redirecionar na força com javascript mas não foi também
O código da página de login é esse:
<?php
// *** Validate request to login to this site.
//if (!isset($_SESSION)) {
// session_start();//}
$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}
$MM_redirectequalsinformation = "aluno_trocaSenha.php";
$MM_redirectLoginSuccess = "aluno_paginaInicial.php";
$MM_redirectLoginFailed = "acesso_restrito.php";
$MM_redirecttoReferrer = "aluno_paginaInicial.php";
mysql_select_db($database_DB_Connect, $DB_Connect);
//if($_POST['usuario']==$_POST['senha']){
// header("Location: ". $MM_redirectequalsinformation);
//break;
//} else
if (isset($_POST['usuario'])) {
$loginUsername=$_POST['usuario'];
$password=$_POST['senha'];
$MM_fldUserAuthorization = "";
//estava aqui
$LoginRS__query=sprintf("SELECT login, senha FROM sis_usuario_aluno WHERE login=%s AND senha=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
$LoginRS = mysql_query($LoginRS__query, $DB_Connect) or die(mysql_error());
///////////////////////////////
$pegaNome = sprintf("SELECT nome FROM sis_aluno WHERE sis_aluno.cpf = ".$_POST['usuario']);
mysql_select_db($database_DB_Connect, $DB_Connect);
$resultadoPegaNome = mysql_query($pegaNome, $DB_Connect);
$data = mysql_fetch_assoc($resultadoPegaNome) or die(mysql_error());
$_SESSION["login"] = $data['nome'];
//////////////////////////////
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";
if (PHP_VERSION >= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();}
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;
//verificando se as informações digitadas são iguais.
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
// *** Validate request to login to this site.
?>
<script>
function Entra(){
alert ('SEJA BEM VINDO AO SISTEMA DE PROVAS');
document.location = 'aluno_paginaInicial.php';
}
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
.principa_campinho {width: 30px;
}
.principal { height: 1200px;
width: 600px;
margin: auto;
}
.principal_areadetexto {height: 500px;
width: 590px;
}
.principal_campotexto {width: 215px;
}
.principal_centralizar {margin-top: 30px;
margin-right: auto;
margin-bottom: auto;
margin-left: auto;
}
.principal_texto {font-size: 48px;
color: #FFF;
}
.principal1 {height: 600px;
width: 600px;
margin: auto;
}
.principal_centralizar1 {
margin-top: 50px;
margin-right: auto;
margin-bottom: auto;
margin-left: auto;
}
.principal_CORESTRATEGO { color: #F90;
}
.principal_CORTEXTO { color: #FFF;
}
.principal_centralizar2 { margin-top: 80px;
margin-right: auto;
margin-bottom: auto;
margin-left: auto;
}
.principal_atencao {
color: #F00;
}
</style>
</head>
<body>
<div class="principal1">
<table width="601" border="0">
<tr>
<th height="167" bgcolor="#666666" class="principal_texto"><p><img src="IMAGENS/logo.fw.png" alt="" width="295" height="75" /></p></th>
</tr>
</table>
<table width="600" border="0">
<tr>
<th colspan="2">Acesse o Sistema introduzindo abaixo seu login e senha de Aluno.</th>
</tr>
</table>
<form id="form_autentica" name="form_autentica" method="POST" action="<?php echo $loginFormAction; ?>" >
<table width="600" border="0">
<tr>
<th colspan="2" class="principal_atencao">Se este for o seu primeiro acesso ao sistema introduza também o CPF no campo de senha</th>
</tr>
</table>
<table width="504" height="153" border="0" class="principal_centralizar2">
<tr>
<td width="183" rowspan="5"><img src="IMAGENS/entrar.gif" alt="" width="158" height="142" /></td>
<th colspan="2" align="center"> </th>
</tr>
<tr>
<td align="right">CPF: </td>
<td align="left"><input name="usuario" type="text" id="usuario" /></td>
</tr>
<tr>
<td align="right">Senha:</td>
<td><input name="senha" type="password" id="senha" /></td>
</tr>
<tr>
<td height="10" rowspan="2" align="right"> </td>
<td valign="top"><input type="submit" onClick="Entra();" name="button" id="button" value="Entrar" /></td>
</tr>
<tr>
<td valign="top"><a href="aluno_recuperaSenha.php">Esqueci meus dados</a></td>
</tr>
</table>
</form>
<p> </p>
<p> </p>
<table width="600" border="0">
<tr>
<th height="48" bgcolor="#000000" class="principal_CORTEXTO">Setor de Desenvolvimento de Sistemas</th>
</tr>
</table>
<p> </p>
</div>
</body>
</html>
solicito a ajuda de vocês o mais rápido possível, pois meu chefe está no meu cangote, abraços.
Discussão (3)
Carregando comentários...