Advertisement
Guest User

MIMIMI DIDDIDI

a guest
Jan 25th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. <?php
  2.  
  3. function error($str){
  4. $feedback = '<html><head></head><body>'.$str.'</body></html>';
  5. }
  6.  
  7. function success($str){
  8.  
  9. }
  10.  
  11. $db = mysqli_connect("localhost","root","","login") or die(error(mysqli_error($db)));
  12.  
  13. if($_POST['usecase'] == "login"){
  14. $username = $_POST['username'];
  15. $password = $_POST['password'];
  16. $query = "SELECT * FROM nutzer WHERE Username = '$username' AND Password = '$password'";
  17. $res = mysqli_query($db,$query) or die(error(mysqli_error($db)));
  18. $anz = mysqli_num_rows($res);
  19. var_dump($anz);
  20. }else if($_POST['usecase'] == "register"){
  21. $username = $_POST['username'];
  22. $password = $_POST['password'];
  23. $query = "INSERT INTO nutzer VALUES ('$username','$password')";
  24. $res = mysqli_query($db,$query) or die(error(mysqli_error($db)));
  25. var_dump($res);
  26. }
  27.  
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement