Skip to content

Commit 7a834ca

Browse files
author
eAi
committed
Add authentication support
This releases v0.2.
1 parent 16a1a5b commit 7a834ca

File tree

6 files changed

+437
-255
lines changed

6 files changed

+437
-255
lines changed

ajax_interface.php

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
// =============================
3+
// (Config) HTTP Username / Password
4+
// =============================
5+
6+
$http_username = '';
7+
$http_password = '';
8+
9+
// =============================
10+
// No need to edit below this line
11+
// =============================
12+
13+
$host = $_POST['host'];
14+
$port = intval($_POST['port']);
15+
$resource = $_POST['resource'];
16+
$function = $_POST['func'];
17+
$val = $_POST['val'];
18+
19+
try
20+
{
21+
include('mta_sdk.php');
22+
$mtaSDK = new mta();
23+
24+
if ( $http_username && $http_password )
25+
{
26+
$mtaSDK->http_username = $http_username;
27+
$mtaSDK->http_password = $http_password;
28+
}
29+
30+
$val = explode(",", $val);
31+
$json_data = json_encode($val);
32+
33+
echo $mtaSDK->do_post_request( $host, $port, "/" . $resource . "/call/" . $function, $json_data );
34+
}
35+
catch( Exception $e )
36+
{
37+
@header("HTTP/1.0 500 Internal Server Error");
38+
echo $e->getMessage();
39+
}
40+
?>

misc.php

Lines changed: 0 additions & 41 deletions
This file was deleted.

mta.php

Lines changed: 0 additions & 118 deletions
This file was deleted.

0 commit comments

Comments
 (0)