Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(isset($_POST["enviar"])){
- $usuario_entrar=$_POST["usuario_entrar"];
- $contrasenha_entrar=$_POST["contrasenha_entrar"];
- if(empty($usuario_entrar) || empty($contrasenha_entrar)){
- echo("ERRO. Debes introducir un nome de usuario e un contrasinal correctos. <br />");
- }else{
- require_once("conexion_bd.php");
- try{
- $resultado_entrar=$mysqli->stmt_init();
- $resultado_entrar->prepare("SELECT usuario, contrasenha FROM datos_personales WHERE usuario=? AND contrasenha=?");
- $resultado_entrar->bind_param("ss",$usuario_entrar,$contrasenha_entrar);
- $resultado_entrar->execute();
- $resultado_entrar->bind_result($usuario_entrar,$contrasenha_entrar);
- $fila=$resultado_entrar->fetch_rows();
- if($fila!=null){
- session_start();
- $_SESSION["usuario_entrar"]=$usuario_entrar;
- //header("Location: contenido.php");
- echo("Correcto!");
- }else{
- echo("ERRO. Usuario ou contrasinal non válidos. <br />");
- }
- }catch(Exception $mysqli_ex2){
- die("Produciuse o seguinte erro: " . "<br />" . $mysqli_ex2->getMessage() . "<br />" . $mysqli_ex2->getCode() . "<br />");
- }
- }
- }
- ?>
Add Comment
Please, Sign In to add comment