update callback api
This commit is contained in:
parent
39aa23f045
commit
3a2872da2c
14 changed files with 42 additions and 47 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,4 +1,5 @@
|
|||
.DS_Store
|
||||
Thumbs.db
|
||||
test/
|
||||
install.lock
|
||||
install.lock
|
||||
log.txt
|
|
@ -90,7 +90,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<a href="myssl.php">
|
||||
<a href="ssl.php">
|
||||
<div class="panel-footer">
|
||||
<span class="pull-left"><?php echo $lang->I18N('View details'); ?></span>
|
||||
<span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
|
||||
|
|
|
@ -1,36 +1,3 @@
|
|||
<?php
|
||||
|
||||
require_once __DIR__ . '/../core/application.php';
|
||||
$path_array = explode('/', trim($path_info, '/'));
|
||||
|
||||
if (!$path_array || count($path_array) < 2) {
|
||||
exit('401 Unauthorized');
|
||||
}
|
||||
|
||||
if (!isset($path_array[0]) || empty($path_array[0])) {
|
||||
header("status: 401");
|
||||
exit('401 Unauthorized');
|
||||
}
|
||||
|
||||
if (!isset($path_array[1]) || empty($path_array[1])) {
|
||||
header("status: 401");
|
||||
exit('401 Unauthorized');
|
||||
}
|
||||
|
||||
$api_key = $path_array[0];
|
||||
$token = $path_array[1];
|
||||
|
||||
$AccountApi = $DB->find('account_api', '*', array('api_key' => $api_key), null, 1);
|
||||
|
||||
if (!$AccountApi) {
|
||||
exit('Not Found');
|
||||
}
|
||||
|
||||
if ($token != $AccountApi['api_callback_token']) {
|
||||
exit('Unauthorized');
|
||||
}
|
||||
|
||||
file_put_contents('./log.txt', json_encode($_POST), FILE_APPEND);
|
||||
file_put_contents('./log.txt', "\n", FILE_APPEND);
|
||||
|
||||
require_once __DIR__ . '/' . $AccountApi['api_type'] . '/app.php';
|
||||
// require_once __DIR__ . '/../core/application.php';
|
||||
exit('401 Unauthorized');
|
||||
|
|
|
@ -47,7 +47,7 @@ if ($AccountInfo) {
|
|||
'account_api_key' => $api_key,
|
||||
'account_domain' => '***.' . $AccountApi['api_server_domain'],
|
||||
'account_status' => '1',
|
||||
'account_date' => $callback_log['callback_date'],
|
||||
'account_addtime' => $callback_log['callback_date'],
|
||||
'account_client_id' => 0,
|
||||
'account_sql' => 'sql***'
|
||||
);
|
||||
|
@ -63,7 +63,7 @@ $DB->insert('account_callback', $callback_log);
|
|||
|
||||
$EmailDescription = '
|
||||
<p>Account domain : ' . $AccountInfo['account_domain'] . '<br />
|
||||
Account date : ' . $AccountInfo['account_date'] . '<br />
|
||||
Account date : ' . $AccountInfo['account_addtime'] . '<br />
|
||||
Server IP : ' . $AccountApi['api_server_ip'] . '<br />
|
||||
Hosting package: ' . $AccountApi['api_package'] . '<br /></p>
|
||||
<p>Control Panel username : ' . $AccountInfo['account_username'] . '<br />
|
||||
|
|
|
@ -48,7 +48,7 @@ if ($AccountInfo) {
|
|||
'account_api_key' => $api_key,
|
||||
'account_domain' => '***.' . $AccountApi['api_server_domain'],
|
||||
'account_status' => '3',
|
||||
'account_date' => $callback_log['callback_date'],
|
||||
'account_addtime' => $callback_log['callback_date'],
|
||||
'account_client_id' => 0,
|
||||
'account_sql' => 'sql***'
|
||||
);
|
||||
|
|
27
src/callback/myownfreehost/index.php
Executable file
27
src/callback/myownfreehost/index.php
Executable file
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
require_once __DIR__ . '/../../core/application.php';
|
||||
$path_array = explode('/', trim($path_info, '/'));
|
||||
|
||||
if (!$path_array || count($path_array) < 2) {
|
||||
header("status: 401");
|
||||
exit('401 Unauthorized');
|
||||
}
|
||||
|
||||
$api_key = $path_array[0];
|
||||
$token = $path_array[1];
|
||||
|
||||
$AccountApi = $DB->find('account_api', '*', array('api_key' => $api_key), null, 1);
|
||||
|
||||
if (!$AccountApi) {
|
||||
exit('Not Found');
|
||||
}
|
||||
|
||||
if ($token != $AccountApi['api_callback_token']) {
|
||||
exit('Unauthorized');
|
||||
}
|
||||
|
||||
file_put_contents('./log.txt', json_encode($_POST), FILE_APPEND);
|
||||
file_put_contents('./log.txt', "\n", FILE_APPEND);
|
||||
|
||||
require_once __DIR__ . '/app.php';
|
|
@ -44,7 +44,7 @@ if ($AccountInfo) {
|
|||
'account_api_key' => $api_key,
|
||||
'account_domain' => '***.' . $AccountApi['api_server_domain'],
|
||||
'account_status' => '1',
|
||||
'account_date' => $callback_log['callback_date'],
|
||||
'account_addtime' => $callback_log['callback_date'],
|
||||
'account_client_id' => 0,
|
||||
'account_sql' => 'sql***'
|
||||
);
|
||||
|
|
|
@ -51,7 +51,7 @@ if ($AccountInfo) {
|
|||
'account_api_key' => $api_key,
|
||||
'account_domain' => '***.' . $AccountApi['api_server_domain'],
|
||||
'account_status' => '1',
|
||||
'account_date' => $callback_log['callback_date'],
|
||||
'account_addtime' => $callback_log['callback_date'],
|
||||
'account_client_id' => 0,
|
||||
'account_sql' => 'sql***'
|
||||
);
|
||||
|
|
|
@ -48,7 +48,7 @@ if ($AccountInfo) {
|
|||
'account_api_key' => $api_key,
|
||||
'account_domain' => '***.' . $AccountApi['api_server_domain'],
|
||||
'account_status' => '1',
|
||||
'account_date' => $callback_log['callback_date'],
|
||||
'account_addtime' => $callback_log['callback_date'],
|
||||
'account_client_id' => 0,
|
||||
'account_sql' => 'sql***'
|
||||
);
|
||||
|
|
|
@ -44,7 +44,7 @@ if ($AccountInfo) {
|
|||
'account_api_key' => $api_key,
|
||||
'account_domain' => '***.' . $AccountApi['api_server_domain'],
|
||||
'account_status' => '1',
|
||||
'account_date' => $callback_log['callback_date'],
|
||||
'account_addtime' => $callback_log['callback_date'],
|
||||
'account_client_id' => 0,
|
||||
'account_sql' => $status
|
||||
);
|
||||
|
|
|
@ -44,7 +44,7 @@ if ($AccountInfo) {
|
|||
'account_api_key' => $api_key,
|
||||
'account_domain' => '***.' . $AccountApi['api_server_domain'],
|
||||
'account_status' => '1',
|
||||
'account_date' => $callback_log['callback_date'],
|
||||
'account_addtime' => $callback_log['callback_date'],
|
||||
'account_client_id' => 0,
|
||||
'account_sql' => 'sql***'
|
||||
);
|
||||
|
|
|
@ -51,7 +51,7 @@ if ($AccountInfo) {
|
|||
'account_api_key' => $api_key,
|
||||
'account_domain' => '***.' . $AccountApi['api_server_domain'],
|
||||
'account_status' => '1',
|
||||
'account_date' => $callback_log['callback_date'],
|
||||
'account_addtime' => $callback_log['callback_date'],
|
||||
'account_client_id' => 0,
|
||||
'account_sql' => 'sql***'
|
||||
);
|
||||
|
|
|
@ -51,7 +51,7 @@ if ($AccountInfo) {
|
|||
'account_api_key' => $api_key,
|
||||
'account_domain' => '***.' . $AccountApi['api_server_domain'],
|
||||
'account_status' => '2',
|
||||
'account_date' => $callback_log['callback_date'],
|
||||
'account_addtime' => $callback_log['callback_date'],
|
||||
'account_client_id' => 0,
|
||||
'account_sql' => 'sql***'
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue