hola a todos,
necesito que me corrijáis mi sistema de logueo, cuando pincho a enviar lo unico que me hace es recargar la propia pagina. en la pestaña contactar es donde tengo el formlario para introducir los datos.
os dejo los documentos.
portada.php
Código PHP:
Ver original<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF8">
<title>CASA DE PERROS</title>
<LINK REL
="stylesheet" TYPE
="text/css" HREF
="cssportada.css">
<script>
window.onload=function(){
document.getElementById("sitio").onclick=function (){mostrar(this);};
document.getElementById("conocenos").onclick=function (){mostrar(this);};
document.getElementById("Adopta").onclick=function (){mostrar(this);};
document.getElementById("abandona").onclick=function (){mostrar(this);};
}
function mostrar(menu){
objCaja=document.getElementById("caja");
switch (menu.id){
case "sitio":
break;
case "conocenos":
break;
case "Adopta":
break;
case "abandona":
objCaja.innerHTML = "<div id='texto3'><h2>¿NO PUEDE HACERSE CARGO DE SU PERRO?</h2></br></br></br>Para rellenar el formulario <a href='formularioperrospendiente.html'><u>PINCHA AQUÍ</u></a></br></br></div>";
objCaja.innerHTML +="<div id='login' align='right'></br><b>Iniciar Sesión</b></br></br><form name='form1' method='post' action='entrar2.php'>Username: <input type='text' placeholder='Correo electronico...' name='username'/></br></br>Password: <input type='text' placeholder='Clave de acceso...' name='password'/></br></br><INPUT name='submit' type='submit' value='Enviar'></form><\div>";
break;
default:
return false;
break;
}
}
</script>
</head>
<body>
<form>
<div id="titulo" style="font-size: 250%;"> CASA DE PERROS </div>
<br/><br/>
<div id="botones">
<input type="button" value="¿Dónde estámos? " id="sitio" class="Perrera" />
<input type="button" value="¿Quienes somos?" id="conocenos" class="Perrera" />
<input type="button" value="Adopta un perro" id="Adopta" class="Perrera" />
<input type="button" value="Contactar" id="abandona" class="Perrera" />
</div>
<div id="caja">
</div>
</form>
</body>
</html>
base de datos:
entrar2.php
Código PHP:
Ver original<?PHP
// Configura los datos de tu cuenta
$dbhost='localhost';
$dbusername='root';
$dbuserpass='';
$dbname='proyectoPerrera';
// Conectar a la base de datos
if ($_POST['username']) {
//Comprobacion del envio del nombre de usuario y password
$username=$_POST['username'];
$password=$_POST['password'];
if ($password==NULL) {
echo "La password no fue enviada";
}else{
if($data['contrasenia'] != $password) {
echo "Login incorrecto";
}else{
$_SESSION["s_nombre"] = $row['nombre'];
echo "Has sido logueado correctamente ".$_SESSION['s_nombre']." y puedes acceder al index.php.";
}
}
}
?>
Código CSS:
Ver originalbody {
background: url(fondo6.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
a {
color: black;
text-decoration:none;
}
h1 {
color: black;
text-decoration: underline;
}
h3 {
TEXT-ALIGN:center;
color: black;
text-shadow: 5px 5px 5px #A4A4A4;
}
#titulo {
text-align: center;
text-shadow: 5px 5px 5px #585858;
width:340px;
margin: auto auto;
margin-top:30px;
padding-bottom:30px;
}
#caja {
display: block;
border-radius: 15px 15px 15px 15px;
border: solid black 3px;
width: 1207px;
height: auto;
margin: auto auto;
padding-left:12px;
padding-right:12px;
padding-bottom:30px;
background-color:#CED8F6;
}
#botones {
width: 1238px;
height: auto;
margin: auto auto;
}
.Perrera {
background-color: black;
color: white;
border-radius: 8px 8px 8px 8px;
width:200px;
height: 25px;
}
#mapa {
margin-left:600px;
margin-top:-300px;
margin-bottom:12px;
border-style: solid;
}
#imagen {
margin-left:600px;
margin-top:-300px;
margin-bottom:12px;
border-style: solid;
}
#texto {
position:left;
margin-left:70px;
margin-right:600px;
padding-right:12px;
}
#texto2 {
position:left;
margin-left:70px;
margin-right:600px;
padding-right:12px;
}
#texto3 {
position:left;
margin-left:70px;
margin-right:500px;
padding-right:12px;
}
#texto4 {
position:left;
margin-right:600px;
margin-left:70px;
padding-right:12px;
}
#texto5 {
margin-left:670px;
margin-top:-228px;
margin-bottom:12px;
width: 600px;
height: auto;
}
#col_der {
float: right;
width: 33%;
height: 190px;
padding-top:20px;
padding-bottom:20px;
background-color: white;
text-align: center;
margin:0 auto;
background-color:#CED8F6;
}
#col_izq {
float: left;
width: 33%;
height: 190px;
padding-top:20px;
padding-bottom:20px;
background-color: white;
text-align: center;
margin:0 auto;
background-color:#CED8F6;
}
#col_cen {
height: 190px;
padding-top:20px;
padding-bottom:20px;
background-color: white;
text-align: center;
margin:0 auto;
background-color:#CED8F6;
}
#col_der_texto1 {
float: right;
width: 33%;
height: auto;
background-color:#CED8F6;
}
#col_izq_texto2 {
float: left;
width: 33%;
height: auto;
background-color:#CED8F6;
}
#col_cen_texto3 {
height: auto;
background-color:#CED8F6;
}
#imgpequenio {
border-style: solid;
border-color: black;
}
#imgmediano {
border-style: solid;
border-color: black;
}
#imggrande {
border-style: solid;
border-color: black;
}
#todos_los_perros_texto {
text-align: center;
}
#todos_los_perros {
border-style: solid;
margin: auto auto;
width:1000px;
}
#login{
display: block;
background-color: #FFFFFF;
margin-left:850px;
margin-top:-200px;
margin-bottom:12px;
width:340px;
height: 190px;
border-radius: 15px 15px 15px 15px;
border: solid black 1px;
TEXT-ALIGN:center;
}