Demo networkTrial
8

Hotspot linking

Login attempts (24 hours)
156
Accepted
145
Rejected
11
Incorrect password. (11)
Devices
156

MikroTik devices

MikroTik devicePages folderLast deployAPI key
— Not deployed 4811e2dd…
— Not deployed 63f0f2b8…
— Not deployed c493ae5f…
— Not deployed 17d59de2…
— Not deployed 39f16d7e…
— Not deployed e17fb301…
— Not deployed c9085b4d…
— Not deployed 4b5c437f…
— Not deployed 94978a3c…
— Not deployed 8f0a7587…
— Not deployed 49f28eb8…
— Not deployed d973c90b…
— Not deployed e1c3ed04…
— Not deployed 000197d4…

Link code

<!-- login.html — Page ads placeholder (optional, managed from “Page ads”) -->
<div id="sn-ads"></div>

<!-- login.html — before </body> -->
<script>
  window.SN_MT = {
    linkLogin: '$(link-login-only)',
    linkOrig: '$(link-orig)',
    chapId: '$(chap-id)',
    chapChallenge: '$(chap-challenge)',
    mac: '$(mac)',
    ip: '$(ip)',
    error: '$(error)'
  };
</script>
<script src="sn-config.js"></script>
<script src="try.js"></script>
<script>
  // form: Login form in صفحتك, code: Field Card number, password: Field Password (optional)
  document.getElementById('form').onsubmit = function (e) {
    e.preventDefault();
    SNHotspot.login({
      code: document.getElementById('code').value,
      password: document.getElementById('password') ? document.getElementById('password').value : '',
      onLoading: function (busy) { /* Show/Hide مؤشر التحميل */ },
      onError: function (err) {
        // err.code: Code Reason, err.message: message جاهزة بالعربية, err.needPassword: Card يتطلب Password
        document.getElementById('message').textContent = err.message;
      }
    });
  };
</script>
<!-- status.html — before </body> -->
<script>
  window.SN_MT = { username: '$(username)', mac: '$(mac)' };
</script>
<script src="sn-config.js"></script>
<script src="try.js"></script>
<script>
  SNHotspot.status({
    onResult: function (res) {
      if (!res.ok) { return; }
      var i = res.info; // cards: category, expires_at, remaining_time, remaining_data, used_time, used_data, speed
                        // subscriber: name, plan, expires_at, remaining_data
      if (i.remaining_time != null) { document.getElementById('time-left').textContent = SNHotspot.formatDuration(i.remaining_time); }
      if (i.remaining_data != null) { document.getElementById('data-left').textContent = SNHotspot.formatBytes(i.remaining_data); }
    }
  });
</script>
<!-- Price list from the system (optional) -->
<script>
  SNHotspot.info(function (res) {
    if (!res.ok) { return; }
    // res.network, res.phone, res.whatsapp, res.currency
    // res.categories[]: name, price, price_text, time, validity, data, speed, color
    var html = '';
    for (var k = 0; k < res.categories.length; k++) {
      var c = res.categories[k];
      html += '<li>' + c.name + ' — ' + c.price_text + '</li>';
    }
    document.getElementById('prices').innerHTML = html;
  });
</script>

Setup

System URL
https://madix.org/try
Library file
try.js
Update library
2026-12-05 16:25
Connection timeout
8 seconds
when unreachable
Direct login via device MikroTik
Local MikroTik users
Log in directly through the device
Hotspot settings

Library functions

SNHotspot.login(options)
SNHotspot.status(options)
SNHotspot.info(callback)
SNHotspot.renderAds('#sn-ads')
SNHotspot.ads(callback)
SNHotspot.submitLogin(user, pass)
SNHotspot.normalize(code)
SNHotspot.formatBytes(bytes)
SNHotspot.formatDuration(seconds)