
31/10/2010, 07:39
|
| | Fecha de Ingreso: marzo-2006
Mensajes: 133
Antigüedad: 19 años Puntos: 6 | |
Respuesta: Error: Uso indebido de esta aplicacion index.php:
<div class="main_body2">
<h2>Inicie su sesión
</h2>
<form id="entrar" name="entrar" method="post" action="entrar.php">
<tr>
<td colspan="2" align="center"
<? if ($_GET["errorusuario"]=="si"){ ?>
bgcolor=red><span><font color="red"><b>Datos introducidos incorrectos</b></font></span>
<? }else{ ?>
<p>Indique su nombre de usuario y contraseña para acceder a la web:</p>
<? }?></td>
</tr>
<div align="center"></div>
<label>
<div align="center">
<table width="120">
<tr>
<td>Nombre:</td>
<td><input name="username" type="text" id="username" size="20" maxlength="20" /></td>
</tr>
<tr>
<td>Contraseña:</td>
<td><input name="password" type="password" id="password" size="20" maxlength="10" /></td>
</tr>
</table>
</div>
</label>
<p align="center"> </p>
<p align="center">
<label>
<input name="entrar" type="image" id="entrar" src="images/entrar.gif" value="Entrar"/>
</label>
</p>
</form>
<p align="center"> </p>
<p align="center"><a href="contrasena.php">Olvidé mi contraseña</a> | <a href="registro.php" class="Estilo1">Aún no soy usuario</a> </p>
</div> ENTRAR.PHP:
<?php
include("config.php");
include("functions/index.php");
if($_POST["entrar"]){
if($_POST["username"] && $_POST["password"]){
$contrasena = md5("$_POST[password]");
$query = mysql_query("SELECT * FROM usuarios WHERE nick='$_POST[username]' or email='$_POST[username]'");
$datos = mysql_fetch_array($query);
if($datos[contrasena] == $contrasena){
setcookie("id",$datos[id],time()+90000);
setcookie("nick",$datos[nick],time()+90000);
setcookie("contrasena",$contrasena,time()+90000);
if($index.php){
header("Location: inicio.php");
} else {
header("Location: index.php");
}
} else {
header("Location: index.php?errorusuario=si");
}
} else {
error(_CAMPOS,"1");
}
} else {
error(_USO_INDEVIDO,"1");
}
?> |