Foros del Web » Programando para Internet » PHP »

ayuda

Estas en el tema de ayuda en el foro de PHP en Foros del Web. Hola de nuevo , quiero proteger esta pagina para que no se ingrese si esta registrado o no , este es el codigo y me ...
  #1 (permalink)  
Antiguo 20/06/2004, 00:42
 
Fecha de Ingreso: mayo-2004
Mensajes: 195
Antigüedad: 19 años, 11 meses
Puntos: 0
ayuda

Hola de nuevo , quiero proteger esta pagina para que no se ingrese si esta registrado o no , este es el codigo y me sale este error

<html>
<body bgcolor="#5F7BA9">
<?

session_start();
if ($nombre_usuario!="" && $nivel_usuario==2)
{
?>
<?
if($_COOKIE["unick"] ) {
?>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
Panel de usuario de <b><? echo $_COOKIE["unick"] ?></b><p align="center"><br>
<? include("config.php") ;
$resp = mysql_query("select id from usuarios where nick='$_COOKIE[unick]'") ;
$datos = mysql_fetch_array($resp) ;
if(mysql_num_rows($resp) != 0) {
echo "<div align=\"center\"><img src=\"eforo_imagenes/avatares/$datos[id].$datos[avatar]\" width=\"50\" height=\"50\" border=\"0\"></div>" ;
}
?>
</p>
<form name="form1"><table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="18%"><div align="center"><a href="uperfil.php"><img src="info.gif" width="49" height="50" border="0"></a></div></td>
<td width="28%"><div align="center"><a href="mensajes.php"><img src="messages.gif" width="49" height="50" border="0"></a></div></td>
<td width="27%"><div align="center"><img src="home.gif" width="49" height="48"></div></td>
<td width="27%"><div align="center"><a href="usalir.php"><img src="exit.gif" width="48" height="49" border="0"></a></div></td>
</tr>
<tr>
<td><div align="center"><strong><a href="uperfil.php">Editar perfil </a></strong></div></td>
<td>
<div align="center"><strong><a href="mensajes.php">Mensajes privados</a></strong></div></td>
<td><div align="center">

<select name="menu1" onChange="MM_jumpMenu('parent',this,0)" class="form">
<option selected>Enviar:</option>
<option value="descarga.php">&gt;&gt; Descarga</option>
<option value="comentario.php">&gt;&gt; Comentario</option>
</select>

</div></td>
<td><div align="center"><strong><a href="usalir.php">Desconectar</a></strong></div></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><div align="center">Tiene
<?
include("config.php") ;
$usuario = $HTTP_COOKIE_VARS[unick] ;
$resp = mysql_query("select id from mensajes where nuevo='0' and destinatario='$usuario'") ;
$mensajes = mysql_num_rows($resp) ;
mysql_free_result($resp) ;
mysql_close($conectar) ;
if($mensajes == 0) { echo "0"
?>
<?
}
else {
?>
<script>
function BlinkTxt() {
texto = document.getElementsByTagName('blink');
for (i=0; i<texto.length; i++)
if (texto[i].style.visibility=='hidden') {
texto[i].style.visibility='visible';
} else {
texto[i].style.visibility='hidden';
}
setTimeout('BlinkTxt()',100);
}
onload=BlinkTxt;
</script>
<blink>(<? echo $mensajes ; ?>)</blink>
<?
}
?>
mensajes nuevos </div></td>
<td><div align="center">
</div></td>
<td>&nbsp;</td>
</tr>
</table> </form>
<table width="99%" border="0" align="center" cellpadding="3" cellspacing="1">
<tr class="4477444441">
<td width="24%"><div align="center" class="Estilo1"><b>Usuarios on-line </b></div></td>
</tr>
<tr class="4477444441">
<td valign="top" class="33334477444441"><? include("uenlinea.php"); ?>&nbsp;</td>
</tr>
</table>
</p>
<?
}
else {
?>
</div>
<form method="post" action="uentrar.php">
<div align="center">Nick:<br>
<input name="nick" type="text" class="form">
<br>
Contraseña:<br>
<input name="contrasena" type="password" class="form">

<br>
<br>
<input type="submit" name="entrar" value="Entrar" class="form">
<input type="hidden" name="pagina" value="<? echo $_SERVER['REQUEST_URI'] ?>">
</div>
</form>

<a href="?id=uregistrar">· Registrate</a><br>
<a href="?id=ucontrasena">· ¿Olvide contraseña?</a><br>
<br> ¿Todavía no tienes una cuenta? Puedes <a href="index.php?id=uregistrar">crearte
una</a>. Como usuario registrado tendrás ventajas como cambiar tu
perfil, responder comentarios con tu propio nick y enviar enlaces,
descargas y scripts.<br>
<?
}
?>

Parse error: parse error, unexpected $end in C:\xampp\htdocs\diicc3\usuarios\mensajes.php on line 215
  #2 (permalink)  
Antiguo 21/06/2004, 00:27
Avatar de Torus  
Fecha de Ingreso: enero-2002
Ubicación: Tú buscame y me encontraras
Mensajes: 413
Antigüedad: 22 años, 3 meses
Puntos: 0
Hola ¿Has revisado los cierres de los if y de los else ?(})
Saludos
__________________
Hay tanto que aprender y tan poco tiempo
  #3 (permalink)  
Antiguo 21/06/2004, 06:21
 
Fecha de Ingreso: mayo-2004
Mensajes: 195
Antigüedad: 19 años, 11 meses
Puntos: 0
Hola , gracias por responder la verdad es que lo he revisado pero no encuentro el error de los cierres de los if y else.
  #4 (permalink)  
Antiguo 21/06/2004, 06:53
Avatar de Torus  
Fecha de Ingreso: enero-2002
Ubicación: Tú buscame y me encontraras
Mensajes: 413
Antigüedad: 22 años, 3 meses
Puntos: 0
Hola a "vuelapluma" he encontrado lo que sigue:
if($mensajes == 0) { echo "0"
y tendria que ser:
if($mensajes == 0) { echo "0";
Ten encuenta que PHP es muy puntilloso con los ;
Saludos
__________________
Hay tanto que aprender y tan poco tiempo
  #5 (permalink)  
Antiguo 21/06/2004, 13:28
 
Fecha de Ingreso: mayo-2004
Mensajes: 195
Antigüedad: 19 años, 11 meses
Puntos: 0
Hola Torus:

Vale gracias nuevamente lo voy a probar y te cuento que paso

Saludos.

Zack.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 19:24.