update: 添加停放域名添加/删除的回调处理
This commit is contained in:
parent
2cd4637d26
commit
28c9ef0a2a
5 changed files with 198 additions and 6 deletions
|
@ -27,6 +27,12 @@ if ($status == 'ACTIVATED') {
|
|||
} else if ($status == 'CLIENTSUBDEL') {
|
||||
// 删除子域名
|
||||
require_once __DIR__ . '/subdomaindel.php';
|
||||
} else if ($status == 'CLIENTPARKADD') {
|
||||
// 添加停放域名
|
||||
require_once __DIR__ . '/parkdomainadd.php';
|
||||
} else if ($status == 'CLIENTPARKDEL') {
|
||||
// 删除停放域名
|
||||
require_once __DIR__ . '/parkdomaindel.php';
|
||||
} else if ($status == 'DELETE') {
|
||||
// 帐户已删除
|
||||
require_once __DIR__ . '/delete.php';
|
||||
|
|
90
src/callback/myownfreehost/parkdomainadd.php
Executable file
90
src/callback/myownfreehost/parkdomainadd.php
Executable file
|
@ -0,0 +1,90 @@
|
|||
<?php
|
||||
|
||||
if (!defined('IN_CRONLITE')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
$username = post('username');
|
||||
|
||||
if (!$username) {
|
||||
exit('need: username');
|
||||
}
|
||||
|
||||
$callback_log = array(
|
||||
'callback_date' => date('Y-m-d H:i:s'),
|
||||
'callback_username' => $username,
|
||||
'callback_action' => $status,
|
||||
'callback_comments' => post('comments'), // domain name
|
||||
'callback_client_id' => 0,
|
||||
'callback_raw' => json_encode(post())
|
||||
);
|
||||
|
||||
// 账号信息
|
||||
$AccountInfo = $DB->find('account', '*', array('account_username' => $username));
|
||||
if ($AccountInfo) {
|
||||
$account_id = $AccountInfo['account_id'];
|
||||
// 查找客户信息
|
||||
$ClientInfo = $DB->find('clients', 'client_email, client_fname', array('client_id' => $AccountInfo['account_client_id']));
|
||||
if ($ClientInfo) {
|
||||
$callback_log['callback_client_id'] = $AccountInfo['account_client_id'];
|
||||
$EmailTo = $ClientInfo['client_email'];
|
||||
$EmailToNickname = $ClientInfo['client_fname'];
|
||||
$EmailContent = '<p>Your hosting account has successfully added a new parked domain. The details are given bellow.</p>';
|
||||
} else {
|
||||
$EmailTo = $SiteConfig['site_email'];
|
||||
$EmailToNickname = 'Administrator';
|
||||
$EmailContent = '<p>An unassigned hosting account has successfully added a new parked domain. The details are given bellow.</p>';
|
||||
}
|
||||
} else {
|
||||
// 账号不存在,入库
|
||||
$AccountInfo = array(
|
||||
'account_username' => $username,
|
||||
'account_password' => '********',
|
||||
'account_key' => substr(str_shuffle('qwertyuioplkjhgfdsazxcvbnm012345789QWERTYUIOPLKJHGFDSAZXCVBNM'), 0, 8),
|
||||
'account_api_key' => $api_key,
|
||||
'account_domain' => '***.' . $AccountApi['api_server_domain'],
|
||||
'account_status' => '1',
|
||||
'account_date' => $callback_log['callback_date'],
|
||||
'account_client_id' => 0,
|
||||
'account_sql' => 'sql***'
|
||||
);
|
||||
$account_id = $DB->insert('account', $AccountInfo);
|
||||
|
||||
$EmailTo = $SiteConfig['site_email'];
|
||||
$EmailToNickname = 'Administrator';
|
||||
$EmailContent = '<p>An unassigned hosting account has successfully added a new parked domain. The details are given bellow.</p>';
|
||||
}
|
||||
|
||||
// 同步到本地
|
||||
$DB->insert('account_domain', array(
|
||||
'domain_account_id' => $account_id,
|
||||
'domain_name' => $callback_log['callback_comments']
|
||||
));
|
||||
|
||||
$EmailDescription = '<p><pre>' . $callback_log['callback_comments'] . '</pre></p>
|
||||
<p>The new parked domain is now available for use.</p>';
|
||||
|
||||
// 记录日志
|
||||
$DB->insert('account_callback', $callback_log);
|
||||
|
||||
$email_body = email_build_body('Hosting Account Parked Domain Added', $EmailToNickname, $EmailContent, $EmailDescription);
|
||||
|
||||
// print_r($email_body);
|
||||
|
||||
$emails_log = array(
|
||||
'email_client_id' => $AccountInfo['account_client_id'],
|
||||
'email_date' => date('Y-m-d H:i:s'),
|
||||
'email_to' => $EmailTo,
|
||||
'email_subject' => 'Hosting Account Parked Domain Added',
|
||||
'email_body' => $email_body,
|
||||
'email_read' => 0
|
||||
);
|
||||
|
||||
// print_r($emails_log);
|
||||
$DB->insert('emails', $emails_log);
|
||||
|
||||
send_mail(array(
|
||||
'to' => $EmailTo,
|
||||
'message' => $email_body,
|
||||
'subject' => 'Hosting Account Parked Domain Added'
|
||||
));
|
96
src/callback/myownfreehost/parkdomaindel.php
Executable file
96
src/callback/myownfreehost/parkdomaindel.php
Executable file
|
@ -0,0 +1,96 @@
|
|||
<?php
|
||||
|
||||
if (!defined('IN_CRONLITE')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
$username = post('username');
|
||||
|
||||
if (!$username) {
|
||||
exit('need: username');
|
||||
}
|
||||
|
||||
$callback_log = array(
|
||||
'callback_date' => date('Y-m-d H:i:s'),
|
||||
'callback_username' => $username,
|
||||
'callback_action' => $status,
|
||||
'callback_comments' => post('comments'),
|
||||
'callback_client_id' => 0,
|
||||
'callback_raw' => json_encode(post())
|
||||
);
|
||||
|
||||
// 账号信息
|
||||
$AccountInfo = $DB->find('account', '*', array('account_username' => $username));
|
||||
if ($AccountInfo) {
|
||||
$account_id = $AccountInfo['account_id'];
|
||||
|
||||
// 同步到本地
|
||||
$DB->delete('account_domain', array(
|
||||
'domain_account_id' => $account_id,
|
||||
'domain_name' => $callback_log['callback_comments']
|
||||
));
|
||||
|
||||
// 查找客户信息
|
||||
$ClientInfo = $DB->find('clients', 'client_email, client_fname', array('client_id' => $AccountInfo['account_client_id']));
|
||||
if ($ClientInfo) {
|
||||
$callback_log['callback_client_id'] = $AccountInfo['account_client_id'];
|
||||
$EmailTo = $ClientInfo['client_email'];
|
||||
$EmailToNickname = $ClientInfo['client_fname'];
|
||||
$EmailContent = '<p>Your hosting account has successfully deleted a parked domain. The details are given bellow.</p>';
|
||||
} else {
|
||||
$EmailTo = $SiteConfig['site_email'];
|
||||
$EmailToNickname = 'Administrator';
|
||||
$EmailContent = '<p>An unassigned hosting account has successfully deleted a parked domain. The details are given bellow.</p>';
|
||||
}
|
||||
} else {
|
||||
// 账号不存在,入库
|
||||
$AccountInfo = array(
|
||||
'account_username' => $username,
|
||||
'account_password' => '********',
|
||||
'account_key' => substr(str_shuffle('qwertyuioplkjhgfdsazxcvbnm012345789QWERTYUIOPLKJHGFDSAZXCVBNM'), 0, 8),
|
||||
'account_api_key' => $api_key,
|
||||
'account_domain' => '***.' . $AccountApi['api_server_domain'],
|
||||
'account_status' => '1',
|
||||
'account_date' => $callback_log['callback_date'],
|
||||
'account_client_id' => 0,
|
||||
'account_sql' => 'sql***'
|
||||
);
|
||||
$account_id = $DB->insert('account', $AccountInfo);
|
||||
|
||||
// 同步到本地
|
||||
$DB->delete('account_domain', array(
|
||||
// 'domain_account_id' => $account_id,
|
||||
'domain_name' => $callback_log['callback_comments']
|
||||
));
|
||||
|
||||
$EmailTo = $SiteConfig['site_email'];
|
||||
$EmailToNickname = 'Administrator';
|
||||
$EmailContent = '<p>An unassigned hosting account has successfully deleted a parked domain. The details are given bellow.</p>';
|
||||
}
|
||||
|
||||
$EmailDescription = '<p><pre>' . $callback_log['callback_comments'] . '</pre></p>
|
||||
<p>The parked domain is no longer usable.</p>';
|
||||
|
||||
// 记录日志
|
||||
$DB->insert('account_callback', $callback_log);
|
||||
|
||||
$email_body = email_build_body('Hosting Account Parked Domain Deleted', $EmailToNickname, $EmailContent, $EmailDescription);
|
||||
|
||||
// print_r($email_body);
|
||||
|
||||
$emails_log = array(
|
||||
'email_client_id' => $AccountInfo['account_client_id'],
|
||||
'email_date' => date('Y-m-d H:i:s'),
|
||||
'email_to' => $EmailTo,
|
||||
'email_subject' => 'Hosting Account Parked Domain Deleted',
|
||||
'email_body' => $email_body,
|
||||
'email_read' => 0
|
||||
);
|
||||
// print_r($emails_log);
|
||||
$DB->insert('emails', $emails_log);
|
||||
|
||||
send_mail(array(
|
||||
'to' => $EmailTo,
|
||||
'message' => $email_body,
|
||||
'subject' => 'Hosting Account Parked Domain Deleted'
|
||||
));
|
|
@ -67,7 +67,7 @@ $EmailDescription = '<p><pre>' . $callback_log['callback_comments'] . '</pre></p
|
|||
// 记录日志
|
||||
$DB->insert('account_callback', $callback_log);
|
||||
|
||||
$email_body = email_build_body('Hosting Account Domain Changed', $EmailToNickname, $EmailContent, $EmailDescription);
|
||||
$email_body = email_build_body('Hosting Account Subdomain Added', $EmailToNickname, $EmailContent, $EmailDescription);
|
||||
|
||||
// print_r($email_body);
|
||||
|
||||
|
@ -75,7 +75,7 @@ $emails_log = array(
|
|||
'email_client_id' => $AccountInfo['account_client_id'],
|
||||
'email_date' => date('Y-m-d H:i:s'),
|
||||
'email_to' => $EmailTo,
|
||||
'email_subject' => 'Hosting Account Domain Changed',
|
||||
'email_subject' => 'Hosting Account Subdomain Added',
|
||||
'email_body' => $email_body,
|
||||
'email_read' => 0
|
||||
);
|
||||
|
@ -86,5 +86,5 @@ $DB->insert('emails', $emails_log);
|
|||
send_mail(array(
|
||||
'to' => $EmailTo,
|
||||
'message' => $email_body,
|
||||
'subject' => 'Hosting Account Domain Changed'
|
||||
'subject' => 'Hosting Account Subdomain Added'
|
||||
));
|
||||
|
|
|
@ -74,7 +74,7 @@ $EmailDescription = '<p><pre>' . $callback_log['callback_comments'] . '</pre></p
|
|||
// 记录日志
|
||||
$DB->insert('account_callback', $callback_log);
|
||||
|
||||
$email_body = email_build_body('Hosting Account Domain Changed', $EmailToNickname, $EmailContent, $EmailDescription);
|
||||
$email_body = email_build_body('Hosting Account Subdomain Deleted', $EmailToNickname, $EmailContent, $EmailDescription);
|
||||
|
||||
// print_r($email_body);
|
||||
|
||||
|
@ -82,7 +82,7 @@ $emails_log = array(
|
|||
'email_client_id' => $AccountInfo['account_client_id'],
|
||||
'email_date' => date('Y-m-d H:i:s'),
|
||||
'email_to' => $EmailTo,
|
||||
'email_subject' => 'Hosting Account Domain Changed',
|
||||
'email_subject' => 'Hosting Account Subdomain Deleted',
|
||||
'email_body' => $email_body,
|
||||
'email_read' => 0
|
||||
);
|
||||
|
@ -92,5 +92,5 @@ $DB->insert('emails', $emails_log);
|
|||
send_mail(array(
|
||||
'to' => $EmailTo,
|
||||
'message' => $email_body,
|
||||
'subject' => 'Hosting Account Domain Changed'
|
||||
'subject' => 'Hosting Account Subdomain Deleted'
|
||||
));
|
||||
|
|
Loading…
Reference in a new issue