<? // constants // creates empty jNivo Server List (jNsl) function createServerList($filename, $owner) { $dom = new DOMDocument(XML_VERSION, ENCODING); $root = $dom->createElement('serverList',''); $root->setAttribute('owner', $owner); $root->setAttribute('link', __FILE__); $dom->appendChild($root); $result = $dom->save($filename); if($result==false) { return "ERROR: Cannot create file."; } else { return "Created file at " . $filename . " - " . $result . " bytes."; } } // creates jNivo server node function createServerNode($name, $description, $ip, $country, $language, $webmaster) { $dom = new DOMDocument(XML_VERSION, ENCODING); $root = $dom->createElement('server',''); $root->setAttribute('name', $name); $root->setAttribute('description', $description); $root->setAttribute('country', $country); $root->setAttribute('language', $language); $root->setAttribute('webmaster', $webmaster); $root->setAttribute('ip', $ip); return $root; } // adds Server node to server list function addServer($serverNode, $serverListFile) { $dom = new DOMDocument(XML_VERSION, ENCODING); $dom->load($serverListFile); //print_r($serverListFile); $serverList = $dom->getElementsByTagName("serverList"); $server = $serverList->item(0); $server->appendChild($serverNode); //print_r($server); //print_r($serverListFile); $result = $dom->save($serverListFile); if($result==false) { return "ERROR: Cannot append server."; } else { return "Server appended at " . $serverListFile . ""; } } //------------------------------------------------------------------------------------------ $node = createServerNode('Server1', 'TesT', '0.0.0.0', 'USA', 'en-us', 'webmaster@aol.com'); ?>
Prosze pomozcie mi, poniewaz to czesc projetku ktory musze oddac w czwartek
