add_use.php 989 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. $host = "kurek620.beget.tech";
  3. $username = "kurek620_baze";
  4. $password = "6910WASD579h";
  5. $database = "kurek620_baze";
  6. $mysql = new mysqli($host, $username, $password, $database);
  7. if($mysql->connect_error){
  8. die("Ошибка подключения". $mysql->connect_error);
  9. }
  10. $id = $_POST["id1"];
  11. $FIO = $_POST["FIO"];
  12. $region = $_POST["region"];
  13. $login = $_POST["login"];
  14. $Email = $_POST["Email"];
  15. $passwor = $_POST["password"];
  16. $query = "INSERT INTO Users (`FIO`, `region`, `login`, `Email`, `password`)
  17. VALUES ('$FIO', '$region', '$login', '$Email', '$passwor')";
  18. $result = $mysql->query($query);
  19. if(!$result){
  20. echo "Что то не так" . $mysql->error;
  21. }
  22. else{
  23. $query1 = "DELETE FROM ZUsers WHERE id = $id";
  24. if ($mysql->query($query1) === TRUE) {
  25. echo "<script>window.location.href = 'admin_page.php';</script>";
  26. } else {
  27. echo "Ошибка при удалении записи: " . $mysql->error;
  28. }
  29. }
  30. ?>