fork download
  1. //post.php
  2.  
  3. <?php
  4.  
  5. if (isset($_POST['text'])) {
  6. $db = array('host' => 'localhost', 'user' => 'root', 'pass' => '', 'name' => 'microboard');
  7. $link = mysqli_connect($db['host'], $db['user'], $db['pass'], $db['name']);
  8.  
  9. $text = $_POST['text'];
  10.  
  11. !empty($_POST['username']) ? $username = $_POST['username'] : $username = "Аноним";
  12.  
  13. $queryResult = mysqli_query($link, "INSERT INTO `microboard`.`posts` (`name`, `message`) VALUES ('$username', '$text')");
  14. }
  15.  
  16. header('Location: /index.php');
  17. ?>
  18.  
Success #stdin #stdout #stderr 0.02s 24448KB
stdin
Standard input is empty
stdout
//post.php

stderr
PHP Warning:  Cannot modify header information - headers already sent by (output started at /home/RVRhlw/prog.php:3) in /home/RVRhlw/prog.php on line 17