Community discussions

MikroTik App
 
M1rc3lo
just joined
Topic Author
Posts: 1
Joined: Mon Aug 08, 2022 6:17 pm

print user comment on hotspot status.html

Mon Aug 08, 2022 7:10 pm

Hi I want my hotspot clients to see the comment of their username that they are using on status.html , But I have the code to print user's comment on terminal and now I don't know to put it on status.html

[xxxxxxxx@xxxxxxxxx] > ip hotspot user print where name=mj1997
Flags: * - default, X - disabled, D - dynamic 
 #   SERVER             NAME             ADDRESS         PROFILE              UPTIME      
 0   ;;; hi             mj1997                           unlimited            3h24m8s


[Marcelo1997@Archer-C64] > :foreach ITEM in=[/ip hotspot user find where name="mj1997"] do={
{...   :local COMMENT [/ip hotspot user get $ITEM comment];
{...   :put "$COMMENT";
}
hi


:foreach ITEM in=[/ip hotspot user find where name="$username"] do={
  :local COMMENT [/ip hotspot user get $ITEM comment];
  :put "$COMMENT";
}

Screenshot (260).png


now I want this script to run on status.html and print user's comment
please help me make it work




status.html code
    <form action="$(link-logout)" name="logout" onSubmit="return openLogout()">
    
      <table class="table table-bordered table-hover mr-b-0 text-light">
        <tr>
            <td align="right" style="width: 40%;">IP address </td>
            <td>$(ip)</td>
        </tr>
        <tr>
            <td align="right">MAC address</td>
            <td>$(mac)</td>
        </tr>
        <tr>
            <td align="right">Wifi connected to</td>
            <td>$(interface-name)</td>
        </tr>
        $(if vlan-id == yes)
        <tr>
            <td align="right">Vlan id</td>
            <td>$(vlan-id)</td>
        </tr>
        $(endif)
        $(if login-by == http-chap)
        <tr>
            <td align="right">Was login</td>
            <td>manually typed</td>
        </tr>
        $(elif login-by == mac-cookie)
        <tr>
            <td align="right">Was login</td>
            <td>automatically<br>Was logout due<br>to no activity</td>
        </tr>
        $(elif login-by == cookie)
        <tr>
            <td align="right">Was login by</td>
            <td>login back button</td>
        </tr>
        $(endif)
        <tr>
            <td align="right"> Uploaded data<br> Downloaded data</td>
            <td>$(bytes-in-nice) <br> $(bytes-out-nice)</td>
        </tr>
        <tr>
            <td align="right">Active time</td>
            <td>$(uptime)</td>
        </tr>
        $(if remain-bytes-total)
        <tr>
            <td align="right">Remaining data</td>
            <td>$(remain-bytes-total-nice)</td>
        </tr>
        $(endif)
        $(if session-time-left)
        <tr>
            <td align="right">Remaining Time</td>
            <td>$(session-time-left)</td>
        </tr>
        $(endif)
        $(if blocked == 'yes')
        <tr>
            <td align="right">Status</td>
            <td><div style="color: #FF8080"><a href="$(link-advert)" target="hotspot_advert"></a> advertisement</div></td>
        </tr>
        $(endif)
        <tr>
            <td align="right">Refreshing in</td>
            <td>$(refresh-timeout)</td>
        </tr>
        
        </table>
        $(if login-by-mac != 'yes')
        <button type="submit" class="btn-md w-12 bg-red pd-5">Logout</button>
        $(endif)
      
    </form>
    </div>
</div>
</div>
</div>
</div>
</div>
</div>



Screenshot (262).png
You do not have the required permissions to view the files attached to this post.

Who is online

Users browsing this forum: mbezuidenhout, UkRainUa and 20 guests