Foros del Web » Programación para mayores de 30 ;) » Bases de Datos General » Mysql »

seguridad en formulario

Estas en el tema de seguridad en formulario en el foro de Mysql en Foros del Web. Hola: Estoy realizando la seguridad de mi formulario de registro para que el usuario no me ingrese caracteres extraños. He mirado algunas funciones y las ...
  #1 (permalink)  
Antiguo 30/12/2011, 12:42
 
Fecha de Ingreso: octubre-2011
Mensajes: 160
Antigüedad: 12 años, 6 meses
Puntos: 2
seguridad en formulario

Hola:

Estoy realizando la seguridad de mi formulario de registro para que el usuario no me ingrese caracteres extraños. He mirado algunas funciones y las he adaptado a mi página, pero no me funciona ninguna, no sé si es que están mal formuladas o es el botón submit (está al final del código) el que está mal, porque ingreso caracteres no permitidos, y se envía el formulario a la base de datos, ¿me podéis ayudar?. Muchas gracias.

Código 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">
<
head>
<
meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<
title>Documento sin título</title>
<
link href="estilos.css" rel="stylesheet" type="text/css" />
<
link href="registro.css" rel="stylesheet" type="text/css" />

<
script type="text/javascript">  
<!--   
function 
validatePass($nombreamo) {   
   var 
RegExPattern = /(?!^[0-9]*$)(?!^[a-zA-Z áéíóúñÑÁÉÍÓÚü]*$)^([a-zA-Z áéíóúñÑÁÉÍÓÚü 0-9]{3,25})$/;   
    var 
errorMessage 'Nombre Incorrecto.'
    return 
false    //no submit  
   
if ((campo.value.match(RegExPattern)) && (campo.value!='')) {   
   } else {   
        
alert(errorMessage);   
    }    
}   

function 
validarEmail($email) {  
if (/^
w+([.-]?w+)*@w+([.-]?w+)*(.w{2,3,4})+$/.test($email)){  
   } else {  
    
alert("La dirección de email es incorrecta."); 
    return 
false    //no submit  

 
}
}



function 
ValidaCampos($telefono)

//comprueba campo teléfono de formulario
//usa el metodo test de expresion regular

if(/^([0-9+s+-])+$/.test($telefono)) {
}
else
{
alert('El número de teléfono ingresado no es válido.');
return 
false//no submit
}
}

//-->  
</script> 


</head>

<body class="fondoregistro">
<form action="registrandose.php" method="post" enctype="multipart/form-data" id="formulario">
  <table width="1024" height="774" border="0">
    <tr>
      <td width="312" rowspan="10" >&nbsp;</td>
      <td width="349" height="90">&nbsp;</td>
      <td width="349" height="90">&nbsp;</td>
    </tr>
    <tr>
      <td height="30"><label for="pais"></label>
        <label for="ciudad"></label>
      <input name="pais" type="text" class="campotexto2" id="textfield3" maxlength="25" /></td>
      <td height="30">
        <table width="76%" border="0">
          <tr>
            <td width="50%" height="31">
            <input type="radio" class="opcionpedigri" id="radio" value="si" checked name="pedigri"/>
            <label for="si"></label></td>
            <td width="50%"><input name="pedigri" type="radio" class="opcionpedigri" id="radio2" value="no" />
            <label for="no"></label></td>
          </tr>
      </table></td>
    </tr>
    <tr>
      <td height="30">&nbsp;</td>
      <td height="30">&nbsp;</td>
    </tr>
    <tr>
      <td height="30"><label for="zona"></label>
      <input name="provincia" type="text" class="campotexto" id="textfield4" maxlength="25" /></td>
      <td height="30"><label for="telefono"></label>
      <input name="capa" type="text" class="campotexto" id="textfield11" maxlength="25" /></td>
    </tr>
    <tr>
      <td height="30">&nbsp;</td>
      <td height="30">&nbsp;</td>
    </tr>
    <tr>
      <td height="30"><label for="especie"></label>
      <input name="ciudad" type="text" class="campotexto" id="textfield5" maxlength="25" /></td>
      <td height="30"><label for="email"></label>
      <input name="nombreamo" type="text" class="campotexto" id="textfield12" maxlength="25" /></td>
    </tr>
    <tr>
      <td height="30">&nbsp;</td>
      <td height="30">&nbsp;</td>
    </tr>
    <tr>
      <td height="30"><label for="raza"></label>
      <input name="zona" type="text" class="campotexto" id="textfield6" maxlength="25" /></td>
      <td height="30"><label for="usuario"></label>
      <input name="telefono" type="text" class="campotexto" id="textfield13" maxlength="15" /></td>
    </tr>
    <tr>
      <td height="30">&nbsp;</td>
      <td height="30">&nbsp;</td>
    </tr>
    <tr>
      <td height="30"><label for="edad"></label>
      <input name="especie" type="text" class="campotexto" id="textfield7" maxlength="25" /></td>
      <td height="30"><label for="contrasenna"></label>
      <input name="email" type="text" class="campotexto" id="textfield14" maxlength="40" /></td>
    </tr>
    <tr>
      <td height="45"><label for="foto"></label>
      <input name="foto" type="file" class="foto" id="foto" size="30" /></td>
      <td height="45">&nbsp;</td>
      <td height="45">&nbsp;</td>
    </tr>
    <tr>
      <td rowspan="6">&nbsp;</td>
      <td height="30"><label for="sexo"></label>
      <input name="raza" type="text" class="campotexto" id="textfield8" maxlength="25" /></td>
      <td height="30"><label for="repcontrasenna"></label>
      <input name="usuario" type="text" class="campotexto" id="textfield15" maxlength="25" /></td>
    </tr>
    <tr>
      <td height="30">&nbsp;</td>
      <td height="30">&nbsp;</td>
    </tr>
    <tr>
      <td height="30"><label for="capa"></label>
      <input name="edad" type="text" class="campotexto" id="textfield9" maxlength="2" /></td>
      <td height="30"><label for="textfield16"></label>
      <input name="contrasenna" type="password" class="campotexto" id="textfield16" maxlength="25" /></td>
    </tr>
    <tr>
      <td height="30">&nbsp;</td>
      <td height="30">&nbsp;</td>
    </tr>
    <tr>
      <td height="31"><label for="nombreamo"></label>
        <label for="sexo"></label>
        <select name="sexo" size="1" class="campotexto" id="sexo">
          <option selected="selected">macho</option>
          <option>hembra</option>
      </select></td>
      <td height="31"><label for="textfield17"></label>
      <input name="repcontrasenna" type="password" class="campotexto" id="textfield17" maxlength="25" /></td>
    </tr>
    <tr>
      <td height="45">&nbsp;</td>
      <td><input type="submit" name="button" id="button" value="Enviar" onsubmit="return validatePass($nombreamo), validarEmail($email), ValidaCampos($telefono);"/></td>   </tr>
  </table>
</form>
</body>
</html> 
  #2 (permalink)  
Antiguo 30/12/2011, 16:31
Avatar de gnzsoloyo
Moderador criollo
 
Fecha de Ingreso: noviembre-2007
Ubicación: Actualmente en Buenos Aires (el enemigo ancestral)
Mensajes: 23.324
Antigüedad: 16 años, 5 meses
Puntos: 2658
Respuesta: seguridad en formulario

Lo siento, peor estás posteando en el foro equivocado. Tu pregunta y tu código posteado corresponderían al foro de JavaScript.
Nada de lo que has puesto tiene relación con Base de Datos, o al menos si lo tiene, no es en ese código...
__________________
¿A quién le enseñan sus aciertos?, si yo aprendo de mis errores constantemente...
"El problema es la interfase silla-teclado." (Gillermo Luque)
  #3 (permalink)  
Antiguo 31/12/2011, 02:26
 
Fecha de Ingreso: octubre-2011
Mensajes: 160
Antigüedad: 12 años, 6 meses
Puntos: 2
Respuesta: seguridad en formulario

Tomo nota, perdón por mi error.

Etiquetas: formulario, funciones, php, seguridad-php
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 16:45.