Community discussions

 
flynno
Member Candidate
Member Candidate
Topic Author
Posts: 241
Joined: Wed Aug 27, 2014 8:11 pm

API to increase Hotspot http-cookie-lifetime

Thu Aug 10, 2017 7:14 pm

Hi guys,

Just wondering is it possible to use a form to increase the Hotspot http-cookie-lifetime via input field

I am using below code but no joy with it.

===Form Code===

<form id="cookie" class="form-horizontal" action="cookie.php" method="post">

<input type="text" class="form-control" name="logincookie"/>

<button type="submit" value="submit" class="btn btn-chill btn-xs">Submit</button>

</form>

=====cookie.php Code====

<?php
// Receiving variables
@$logincookie = addslashes($_POST['logincookie']);

use PEAR2\Net\RouterOS;
require_once 'PEAR2/Autoload.php';

$util = new RouterOS\Util(
$client = new RouterOS\Client('192.168.88.1', 'admin', 'password')
);
$util->setMenu('/ip hotspot profile set hsprof1');

$util->edit(0, 'http-cookie-lifetime', $_POST['logincookie']);


header('Location: index.php');

?>


Anyone have any solutions or ideas?
 
User avatar
boen_robot
Forum Guru
Forum Guru
Posts: 2411
Joined: Thu Aug 31, 2006 4:43 pm
Location: europe://Bulgaria/Plovdiv

Re: API to increase Hotspot http-cookie-lifetime

Thu Aug 10, 2017 7:35 pm

I'm pretty sure "set hsprof1" is not a menu.

I'm guessing that's the name of the profile, so:
$util->setMenu('/ip hotspot profile');

$util->edit('hsprof1', 'http-cookie-lifetime', $_POST['logincookie']);
PEAR2_Net_RouterOS(1.0.0b6) - My API client in PHP
(Rate my posts? If you want... no pressure...)
 
flynno
Member Candidate
Member Candidate
Topic Author
Posts: 241
Joined: Wed Aug 27, 2014 8:11 pm

Re: API to increase Hotspot http-cookie-lifetime

Thu Aug 10, 2017 7:55 pm

Hi boen_robot,

That worked like a charm, thank you!

Who is online

Users browsing this forum: No registered users and 18 guests