Guest User

Untitled

a guest
May 6th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. <?php
  2. include 'connection.php';
  3.  
  4. $name = $sbname = $sex = $age = $nasc = $email = $site = "";
  5.  
  6. if (isset($_POST['enviar'])){
  7.  
  8. $name = $_POST['form_nm'];
  9. $sbname = $_POST['form_sobnm'];
  10. $sex = $_POST['form_sex'];
  11. $age = $_POST['form_age'];
  12. $nasc = $_POST['form_nasc'];
  13. $email = $_POST['form_email'];
  14. $site = $_POST['form_site'];
  15.  
  16. $query = "INSERT INTO pessoas(nome, sobrenome, sexo, idade, nascimento,
  17. email, website) VALUES ($name, $sbname, $sex, $age, $nasc, $email, $site)";
  18. mysqli_query($link,$query);
  19. }
  20. header('location:../index.php');
  21. ?>
  22.  
  23. <?php
  24.  
  25. $data = parse_ini_file("config.ini");
  26.  
  27. $link = mysqli_connect($data['host'], $data['username'],
  28. $data['password'], $data['database']);
  29.  
  30. if(mysqli_connect_error()){
  31. die("Unable to connect to database! Error: " .
  32. mysqli_connect_error());
  33. }
  34.  
  35. ?>
  36.  
  37. [SERVER_DATA]
  38.  
  39. host = 'localhost';
  40. username = 'root';
  41. password = '';
  42. database = 'atividade_ecomp';
Add Comment
Please, Sign In to add comment