new.php 311 B

1234567891011121314151617
  1. <?php
  2. require 'app.php';
  3. $type = $_GET['type'];
  4. $name = $_POST['name'];
  5. if (!hasPermission("new.$type")) {
  6. die("Not enough permissions.");
  7. }
  8. $sql = "INSERT INTO $type SET name='$name'";
  9. if($conn->query($sql)) {
  10. echo "Successfully created new $type!";
  11. } else {
  12. echo $conn->lastErrorMsg();
  13. }
  14. ?>