In the following code I insert the data and it is not being encrypted
$sentencia = $conn->prepare("insert into usuarios values(null,?,?,?,?,?,?,?,PASSWORD(?),?)");
$sentencia->bindParam(1,$dni);
$sentencia->bindParam(2,$nombre);
$sentencia->bindParam(3,$ap);
$sentencia->bindParam(4,$fec);
$sentencia->bindParam(5,$mail);
$sentencia->bindParam(6,$pro);
$sentencia->bindParam(7,$loc);
$sentencia->bindParam(8,$pass);
$sentencia->bindParam(9,$tipo);
$sentencia->execute();
I have checked it manually from database and the same code does not come out. This is my file where the pass is created.
$("#enviar").click(function(){
tipo = $("#tipo").val();
nombre = $("#nombre").val();
apellido = $("#apellidos").val();
dni = $("#dni").val();
fec = $("#fecha").val();
mail = $("#correo").val();
loc = $("#localidad").val();
pro = $("#provincia").val();
var pass = Pass();
alert(pass);
if(okapellidos && okdni && okemail && okfecha && oklocalidad && oknombre && okprovincia){
$.post("./php/insertar.php",{nombre:nombre,apellidos:apellido,dni:dni,fec:fec,pass:pass,mail:mail,loc:loc,pro:pro,tipo:tipo},function(data){
alert(data);
});
}
});
function Pass(){
var cadena = "abcdefghijklmnopqrstuvwxyz";
var num ="0123456789";
an1 = num.length-2;
an = cadena.length-4;
var palabra = cadena.substr(Math.floor(Math.random()*an),4);
palabra += num.substr(Math.floor(Math.random()*an1),2);
return palabra;
}