Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(isset($_POST['crear']))
- {
- include 'conexiondb.php'; //this is the file where I connect the database, the variable that sets up the connection is called $conexion
- $email = mysqli_real_escape_string($conexion, $_POST['email']); //el método previene que se haga SQL injection
- $username = mysqli_real_escape_string($conexion, $_POST['username']);
- $password = mysqli_real_escape_string($conexion, $_POST['password']);
- $nombre = mysqli_real_escape_string($conexion, $_POST['nombre']);
- $apellido = mysqli_real_escape_string($conexion, $_POST['apellido']);
- $municipio = mysqli_real_escape_string($conexion, $_POST['municipio']);
- //after this I make a bunch of validations, that seem to work fine
- //after all values are checked, I want to insert them into my database
- $passwordHash = password_hash($password, PASSWORD_DEFAULT);
- mysqli_query($conexion, "INSERT INTO persona (correopersona, usernamepersona, passwordpersona, nombrepersona, apellidopersona, nombremunicipio) VALUES ('$email', '$username', '$passwordHash', '$nombre', '$apellido', '$municipio')");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement