本日作業分
This commit is contained in:
+9
-3
@@ -1,17 +1,19 @@
|
||||
<?php
|
||||
define ('SAVE_DIR', 'draft/');
|
||||
define ('SAVE_DIR', "${_SERVER['DOCUMENT_ROOT']}/drafts/");
|
||||
|
||||
$json = getParamJSON ();
|
||||
|
||||
if (!(isset ($json['data'])))
|
||||
{
|
||||
sendResult (false, 'Empty query Parameter: data');
|
||||
|
||||
exit (1);
|
||||
}
|
||||
|
||||
if (!(preg_match ('/^data:image\/png;base64,/', $json['data'])))
|
||||
{
|
||||
sendResult (false, 'Not Allow data type: data');
|
||||
|
||||
exit (1);
|
||||
}
|
||||
|
||||
@@ -27,7 +29,8 @@ setcookie ('backup', $file, time () + 60 * 60 * 24 * 30);
|
||||
|
||||
|
||||
function
|
||||
getParamJSON ()
|
||||
getParamJSON ():
|
||||
array
|
||||
{
|
||||
$buff = file_get_contents ('php://input');
|
||||
$json = json_decode ($buff, true);
|
||||
@@ -36,7 +39,10 @@ getParamJSON ()
|
||||
}
|
||||
|
||||
function
|
||||
sendResult ($status, $data)
|
||||
sendResult (
|
||||
$status,
|
||||
$data):
|
||||
string
|
||||
{
|
||||
header ('Access-Control-Allow-Origin: *');
|
||||
header ('Access-Control-Allow-Headers: *');
|
||||
|
||||
@@ -37,5 +37,5 @@ if (!(empty ($_POST['thread-name'])))
|
||||
$mysqli -> close ();
|
||||
}
|
||||
|
||||
header ("location: ./?thread=$current");
|
||||
header ("location: ../?thread=$current");
|
||||
|
||||
|
||||
+2
-2
@@ -2,10 +2,10 @@
|
||||
require "${_SERVER['DOCUMENT_ROOT']}/database.php";
|
||||
|
||||
|
||||
define ('SAVE_DIR', 'image/'); // 保存ディレクトリ定義
|
||||
define ('SAVE_DIR', "${_SERVER['DOCUMENT_ROOT']}/images/"); // 保存ディレクトリ定義
|
||||
|
||||
$thread = $_GET['thread'];
|
||||
file_put_contents ('log.txt', $thread);
|
||||
// file_put_contents ('log.txt', $thread);
|
||||
|
||||
$json = getParamJSON (); // JSON パラメタ
|
||||
|
||||
|
||||
Reference in New Issue
Block a user