Current File : /home/bassmoto/public_html.oct5/addnew.php |
<?php
//stripslashes
//$headline = stripslashes($headline);
//$name = stripslashes($name);
//$email = stripslashes($email);
//$abstract = stripslashes($abstract);
//$keywords = stripslashes($keywords);
//create document root
$doc = new DomDocument('<?xml version="1.0" encoding="utf-8"?><vehicle/>');
//$root_vehicle = $doc->createElement('vehicle');
//$doc->appendChild($list_of_teams);
//add ID attribute
//FIRST, let's make sure that the id they chose isn't going to overwrite a file!
$dh = opendir('./xml/');
while ($file = readdir($dh)){
$string = $id . ".xml";
if (eregi("^\\.\\.?$", $file)) {
continue;
}
// if (eregi($string, $file)){
// $time = date("U"); //number of seconds since unix epoch
// $id = $id . "-" . $time;
// }
}
//Create a attribute
//$newid = $doc ->createAttribute('id');
//append the new attribute node into the employee element
//$root_vehicle -> appendChild($newid);
//$root->set_attribute('id', $id);
//create headline
$vname = $doc->createElement('vname');
$root_vehicle->appendChild($vname);
$price = $doc->create_element("price");
$price = $root->append_child($price);
$htext = $doc->create_text_node($price);
$htext = $head->append_child($htext);
//write to the file
$filename = "./xml/".$id . ".xml";
$doc->dump_file($filename, false, true);
?>