forked from devsam/image
Hash Key Installer 추가
This commit is contained in:
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\img_service;
|
||||||
|
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
|
||||||
|
$json_response = [
|
||||||
|
'result'=>false,
|
||||||
|
'reason'=>'Unknown',
|
||||||
|
];
|
||||||
|
|
||||||
|
$key = $_REQUEST['key']??'';
|
||||||
|
|
||||||
|
if (!$key) {
|
||||||
|
$json_response['reason'] = 'no key';
|
||||||
|
die(json_encode($json_response));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strlen($key)<16) {
|
||||||
|
$json_response['reason'] = 'key is too short';
|
||||||
|
die(json_encode($json_response));
|
||||||
|
}
|
||||||
|
|
||||||
|
$keyExists = file_exists(__DIR__.'/HashKey.php');
|
||||||
|
if($keyExists){
|
||||||
|
$json_response['reason'] = 'already exists';
|
||||||
|
die(json_encode($json_response));
|
||||||
|
}
|
||||||
|
|
||||||
|
$keyTemplate = file_get_contents(__DIR__.'/HashKey.orig.php');
|
||||||
|
$keyFile = str_replace('=HashKey=', $key, $keyTemplate);
|
||||||
|
file_put_contents(__DIR__.'/HashKey.php', $keyFile);
|
||||||
|
|
||||||
|
$json_response['result'] = true;
|
||||||
|
$json_response['reason'] = 'success';
|
||||||
|
die(json_encode($json_response));
|
||||||
Reference in New Issue
Block a user