im new on this section (html php...) I have a code, is a login form, and, i want, to hide the red box of (Incorrect user or password) from the login form but i dont know how can i do this. An screenshot: http://prntscr.com/5daqsh the code is:
<head>
<meta charset="utf-8" />
<title>My Website</title>
<meta name="description" content="" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<link rel="stylesheet" href="css/bootstrap.css" type="text/css" />
<link rel="stylesheet" href="css/animate.css" type="text/css" />
<link rel="stylesheet" href="css/font-awesome.min.css" type="text/css" />
<link rel="stylesheet" href="css/font.css" type="text/css" />
<link rel="stylesheet" href="js/fuelux/fuelux.css" type="text/css" />
<link rel="stylesheet" href="css/app.css" type="text/css" />
<body background="images/login-bg.jpg">
<!--[if lt IE 9]>
<script src="js/ie/html5shiv.js"></script>
<script src="js/ie/respond.min.js"></script>
<script src="js/ie/excanvas.js"></script>
<![endif]-->
</head>
<body>
<section id="content" class="m-t-lg wrapper-md animated fadeInUp">
<div class="container aside-xxl">
<a class="navbar-brand block" href="index.html">DameFans</a>
<section class="panel panel-default bg-white m-t-lg">
<header class="panel-heading text-center">
<strong>Iniciar Sesión</strong>
</header>
<form action="" method="post" class="panel-body wrapper-lg">
<div class="form-group">
<div class="alert alert-danger">
<?php
session_start();
include_once "conexion.php";
function verificar_login($user,$password,&$result)
{
$sql = "SELECT * FROM users WHERE login='$user' and pass='$password'";
$rec = mysql_query($sql);
$count = 0;
while($row = mysql_fetch_object($rec))
{
$count++;
$result = $row;
}
if($count == 1)
{
return 1;
}
else
{
return 0;
}
}
if(!isset($_SESSION['userid']))
{
if(isset($_POST['login']))
{
if(verificar_login($_POST['user'],$_POST['password'],$result) == 1)
{
$_SESSION['userid'] = $result->id;
header("location:index.html");
}
else
{
echo '<div class="error">Su usuario es incorrecto, intente nuevamente.</div>';
}
}
?>
</div>
<label class="control-label">Email</label>
<input name="user" type="text" class="form-control input-lg">
</div>
<div class="form-group">
<label class="control-label">Contraseña</label>
<input name="password" type="password" class="form-control input-lg">
</div>
<div class="checkbox">
<label>
<input type="checkbox"> Mantener mi sesión
</label>
</div>
<a href="#" class="pull-right m-t-xs"><small>Recuperar contraseña</small></a>
<button type="submit" name="login" type="submit" value="login" class="btn btn-primary">Acceder</button>
<div class="line line-dashed"></div>
<a href="#" class="btn btn-facebook btn-block m-b-sm"><i class="fa fa-facebook pull-left"></i>Acceder vía Facebook</a>
<a href="#" class="btn btn-twitter btn-block"><i class="fa fa-twitter pull-left"></i>Acceder vía Twitter</a>
<div class="line line-dashed"></div>
<p class="text-muted text-center"><small>¿Aún no tienes cuenta?</small></p>
<a href="signup.html" class="btn btn-default btn-block">Crear cuenta ahora</a>
</form>
</section>
</div>
</section>
<div class="alert alert-success">
<?php
} else {
echo '<i class="fa fa-ban-circle"></i><strong>Ha accedido correctamente</strong> <a href="index.html" class="alert-link">Serás redirigido al panel automáticamente en breve.';
echo '<a href="logout.php">Cerrar Sesión</a><br>';
echo '<meta http-equiv="refresh" content="3;url=index.html">';
}
?>
</div>
If anyone can help me to hide the block until a user fail login in or something please :)
</div>