Automatic Expired Hotspot Page Without A Proxy - Mikrotik Script RouterOS

Create an automatic expired hotspot page without a proxy
First download "expired.html" here
if you have entered "expired.html" into the hotspot folder section, then please edit the "login.html" page
search for tag <body>  and place the script below above it
<script type="text/javascript">
 var error = "$(error)";  
 if (error == "user $(username) has reached uptime limit") {  
 window.location.href = "http://$(hostname)/expired.html";  
 } else if (error == "user $(username) has reached traffic limit") {  
 window.location.href = "http://$(hostname)/expired.html";  
 } else if (error == "no more sessions are allowed for user $(username)") {  
 window.location.href = "http://$(hostname)/expired.html";  
 } else if (error == "session limit reached ($(error-orig))") {  
 window.location.href = "http://$(hostname)/expired.html";  
 } else if (error !== "") {  
 window.location.href = "http://$(hostname)/error.html";  
 } else { document.write("$(error)"); }  
 </script>
 Notes: this script is not made by me, I just modified it, whoever owns it, because I have been using it for a long time.
 Credit: www.o-om.com