Sin accion al insertar registro
Hola buenas tardes...
Me ocurre lo siguiente:
He creado un sistema de administracion web con varias paginas, que son alta, modificacion y listado. Cuando creas, modifica o eliminas un registro me debe acudir a una pagina que es listado pero no lo hace....
El alojamiento remoto es de 1and1 al igual que la base de datos.
Sin embargo en local funciona perfectamente con Wamp.
Saben de que puede ser?
Me ocurre lo siguiente:
He creado un sistema de administracion web con varias paginas, que son alta, modificacion y listado. Cuando creas, modifica o eliminas un registro me debe acudir a una pagina que es listado pero no lo hace....
El alojamiento remoto es de 1and1 al igual que la base de datos.
Sin embargo en local funciona perfectamente con Wamp.
Saben de que puede ser?
0
Puntos
Puntos
1579
Visitas
Visitas
5
Resp
Resp
Por Ramos hace 126 meses
Principiante
Respuesta #1
que raro si quieres pon el código de la pagina que se encarga de redireccionar para echarle un vistazo
Respuesta #2
Otro ejemplo:
Al introducir los datos de acceso de usuario a una pagina deberia llevarme a una index y sin embargo no lo hace....
Pero si escribo index.php me reconoce que estoy logueado.
<?php require_once('../Connections/conexion.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
?>
<?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'];
}
if (isset($_POST['usuario'])) {
$loginUsername=$_POST['usuario'];
$password=$_POST['pass'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "index.php";
$MM_redirectLoginFailed = "error-acceso.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_conexion, $conexion);
$LoginRS__query=sprintf("SELECT nom_usu, pass_usu FROM usuarios WHERE nom_usu=%s AND pass_usu=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
$LoginRS = mysql_query($LoginRS__query, $conexion) or die(mysql_error());
$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;
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
<?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'];
}
if (isset($_POST['usuario'])) {
$loginUsername=$_POST['usuario'];
$password=md5($_POST['pass']);
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "index.php";
$MM_redirectLoginFailed = "error-acceso.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_conexion, $conexion);
$LoginRS__query=sprintf("SELECT nom_usu, pass_usu FROM usuarios WHERE nom_usu=%s AND pass_usu=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
$LoginRS = mysql_query($LoginRS__query, $conexion) or die(mysql_error());
$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;
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
<!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=iso-8859-1" />
<title>..:: Administración ::..</title>
<link href="../estilos/estilos.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="../slider/css/style.css" />
<link rel=”shortcut icon” href= ../imagenes/favicon.ico/>
<script src="../SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<link href="../SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="capa-principal">
<div id="contenido" align="center">
<p><span class="tituloform">Introduce tus datos para acceder </span><br />
</p>
<form id="form-acceso" name="form-acceso" method="POST" action="<?php echo $loginFormAction; ?>">
<table width="475" border="0" cellpadding="5" cellspacing="0" class="forminput">
<tr>
<td width="206" align="right">Usuario:</td>
<td width="245" valign="middle"><span id="user">
<input name="usuario" type="text" class="forminput" id="usuario" />
<span class="textfieldRequiredMsg">*</span></span></td>
</tr>
<tr>
<td align="right">Contraseña:</td>
<td><span id="password">
<input name="pass" type="password" class="forminput" id="pass" />
<span class="textfieldRequiredMsg">*</span></span></td>
</tr>
<tr>
<td> </td>
<td align="right"><input name="button" type="submit" class="forminput" id="button" value="Entrar" /></td>
</tr>
</table>
</form>
<br />
</div>
<div id="piepagina"></div>
</div>
<script type="text/javascript">
var sprytextfield1 = new Spry.Widget.ValidationTextField("user", "none", {validateOn:["blur"]});
var sprytextfield2 = new Spry.Widget.ValidationTextField("password", "none", {validateOn:["blur"]});
</script>
Al introducir los datos de acceso de usuario a una pagina deberia llevarme a una index y sin embargo no lo hace....
Pero si escribo index.php me reconoce que estoy logueado.
<?php require_once('../Connections/conexion.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
?>
<?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'];
}
if (isset($_POST['usuario'])) {
$loginUsername=$_POST['usuario'];
$password=$_POST['pass'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "index.php";
$MM_redirectLoginFailed = "error-acceso.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_conexion, $conexion);
$LoginRS__query=sprintf("SELECT nom_usu, pass_usu FROM usuarios WHERE nom_usu=%s AND pass_usu=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
$LoginRS = mysql_query($LoginRS__query, $conexion) or die(mysql_error());
$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;
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
<?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'];
}
if (isset($_POST['usuario'])) {
$loginUsername=$_POST['usuario'];
$password=md5($_POST['pass']);
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "index.php";
$MM_redirectLoginFailed = "error-acceso.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_conexion, $conexion);
$LoginRS__query=sprintf("SELECT nom_usu, pass_usu FROM usuarios WHERE nom_usu=%s AND pass_usu=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
$LoginRS = mysql_query($LoginRS__query, $conexion) or die(mysql_error());
$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;
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
<!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=iso-8859-1" />
<title>..:: Administración ::..</title>
<link href="../estilos/estilos.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="../slider/css/style.css" />
<link rel=”shortcut icon” href= ../imagenes/favicon.ico/>
<script src="../SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<link href="../SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="capa-principal">
<div id="contenido" align="center">
<p><span class="tituloform">Introduce tus datos para acceder </span><br />
</p>
<form id="form-acceso" name="form-acceso" method="POST" action="<?php echo $loginFormAction; ?>">
<table width="475" border="0" cellpadding="5" cellspacing="0" class="forminput">
<tr>
<td width="206" align="right">Usuario:</td>
<td width="245" valign="middle"><span id="user">
<input name="usuario" type="text" class="forminput" id="usuario" />
<span class="textfieldRequiredMsg">*</span></span></td>
</tr>
<tr>
<td align="right">Contraseña:</td>
<td><span id="password">
<input name="pass" type="password" class="forminput" id="pass" />
<span class="textfieldRequiredMsg">*</span></span></td>
</tr>
<tr>
<td> </td>
<td align="right"><input name="button" type="submit" class="forminput" id="button" value="Entrar" /></td>
</tr>
</table>
</form>
<br />
</div>
<div id="piepagina"></div>
</div>
<script type="text/javascript">
var sprytextfield1 = new Spry.Widget.ValidationTextField("user", "none", {validateOn:["blur"]});
var sprytextfield2 = new Spry.Widget.ValidationTextField("password", "none", {validateOn:["blur"]});
</script>
0
Puntos
Puntos
Por Ramos hace 126 meses
Principiante
Respuesta #3
perdona pero no comprendo tu código tienes 2 login en una misma pagina?
Respuesta #4
La verdad es que no....
Hay algun error que pueda afectar a la pagina?
Muchas gracias por tu interes...
Un saludo.
Hay algun error que pueda afectar a la pagina?
Muchas gracias por tu interes...
Un saludo.
0
Puntos
Puntos
Por Ramos hace 126 meses
Principiante
Respuesta #5
Tienes repetido ésto dos veces, borra una.
<?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']; } if (isset($_POST['usuario'])) { $loginUsername=$_POST['usuario']; $password=md5($_POST['pass']); $MM_fldUserAuthorization = ""; $MM_redirectLoginSuccess = "index.php"; $MM_redirectLoginFailed = "error-acceso.php"; $MM_redirecttoReferrer = false; mysql_select_db($database_conexion, $conexion); $LoginRS__query=sprintf("SELECT nom_usu, pass_usu FROM usuarios WHERE nom_usu=%s AND pass_usu=%s", GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text")); $LoginRS = mysql_query($LoginRS__query, $conexion) or die(mysql_error()); $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; if (isset($_SESSION['PrevUrl']) && false) { $MM_redirectLoginSuccess = $_SESSION['PrevUrl']; } header("Location: " . $MM_redirectLoginSuccess ); } else { header("Location: ". $MM_redirectLoginFailed ); } } ?>Es lo que observó zeuskx.