Ver Mensaje Individual
  #9 (permalink)  
Antiguo 05/01/2009, 07:26
urruju
 
Fecha de Ingreso: noviembre-2008
Mensajes: 85
Antigüedad: 15 años, 5 meses
Puntos: 2
Respuesta: pekeño problemilla con un pekeño codigo php

Código PHP:
session_start();
include(
"conexion_base_datos.php"); 
<!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" xml:lang="es" lang="es">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>rincondelcodigo.com</title>
</head>
<body>

Código PHP:
if (($_POST['nick']!="") && ($_POST['password']!="")){
$registros=mysql_query("select xxx_elnick,xxx_elpassword from   
                        xxx_los_registrados"
,$conexion) or
die(
"Problemas en el select:".mysql_error());  
$verificacion=1;
while (
$reg=mysql_fetch_array($registros)){
if ((
$reg['xxx_elnick']==$_POST['nick']) && ($reg['xxx_elpassword']==$_POST['password'])){
$verificacion=$verificacion+1;
$nick=$_POST['nick']; 
$_SESSION['estado']="$nick";
echo 
"bienvenido"
}}}  if  (
$verificacion==1){ 
<form action="1.php" id="thisform" method="post">
<?php echo "Datos no validos<br>"; ?>
usuario:
<input type="text" name="nick" size="25" tabindex="1" id="name" value="
Código PHP:
 if (isset($_POST['nick'])) echo $_POST['nick']; 
" /><br>
clave:
<input type="password" name="password" id="password" size="25" tabindex="2" value="
Código PHP:
 if (isset($_POST['password'])) echo $_POST['password']; 
"/><br>
<input type="submit" value="login" class="button" tabindex="4" />
</form>
Código PHP:
 } if (($_POST['nick']=='') || ($_POST['password']=='')){ 
<form action="1.php" id="thisform" method="post">
<?php echo "Rellena los 2 campos<br>"; ?>
usuario:
<input type="text" name="nick" size="25" tabindex="1" id="name" value="
Código PHP:
 if (isset($_POST['nick'])) echo $_POST['nick']; 
" /><br>
clave:
<input type="password" name="password" id="password" size="25" tabindex="2" value="
Código PHP:
 if (isset($_POST['password'])) echo $_POST['password']; 
"/><br>
<input type="submit" value="login" class="button" tabindex="4" />
</form><?php } ?>
</body></html>