codigo php model agregaUsuario
public function addUsuarios($Name,$Last_Name,$Email,$User,$Pass,$Perfil,$Estado)
{
$statement= $this->db->prepare("INSERT INTO users(name,last_name,email,usuario,password,perfil,estado) VALUES
(:name,:last_name,:email,:user,:pass,:perfil,:estado)");
//encriptación de clave usando algortimo de encriptacion hash
$Pass_cifrado=password_hash($Pass,PASSWORD_DEFAULT);
$statement->bindParam(':name',$Name);
$statement->bindParam(':last_name',$Last_Name);
$statement->bindParam(':email',$Email);
$statement->bindParam(':user',$User);
$statement->bindParam(':pass',$Pass_cifrado);
$statement->bindParam(':perfil',$Perfil);
$statement->bindParam(':estado',$Estado);
if($statement->execute() && $statement->rowCount()>0){
$r=array("add"=>true,"msg"=>"se han agregado los datos:".$statement->rowCount());
header('Location:../Pages/add.php');
}else{
$r=array("msg"=>"No se agregaron los datos");
}
echo json_encode($r);
}
public function addUsuarios($Name,$Last_Name,$Email,$User,$Pass,$Perfil,$Estado)
{
$statement= $this->db->prepare("INSERT INTO users(name,last_name,email,usuario,password,perfil,estado) VALUES
(:name,:last_name,:email,:user,:pass,:perfil,:estado)");
//encriptación de clave usando algortimo de encriptacion hash
$Pass_cifrado=password_hash($Pass,PASSWORD_DEFAULT);
$statement->bindParam(':name',$Name);
$statement->bindParam(':last_name',$Last_Name);
$statement->bindParam(':email',$Email);
$statement->bindParam(':user',$User);
$statement->bindParam(':pass',$Pass_cifrado);
$statement->bindParam(':perfil',$Perfil);
$statement->bindParam(':estado',$Estado);
if($statement->execute() && $statement->rowCount()>0){
$r=array("add"=>true,"msg"=>"se han agregado los datos:".$statement->rowCount());
header('Location:../Pages/add.php');
}else{
$r=array("msg"=>"No se agregaron los datos");
}
echo json_encode($r);
}