function addLink($name, $address)
{
require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "settings.class.php";
$settings = new settings();
if ($settings::db_driver == "xml") {
// XML
$links = simplexml_load_file($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "data" . DIRECTORY_SEPARATOR . "links.xml");
$link = $links->addChild('link', '');
$link->addChild('name', $name);
$link->addChild('address', $address);
$dom = dom_import_simplexml($links)->ownerDocument;
$dom->formatOutput = TRUE;
file_put_contents($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "data" . DIRECTORY_SEPARATOR . "links.xml", $dom->saveXML());
} else {
// PDO
require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "common.class.php";
$common = new common();
$dbh = $common->pdoOpen();
$sql = "INSERT INTO " . $settings::db_prefix . "links (name, address) VALUES (:name, :address)";
$sth = $dbh->prepare($sql);
$sth->bindParam(':name', $name, PDO::PARAM_STR, 100);
$sth->bindParam(':address', $address, PDO::PARAM_STR, 250);
$sth->execute();
$sth = NULL;
$dbh = NULL;
}
}