本文整理汇总了PHP中Zone::retrieveID方法的典型用法代码示例。如果您正苦于以下问题:PHP Zone::retrieveID方法的具体用法?PHP Zone::retrieveID怎么用?PHP Zone::retrieveID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zone
的用法示例。
在下文中一共展示了Zone::retrieveID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addDELEGATERecord
/**
* Add a delegation to the current zone
*
*@access private
*@param string $delegatefrom lower limit of range
*@param string $delegateto upper limit of range
*@param string $delegateuser user to delegate zone to
*@param int $ttl ttl value for this record
*@return string text of result (Adding DELEGATE Record... Ok)
*/
function addDELEGATERecord($delegatefrom, $delegateto, $delegateuser, $ttl)
{
global $db, $html, $l;
$i = 0;
$result = "";
while (list($key, $value) = each($delegatefrom)) {
if (!empty($value)) {
$result .= sprintf($l['str_primary_adding_delegate_x'], xssafe($value), xssafe($delegateto[$i])) . "... ";
if (!ereg('^[0-9]+$', $value)) {
$this->error = sprintf($l['str_primary_bad_lower_limit_x'], xssafe($value));
} else {
if (!ereg('^[0-9]+$', $delegateto[$i]) || $delegateto[$i] > 255) {
$this->error = sprintf($l['str_primary_bad_upper_limit_x'], xssafe($delegateto[$i]));
} else {
// check if lower if below upper
if (!($value <= $delegateto[$i])) {
$this->error = sprintf($l['str_primary_bad_limits_x_x'], xssafe($value), xssafe($delegateto[$i]));
} else {
if (empty($delegateuser[$i])) {
$this->error = $l['str_primary_no_user_for_delegation'];
} else {
// check if user is in DB or not
$newuserid = $this->user->RetrieveId(addslashes($delegateuser[$i]));
if ($this->user->error) {
$this->error = $this->user->error;
} else {
if (!$newuserid) {
$this->error = sprintf($l['str_primary_delegate_user_x_doesnot_exist'], xssafe($delegateuser[$i]));
} else {
// user exists
// check if items inside this range are already registered or not
$query = "SELECT val1 FROM dns_record WHERE zoneid='" . $this->zoneid . "' AND type='DELEGATE'";
$res = $db->query($query);
if ($db->error()) {
$this->error = $l['str_trouble_with_db'];
} else {
while ($line = $db->fetch_row($res)) {
list($from, $to) = split('-', $line[0]);
if ($from <= $value && $to >= $value || $from >= $value && $from <= $delegateto[$i]) {
$this->error = sprintf($l['str_primary_delegate_bad_limits_x_x_overlaps_existing_x_x'], xssafe($value), xssafe($delegateto[$i]), xssafe($from), xssafe($to));
}
}
if (!$this->error) {
$ttlval = $this->fixDNSTTL($ttl[$i]);
$query = "INSERT INTO dns_record (zoneid, type, val1, val2, ttl)\n VALUES ('" . $this->zoneid . "', 'DELEGATE', '" . mysql_real_escape_string($value . "-" . $delegateto[$i]) . "','" . mysql_real_escape_string($delegateuser[$i]) . "','" . $ttlval . "')";
$db->query($query);
if ($db->error()) {
$this->error = $l['str_trouble_with_db'];
} else {
// create zone, affect it to delegateuser
// Can NOT use standard create way because
// of EXIST check. BUG: can not insert userlog
$query = "INSERT INTO dns_zone (zone,zonetype,userid) VALUES ('" . mysql_real_escape_string($value . "-" . $delegateto[$i] . "." . $this->zonename) . "','P','" . $newuserid . "')";
$res = $db->query($query);
if ($db->error()) {
$this->error = $l['str_trouble_with_db'];
} else {
// create dns_confprimary records
// NO - user has to modify it manually
// create NS records
$nskeys = array_keys($this->ns);
while ($nskey = array_shift($nskeys)) {
$query = "INSERT INTO dns_record\n (zoneid,type,val1,val2,ttl)\n VALUES ('" . $this->zoneid . "',\n 'SUBNS','" . mysql_real_escape_string($value) . "-" . mysql_real_escape_string($delegateto[$i]) . "','" . mysql_real_escape_string($nskey) . "','" . $this->fixDNSTTL($this->nsttl[$nskey]) . "')";
$res = $db->query($query);
if ($db->error()) {
$this->error = $l['str_trouble_with_db'];
}
}
// create CNAME records
$newzone = new Zone($value . "-" . $delegateto[$i] . "." . $this->zonename, 'P', '', $newuserid);
$newzone->retrieveID($value . "-" . $delegateto[$i] . "." . $this->zonename, 'P');
for ($cnamecounter = $value; $cnamecounter <= $delegateto[$i]; $cnamecounter++) {
$query = "INSERT INTO dns_record\n (zoneid, type, val1, val2,ttl)\n VALUES\n ('" . $this->zoneid . "',\n 'CNAME', '" . $cnamecounter . "',\n '" . $cnamecounter . "." . mysql_real_escape_string($value) . "-" . mysql_real_escape_string($delegateto[$i]) . "." . $this->zonename . ".'," . "'" . $ttlval . "')";
$db->query($query);
if ($db->error()) {
$this->error = $l['str_trouble_with_db'];
}
}
// end for each CNAME
if (!$this->error) {
$result .= $l['str_primary_ok'] . "<br>\n";
}
}
}
}
// no error
}
// else db error
}
// user exists
//.........这里部分代码省略.........