Hotspot linking
Login attempts (24 hours)
156
Accepted
145
Rejected
11
Devices
156
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
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) |