You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.2 KiB
38 lines
1.2 KiB
<?php
|
|
require_once('../ajax_asm.php');
|
|
|
|
function verbose( $ok=1,$info=""){
|
|
// failure to upload throws 400 error
|
|
if( $ok==0 ){
|
|
http_response_code(400);
|
|
};
|
|
die(json_encode(["ok"=>$ok, "info"=>$info]));
|
|
};
|
|
if( $CUser->Data['id'] > 1 ){
|
|
if( empty( $_FILES ) || $_FILES['db_file']['error'] ){
|
|
verbose( 0, "Failed to move uploaded file.[" . $_FILES['db_file']['error'] . "]" );
|
|
};
|
|
$filePath = $SYSPath . 'lib/controller/data';
|
|
if( !file_exists( $filePath ) ){
|
|
if( !mkdir($filePath, 0777, true ) ){
|
|
verbose( 0, "Failed to create $filePath" );
|
|
};
|
|
};
|
|
if( file_exists( $_FILES['db_file']['tmp_name'] ) ){
|
|
$MD5 = md5_file( $_FILES['db_file']['tmp_name'] );
|
|
$TArr = explode( '.', $_FILES['db_file']['name'] );
|
|
$EXT = 'db';
|
|
$FNAME = $MD5 . '.' . $EXT;
|
|
copy( $_FILES['db_file']['tmp_name'], $filePath . '/' . $FNAME );
|
|
@unlink( $_FILES['db_file']['tmp_name'] );
|
|
|
|
$RBASE = new SQLite_DB( '/dev/shm/argus/mem_db.db');
|
|
$PARAM = $MD5;
|
|
$QS = "INSERT INTO `nodes_qcq`(`node_id`,`cmd`,`status`,`parameter`) VALUES(1,129,0,'{$PARAM}')";
|
|
$RBASE->Query( $QS, false );
|
|
verbose( 1, "ALL IS OK" );
|
|
};
|
|
} else {
|
|
verbose( 0, 'Access Denied!' );
|
|
};
|
|
?>
|