Ver Mensaje Individual
  #5 (permalink)  
Antiguo 24/09/2012, 09:01
Hanzo_lx
 
Fecha de Ingreso: septiembre-2009
Mensajes: 84
Antigüedad: 14 años, 8 meses
Puntos: 2
Respuesta: Recomendaciones/consejos a principiante

Os pego los codigos para que veais mejor

form_login.php

Cita:
<?php include("includes/top_page.php"); ?>
<?php include("includes/header.php"); ?>
<div id="contenido">
<form action ='login.php' method = 'POST'>
<table width="50%" align="center" style="background-color: #8e94a8">
<tr>
<td>
<p style="text-align: left;font-size: 20px;"><font color="white">Login</font></p>
<p style="text-align: justify;"><font color="white">Correo electronico:</font></br><input type="text" name="email" size="55"></br></br>
<font color="white">Password:</font></br><input type="password" name="password" size="55"></p></br>
<p align="right"><a href="form_register.php" align="center">Registrarse</a>&nbsp;<input type="submit" value="Entrar"></p>
</td>
</tr>
</table>

</form>


</div>
<?php include("includes/footer.php"); ?>
login.php

Cita:
<?php include("includes/functions.php"); ?>
<?php include("includes/top_page.php"); ?>
<?php include("includes/header.php"); ?>

<div id="contenido">
<?php

session_start();
$email = $_POST['email'];
$password = $_POST['password'];

if ($email && $password) {

$query = mysql_query("SELECT * FROM users WHERE email='$email'");


$numrows = mysql_num_rows($query);
if ($numrows != 0) {

while ($row = mysql_fetch_assoc($query)) {
$dbemail = $row['email'];
$dbpassword = $row['password'];
$dbusername = $row['Nombre'];

}
if ($email == $dbemail && md5($password) == $dbpassword) {
$_SESSION['email'] = $dbemail;
$_SESSION['email'] = $dbemail;
echo "Conexion realizada con exito. Se le redirigira automaticamente a su pagina de usuario. Si no pulse ";echo '<a href="description.php" target="_parent">aqui.</a>';

header("Location: description.php");

}
else
echo "Incorrect passwd";
}
else
echo "user not exits";
}
else
echo "Introduce user y passwd";
?>
</div>
<?php include("includes/footer.php"); ?>
top_page.php

Cita:
<?php session_start()?>
<!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=utf-8" />
<title>pagina prueba</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="wrapper">
header.php

Cita:
<?php
session_start()
?>

<div id="header">
</div>
<div id="menu">
<table>
<tr>
<td width="400" align="left">&nbsp;<a href="index.php" align="center">Inicio</a>&nbsp;&nbsp;|&nbsp;&nbsp;
<a href="description.php" align="center">Descripcion</a>&nbsp;&nbsp;|&nbsp;&nbsp;
<a href="#" align="center">C&aacute;lculo</a>&nbsp;&nbsp;|&nbsp;&nbsp;
<a href="contact.php" align="center">Contacto</a>&nbsp;&nbsp;|&nbsp;&nbsp;</td>
<!-- <td width="400" align="right"><a href="description.php" align="left">Mi Cuenta</a>&nbsp;</td>-->
<td width="400" align="right">
<?php if(isset($_SESSION['email'])) echo '<a href="userarea.php" target="_parent">'.$_SESSION['email'].'</a>';
else echo '<a href="form_login.php" target="_parent">Mi cuenta</a>';
?>
</td>
</tr>
</table>


</div>
footer.php

Cita:
<div id="footer">
<p>info </br>
</p>


</div>
</div>
</body>
</html>
functions.php

Cita:
<?php

$conexion = mysql_connect("localhost", "root", "fommysql") or die("Error conectando con la Base de Datos");
mysql_select_db("clt_fom", $conexion) or die("No se ha podido encontrar la BD");
?>
Que conste que he buscado info sobre el error este y es una pesadilla