commit
fc9ddcd425
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,4 +1,6 @@
|
|||||||
/system/config.php
|
/system/config.php
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.vscode/
|
.vscode/
|
||||||
ui/compiled/*.php
|
ui/compiled/*.php
|
||||||
|
ui/cache/*.php
|
||||||
|
/test.php
|
@ -131,10 +131,15 @@ class Client
|
|||||||
$password = '',
|
$password = '',
|
||||||
$port = 8728,
|
$port = 8728,
|
||||||
$persist = false,
|
$persist = false,
|
||||||
$timeout = null,
|
$timeout = 10,
|
||||||
$crypto = N::CRYPTO_OFF,
|
$crypto = N::CRYPTO_OFF,
|
||||||
$context = null
|
$context = null
|
||||||
) {
|
) {
|
||||||
|
if(strpos($host,":")>-1){
|
||||||
|
$part = explode(":",$host);
|
||||||
|
$host = $part[0];
|
||||||
|
$port = $part[1];
|
||||||
|
}
|
||||||
$this->com = new Communicator(
|
$this->com = new Communicator(
|
||||||
$host,
|
$host,
|
||||||
$port,
|
$port,
|
||||||
@ -151,7 +156,7 @@ class Client
|
|||||||
if ((!$persist
|
if ((!$persist
|
||||||
|| !($old = $this->com->getTransmitter()->lock(S::DIRECTION_ALL)))
|
|| !($old = $this->com->getTransmitter()->lock(S::DIRECTION_ALL)))
|
||||||
&& $this->com->getTransmitter()->isFresh()
|
&& $this->com->getTransmitter()->isFresh()
|
||||||
) {
|
) {
|
||||||
if (!static::login($this->com, $username, $password, $timeout)) {
|
if (!static::login($this->com, $username, $password, $timeout)) {
|
||||||
$this->com->close();
|
$this->com->close();
|
||||||
throw new DataFlowException(
|
throw new DataFlowException(
|
||||||
@ -269,8 +274,8 @@ class Client
|
|||||||
$timeout = null
|
$timeout = null
|
||||||
) {
|
) {
|
||||||
$request = new Request('/login');
|
$request = new Request('/login');
|
||||||
$request->send($com);
|
// Update Mikrotik Versi terbaru
|
||||||
$response = new Response($com, false, $timeout);
|
// sayangnya ini ngga aman, bagusnya di setup ke port SSL
|
||||||
$request->setArgument('name', $username);
|
$request->setArgument('name', $username);
|
||||||
$request->setArgument('password', $password);
|
$request->setArgument('password', $password);
|
||||||
$request->send($com);
|
$request->send($com);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user