Buen dia,
tengo el siguiente problema, he usado un script para publicacion de noticias sin problema alguno en un par de servidores (aplus y hostgator) y hoy tratando de instalar el mismo en godaddy de plano no quiere funcionar, lo que pasa es que a la hora de ingresar el usuario y el pass no carga la pagina que deberia cargar, es decir panel.php y se queda en index.php y me hace refresh de la misma como si nada hubiera pasado.
El codigo esta identico para los otros servidores y funciona, porque en godaddy no es asi? alguna sugerencia? sera problema al cargar los headers? uso un require al iniciar el script...será por eso? por que no autentifica el inicio de sesion?
Saludos y muchas gracias
aqui esta el codigo de mi index.php
Código HTML:
<?php require_once('../panel/Connections/panel.php'); ?>
<?php
// *** Validate request to login to this site.
session_start();
$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($accesscheck)) {
$GLOBALS['PrevUrl'] = $accesscheck;
session_register('PrevUrl');
}
if (isset($_POST['username'])) {
$loginUsername=$_POST['username'];
$password=$_POST['password'];
$MM_fldUserAuthorization = "nivel";
$MM_redirectLoginSuccess = "panel.php";
$MM_redirectLoginFailed = "index.php?l=1";
$MM_redirecttoReferrer = false;
mysql_select_db($database_panel, $panel);
$LoginRS__query=sprintf("SELECT usuario, password, nivel FROM admin WHERE usuario='%s' AND password='%s'",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));
$LoginRS = mysql_query($LoginRS__query, $panel) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = mysql_result($LoginRS,0,'nivel');
//declare two session variables and assign them
$GLOBALS['MM_Username'] = $loginUsername;
$GLOBALS['MM_UserGroup'] = $loginStrGroup;
//register the session variables
session_register("MM_Username");
session_register("MM_UserGroup");
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>=- Control Panel -=</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="panel.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style2 {
font-size: 24px;
font-weight: bold;
}
-->
</style>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="14" background="assets/barra-top.gif"></td>
</tr>
<tr>
<td height="60" background="assets/background.gif" bgcolor="#CCCC99"><span class="style2">
Control Panel</span></td>
</tr>
<tr>
<td height="50" background="assets/barra-menu.gif"> </td>
</tr>
</table></td>
</tr>
<tr>
<td height="396" valign="top"><table width="300" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="3"> </td>
</tr>
<tr>
<td width="20"> </td>
<td colspan="2"><p><img src="assets/titulo01.gif" width="193" height="18"></p>
<p><strong>Welcome to the news control panel. <br>
Please login </strong></p>
<?php if ($l=="1") { ?>
<p><font color="red"><strong>User or password inccorrect.<br>
Please try again </strong></font></p>
<?php }
$l=0;
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<form ACTION="<?php echo $loginFormAction; ?>" METHOD="POST" name=login>
<tr>
<td valign="bottom">User</td>
</tr>
<tr>
<td><input name="username" type="text" id="username"></td>
</tr>
<tr>
<td height="20" valign="bottom">Password</td>
</tr>
<tr>
<td><input name="password" type="password" id="password"></td>
</tr>
<tr>
<td height="34" valign="bottom"> <input type="submit" name="Submit" value="Send"></td></tr>
</form>
</table> </td>
</tr>
</table></td>
</tr>
<tr>
<td height="70" bgcolor="#999999"><p class="creditos"> © 2009. All rights reserved.<br />
Produced by Dober Co.</p></td>
</tr>
</table>
</body>
</html>
y aqui esta a la pagina que debe redireccionar:
Código HTML:
<?php
//initialize the session
session_start();
// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
$logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
//to fully log out a visitor we need to clear the session varialbles
session_unregister('MM_Username');
session_unregister('MM_UserGroup');
$logoutGoTo = "index.php";
if ($logoutGoTo) {
header("Location: $logoutGoTo");
exit;
}
}
?>
<?php
session_start();
$MM_authorizedUsers = "0,1";
$MM_donotCheckaccess = "false";
// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && false) {
$isValid = true;
}
}
return $isValid;
}
$MM_restrictGoTo = "index.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
$MM_referrer .= "?" . $QUERY_STRING;
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>=- Panel de Contol -=</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="panel.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><?php include("top.php"); ?></td>
</tr>
<tr>
<td height="396" valign="top"><table width="350" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="3"> </td>
</tr>
<tr>
<td width="20"> </td>
<td colspan="2"><p><img src="assets/titulo01.gif" width="193" height="18"></p>
<p><strong><?php echo $_SESSION['MM_Username'] ?>, Welcome!</strong><strong><br>
</strong></p>
</td>
</tr>
</table></td>
</tr>
<tr>
<td><?php include("bottom.php"); ?></td>
</tr>
</table>
</body>
</html>
alguna idea? gracias de antemano!
me falto comentarles que al intentar hacer login me redirecciona a
/index.php?accesscheck=%2Fpanel%2Fpanel.php