<?php
require_once('inc/db_connect.php');
require_once('inc/base.php');
require_once('inc/debug.php');
require_once('class/keksdata.php');
class Domain extends KeksData
{
function __construct($init = NULL)
{
$this->default_table = 'kundendaten.domains';
$this->setup();
switch (gettype($init))
{
case 'string':
$this->loadByName($init);
break;
case 'integer':
$this->loadByID($init);
break;
case 'NULL':
break;
}
}
function loadByName($name)
{
$name = mysql_real_escape_string($name);
$res = $this->getData("*", "CONCAT_WS('.', domainname, tld)='{$name}' LIMIT 1");
if (count($res) < 1)
return false;
$this->parse($res[0]);
}
function parse($data)
{
foreach (array_keys($this->data) as $key)
if (array_key_exists($key, $data))
$this->data[$key] = $data[$key];
$this->data['fqdn'] = $data['domainname'].'.'.$data['tld'];
$this->data['reg_date'] = $data['registrierungsdatum'];
$this->data['cancel_date'] = $data['kuendigungsdatum'];
}
}