Ver Mensaje Individual
  #5 (permalink)  
Antiguo 20/07/2011, 23:05
guillermo90
 
Fecha de Ingreso: julio-2009
Mensajes: 104
Antigüedad: 14 años, 9 meses
Puntos: 0
Respuesta: Inicio de sesion y volver a la pagina actual

Cita:
Iniciado por Artificium Ver Mensaje
Lo que debes hacer es capturar el nombre del archivo de la página en que se está actualmente. Eso se puede lograr de varias formas, pero te puedo decir que podría ser mediante sesiones. Creas una variable de sesión, digamos "actual" y en cada página le das el valor del nombre del archivo correspondiente. Digamos, si estamos en la pagina perfiles.php, la darías ese valor, así:

$_SESSION['actual'] = 'perfiles.php';

Entonces, cuando logueas, haces un redirecionamiento mediante header, debes enviar el form de logueo a un archivo que no haga más que loguear y redireccionar así:

header("location: '" . $_SESSION['actual'] . "'");

Esa es la idea, espero que te sirva. Suerte!
Hice lo que me digiste pero no funciona, mira aca te paso el codigo con el cambio que vos me mencionaste:

Codigo cabecera:

<?php
include_once("../includes/procs.php");
if (!empty($_SESSION['idusuario'])) $idusuario=limpia($_SESSION['idusuario']);
if (!empty($_SESSION['nombre'])) $nombre=limpia($_SESSION['nombre']);
if (!empty($_SESSION['apellido'])) $apellido=limpia($_SESSION['apellido']);
if (!empty($_SESSION['usuario'])) $usuario=limpia($_SESSION['usuario']);
if (!empty($_SESSION['ultimoingreso'])) $ultimoingreso=limpia($_SESSION['ultimoingreso']); else $ultimoingreso=date('Y-m-d H:i:s');;
?>
<!--<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>-->
<!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><?php echo nombre_empresa();?></title>
<link href="stylo0.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.Estilo3 {color: #0000CC}
-->
</style>
</head>
<body>
<!--#include file="../includes/procs.php"-->

<table width="825" height="162" align="center" class="pagina">
<tr>
<td height="156"><table width="821" height="122" align="center">
<tr>
<td width="63" height="116" align="left" valign="top">&nbsp;</td>
<td width="163" align="left" valign="top"><object width="163" height="114" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0">
<param name="movie" value="../images/argentina.swf" />
<param name="quality" value="high" />
<param name="menu" value="false" />
<param name="wmode" value="transparent" />
<embed width="163" height="114" quality="high" wmode="transparent" menu="false" src="../images/argentina.swf"
pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" />
</object></td>
<td width="512" align="left" valign="top">
<?php
header("location: '" . $_SESSION['actual'] . "'"); ------------------> AQUI MODIFIQUE

?>
<div align="center">
<p>
<?php


if (empty($idusuario)) {
if (strtoupper(substr($_SERVER['REQUEST_URI'],-19))<>"DATOSPERSONALES.PHP")
{
echo "<label>Usuario <input type='text' name='usuario' id='usuario'/></label>";
echo "<label>Clave <input type='password' name='contrasena' id='contrasena'/></label>";
echo "<label><input name='Submit' type='submit' value='Entrar'/></label>";
echo "<br/>";
echo "<a href='datospersonales.php' class='linkeos'>Usuario nuevo</br> <a href='datospersonales.php' class='linkeos'>
</br>";
}
echo "<a href='viasdecontacto.php' class='linkeos'>Contacto</a> <a href='viasdecontacto.php' class='linkeos'></a>";
echo "<a href='catalogodepuntos.php' class='linkeos'>Catalogo de puntos</a> <a href='catalogodepuntos.php' class='linkeos'></a>";
echo "<a href='beneficios.php' class='linkeos'>Beneficios</a> <a href='beneficios.php' class='linkeos'></a>";
echo "<a href='precios.php' class='linkeos'>Precios</a> <a href='precios.php' class='linkeos'></a>";
if (strtoupper(substr($_SERVER['REQUEST_URI'],-9))<>"INDEX.PHP")
echo "<a href='index.php' class='linkeos'>Inicio</a></td>";
}
else
{
//#FCF1B6
//#CCCCCC
echo "<font color='#FF0000' size=4 bgcolor='#CCCCCC'>".$usuario." (".$nombre." ".$apellido."-".$idusuario.")</font>";
echo "<br>";
echo "<font color='#FF0000' size=4 bgcolor='#CCCCCC'>"." Ultimo Ingreso a las ".substr($ultimoingreso,-8)." del ".substr($ultimoingreso,8,2)."/".substr($ultimoingreso,5,2)."/".substr($ultimoingreso,0,4)."</font>";
echo "<br/>";
echo "<br/>";
echo "<table width='322'>";
echo "<tr>";
echo "<td align='center' class='linkeos_3'><a href='datospersonales.php' >Mi ".nombre_empresa()."</a></td>";
if (strtoupper(substr($_SERVER['REQUEST_URI'],-9))<>"INDEX.PHP")
echo "<td align='center' class='linkeos_3'><a href='index.php'>Inicio </a></td>";
echo "<td align='center' class='linkeos_3'><a href='desconexion.php'>Desconexion</a></td>";
echo "</tr>";
echo "</table>";
}
?>
</div>
</form>
<td width="63" align="center" valign="top">
<?php
if (!empty($idusuario)) {
echo "<td>";
$foto=(file_exists('../fotos/usuario_'.$idusuario.'.jpg')?'../fotos/usuario_'.$idusuario.'.jpg':'../fotos/usuario_0.jpg');
echo "<img src=$foto"." name='foto' width='180' height='130' id='foto' /></td>";
}
?>


<!-- &nbsp;-->
</td>
</tr>
</table>

<table width="821" height="32" align="center"class="divs1">
<tr>
<td width="28" height="26" align="center" valign="middle">&nbsp;</td>
<td width="610" align="center" valign="middle"><form id="form2" name="form2" method="post" align="center" action="publicaciones.php">
&iquest;Que estas buscando?
<input type="text" name="busqueda" size="49" />
<input name="Submit2" type="submit" class="botones1" value=" Buscar " />
</form>
</td>
<td width="135" align="center"><form id="form3" name="form3" method="post" align="center" action="busquedaavanzada.php"><input name="Submit3" type="submit" class="botones1" value="Busqueda avanzada"/>
</form>
<td width="28" align="center">
</tr>
</table>

</td>
</tr>
</table>
</body>
</html>