Advertisement
Guest User

autentificare.php

a guest
Oct 16th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.66 KB | None | 0 0
  1. <?php
  2. $link = mysqli_connect("localhost", "root", "lab223", "world");
  3.  
  4. if (!$link) {
  5.     echo "Error: Unable to connect to MySQL." . PHP_EOL;
  6. }
  7. else echo 'Succes <br>';
  8. echo 'sunt in validare';
  9. //print_r($_POST);
  10. $user = $_POST['username'];
  11. $password = $_POST['password'];
  12.  
  13. echo '<br>'.$user.' '.$password;
  14.  
  15. $cerere = "select count(*) from users where username = '".$user."' and password = sha1('".$password."')";
  16.  
  17. $result = mysqli_query($link, $cerere);
  18.  
  19. $row = mysqli_fetch_row($result);
  20.  
  21. if($row[0] > 0) {
  22. echo 'Autentificare cu succes';}
  23. else {header("Location: http://localhost/"); exit;}
  24.     mysqli_free_result($result);
  25.  
  26.  
  27.  
  28. mysqli_close($link);
  29. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement