Ventana de confirmación!
Publicado por Quiroga (12 intervenciones) el 02/03/2010 21:04:28
Hola a todos!
Necesito de vuestra sabiduria una vez mas...
A ver, tengo una pagina principal en la que introduzco un usuario y contraseña y, dependiendo de si es correcto o no, te deja acceder al contenido de la web. El problema es que si pones en el navegador directamente el link de la web con el contenido, te saltas la pagina de registro, por lo tanto, menuda tonteria hacer que los usuarios se logueen xD
Es un proyecto para clase y creo que este fallo podrian incluso pasarmelo por alto porque no lo hemos visto, pero ya que se hacen las cosas... hagamoslas bien, no?
Os pongo el codigo si quereis.
Esta es la pagina principal, en donde te logueas:
<!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>
<style>
.shakeimage
{
position:relative
}
</style>
<script language="JavaScript1.2">
/*Implanto un script que hace que la imagen se mueva cuando pasamos el raton por encima de ella*/
var rector=4 //La intensidad del movimiento. Aumentando o disminuyendo el número.
var stopit=0
var a=1
function init(which)
{
stopit=0
shake=which
shake.style.left=0
shake.style.top=0
}
function rattleimage()
{
if ((!document.all&&!document.getElementById)||stopit==1)
return
if (a==1)
{
shake.style.top=parseInt(shake.style.top)+rector
}
else if (a==2)
{
shake.style.left=parseInt(shake.style.left)+rector
}
else if (a==3)
{
shake.style.top=parseInt(shake.style.top)-rector
}
else
{
shake.style.left=parseInt(shake.style.left)-rector
}
if (a<4)
a++
else
a=1
setTimeout("rattleimage()",50)
}
function stoprattle(which)
{
stopit=1
which.style.left=0
which.style.top=0
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Informacion sobre Skate Nacional e Internacional</title>
</head>
<body bgcolor="#000000">
<table width="100%" height="80%">
<tr>
<td valign="middle">
<div align="center"><img src="Fotos/LogoInicio2.jpg" class="shakeimage" onMouseOver="init(this);rattleimage()" onMouseOut="stoprattle(this)"/></div>
</td>
</tr>
<tr>
<td>
<div align="center">
<form action="index.php" method="post">
<font color="white">User: <input type="text" name="uss" value=""><hr width="20%"> Pass: <input type="password" name="pss" value=""/> <br /> <br />
<input type="submit" name="conectar" value="Conectar" /> <input type="submit" name="Nuevo" value="Alta usuario" /></font>
</form>
</div>
</td>
</tr>
</table>
<?php
if ($_POST['conectar']=="Conectar")
{
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("proyecto", $con);
$nombre = $_POST["uss"];
$password = $_POST["pss"];
$registros = mysql_query("Select Nombre from usuarios where Nombre = '".$nombre."' and Password = '".$password."'");
if (mysql_num_rows($registros) == 0)
{
echo "<center><font color='white'>Nombre de usuario o contraseña incorrecto.</font></center>";
}
else
{
if ($nombre == "Admin")
{
echo "<script type='text/javascript'>";
echo "window.location='Admin.php'";
echo "</script>";
}
echo "<script type='text/javascript'>";
echo "window.location='Marcos.php'";
echo "</script>";
}
mysql_close($con);
}
elseif ($_REQUEST['Nuevo']=='Alta usuario')
{
echo "<script type='text/javascript'>";
echo "window.location='Alta.php'";
echo "</script>";
}
?>
</body>
</html>
Funcionar, funciona, el problema es ese, que si pongo directamente el enlace http://localhost/proyecto/Marcos.php, me salto esto.
Gracias a todos.
Necesito de vuestra sabiduria una vez mas...
A ver, tengo una pagina principal en la que introduzco un usuario y contraseña y, dependiendo de si es correcto o no, te deja acceder al contenido de la web. El problema es que si pones en el navegador directamente el link de la web con el contenido, te saltas la pagina de registro, por lo tanto, menuda tonteria hacer que los usuarios se logueen xD
Es un proyecto para clase y creo que este fallo podrian incluso pasarmelo por alto porque no lo hemos visto, pero ya que se hacen las cosas... hagamoslas bien, no?
Os pongo el codigo si quereis.
Esta es la pagina principal, en donde te logueas:
<!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>
<style>
.shakeimage
{
position:relative
}
</style>
<script language="JavaScript1.2">
/*Implanto un script que hace que la imagen se mueva cuando pasamos el raton por encima de ella*/
var rector=4 //La intensidad del movimiento. Aumentando o disminuyendo el número.
var stopit=0
var a=1
function init(which)
{
stopit=0
shake=which
shake.style.left=0
shake.style.top=0
}
function rattleimage()
{
if ((!document.all&&!document.getElementById)||stopit==1)
return
if (a==1)
{
shake.style.top=parseInt(shake.style.top)+rector
}
else if (a==2)
{
shake.style.left=parseInt(shake.style.left)+rector
}
else if (a==3)
{
shake.style.top=parseInt(shake.style.top)-rector
}
else
{
shake.style.left=parseInt(shake.style.left)-rector
}
if (a<4)
a++
else
a=1
setTimeout("rattleimage()",50)
}
function stoprattle(which)
{
stopit=1
which.style.left=0
which.style.top=0
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Informacion sobre Skate Nacional e Internacional</title>
</head>
<body bgcolor="#000000">
<table width="100%" height="80%">
<tr>
<td valign="middle">
<div align="center"><img src="Fotos/LogoInicio2.jpg" class="shakeimage" onMouseOver="init(this);rattleimage()" onMouseOut="stoprattle(this)"/></div>
</td>
</tr>
<tr>
<td>
<div align="center">
<form action="index.php" method="post">
<font color="white">User: <input type="text" name="uss" value=""><hr width="20%"> Pass: <input type="password" name="pss" value=""/> <br /> <br />
<input type="submit" name="conectar" value="Conectar" /> <input type="submit" name="Nuevo" value="Alta usuario" /></font>
</form>
</div>
</td>
</tr>
</table>
<?php
if ($_POST['conectar']=="Conectar")
{
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("proyecto", $con);
$nombre = $_POST["uss"];
$password = $_POST["pss"];
$registros = mysql_query("Select Nombre from usuarios where Nombre = '".$nombre."' and Password = '".$password."'");
if (mysql_num_rows($registros) == 0)
{
echo "<center><font color='white'>Nombre de usuario o contraseña incorrecto.</font></center>";
}
else
{
if ($nombre == "Admin")
{
echo "<script type='text/javascript'>";
echo "window.location='Admin.php'";
echo "</script>";
}
echo "<script type='text/javascript'>";
echo "window.location='Marcos.php'";
echo "</script>";
}
mysql_close($con);
}
elseif ($_REQUEST['Nuevo']=='Alta usuario')
{
echo "<script type='text/javascript'>";
echo "window.location='Alta.php'";
echo "</script>";
}
?>
</body>
</html>
Funcionar, funciona, el problema es ese, que si pongo directamente el enlace http://localhost/proyecto/Marcos.php, me salto esto.
Gracias a todos.
Valora esta pregunta
0