Guest User

Untitled

a guest
Jan 8th, 2019
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. <?php
  2. define(HOST, "localhost");
  3. define(DBNAME, "id8405819_university");
  4. define(USER, "id8405819_franff");
  5. define(PASSWORD, "");
  6. define(ROOT,"ftp://franffdatabases@files.000webhost.com/public_html/");
  7. ?>
  8.  
  9. <?php
  10. require(ROOT."Config.php");
  11. $connection = new mysqli(HOST, USER, PASS, DBNAME);
  12. if ($connection->connect_errno){
  13. die("Error de conexión: " . $connection>mysqli_connect_errno() . ", " . $connection->mysqli_connect_error());
  14. }
  15. else{
  16. echo "La conexión tuvo éxito";
  17. }
  18. ?>
  19.  
  20. <?php
  21. require(ROOT."ConnectDB.php");
  22. if ($_SERVER["REQUEST_METOHD"] == "POST")
  23. {
  24. echo $this->startSession();
  25. }
  26.  
  27.  
  28. function startSession()
  29. {
  30. if ((isset($_POST['user']) && $_POST['user'] != "") &&
  31. (isset($_POST['pass']) && $_POST['pass'] != ""))
  32. {
  33. return $this->isInBD();
  34. }
  35. }
  36.  
  37. function isInBD()
  38. {
  39. $user = $_POST["user"];
  40. $pass = $_POST["pass"];
  41. $query = "SELECT * FROM users WHERE user = '$user' AND pass = '$pass'";
  42. $result = mysqli_query($connection,$query);
  43. $conn->close();
  44. return (mysqli_num_rows($result) != 0);
  45. }
  46.  
  47.  
  48.  
  49. ?>
Add Comment
Please, Sign In to add comment