daily pastebin goal
16%
SHARE
TWEET

Untitled

a guest May 16th, 2018 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. $doc = new DOMDocument();
  3. $doc->load( 'things.xml' );
  4. $doc->formatOutput = true;
  5.  
  6. if( $_POST['clear'] ){
  7.   $thingset = $doc->getElementsByTagName("thingset")->item(0);
  8.   $new = $doc->createElement('thingset');
  9.   $doc->documentElement->replaceChild($new, $thingset);
  10. }else{
  11.   $thing = $doc->createElement('thing');
  12.   $text = $doc->createTextNode(htmlentities($_POST['thing']));
  13.   $thing->appendChild($text);
  14.   $doc->getElementsByTagName("thingset")->item(0)->appendChild($thing);
  15. }
  16.  
  17. $doc->save( 'things.xml' );
  18.  
  19. header( 'Location: things.php' );
  20.  
  21. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top