SHARE
TWEET

Untitled

a guest Sep 26th, 2016 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.   session_start();
  3.  
  4.   $connect = mysqli_connect("localhost","root","","dbvasco");
  5.  
  6.   if ( isset($_POST["user"] ) && isset( $_POST["pass"] ) ) {
  7.  
  8.   $user = $_POST['user']);
  9.   $pass = $_POST['pass']);
  10.   $pass = md5($pass);
  11.  
  12.   //consulta para obtener el usuario
  13.   $sql1 = "SELECT idUsersProfe FROM users_profesores WHERE (User='$user' OR EMail='$user') AND Passwd='$pass'";
  14.   $query=mysqli_query($connect, $sql1);
  15.   $res=mysqli_num_rows($query); //Obtene el número de filas de un resultado
  16.   $passDB = mysqli_fetch_array($res); // Obtien una fila de resultados como un array asociativo, numérico, o ambos
  17.  
  18.   if ($pass == $passDB["Passwd"]) {
  19.     $sql2 = "SELECT User FROM users_profesores WHERE (User='$user' OR EMail='$user') AND Passwd='$pass'";
  20.     $result = mysqli_query($connect, $sql2);
  21.     $num_row = mysqli_num_rows($result);
  22.  
  23.     if ($num_row == "1") {
  24.     $data = mysqli_fetch_array($result); // Obtiene una fila de resultados como un array asociativo, numérico, o ambos
  25.     $_SESSION["user"] = $data["User"];
  26.     echo "1";
  27.     } else {  //fin if num_row
  28.     echo "error";
  29.       }
  30.      } else {  //fin if pass = passDB
  31.     echo "error";
  32.       }
  33.      } else{   //fin if isset
  34.     echo "error";
  35.      }
  36.  
  37. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top