Community discussions

MikroTik App
 
rayrem
just joined
Topic Author
Posts: 1
Joined: Sat Apr 03, 2021 9:55 am

Hotspot Script

Sun Apr 04, 2021 5:13 am

first of all, i used hAP lite TC for home use only, and i'm not fluent in coding, all i do is search some information in google,

so here is my problem
    $(if chap-id)
    <form name="sendin" action="$(link-login-only)" method="post" style="display:none">
        <input type="hidden" name="username" />
        <input type="hidden" name="password" />
        <input type="hidden" name="dst" value="$(link-orig)" />
        <input type="hidden" name="popup" value="true" />
    </form>
	
    <script src="/md5.js"></script>

	<script language="javascript">
		function check(form), doLogin() {
			if((form.username.value == "free") && (form.password.value == "free1234")) {
				window.open('aprilfools.html','_self') <!-- remove '_self' to open in new tab browser -->
			}
			else {
				document.sendin.username.value = document.login.username.value;
				document.sendin.password.value = hexMD5('$(chap-id)' + document.login.password.value + '$(chap-challenge)');
				document.sendin.submit();
				return false;
			}
		}
	</script>

<!--	<script>
        function doLogin() {
            document.sendin.username.value = document.login.username.value;
            document.sendin.password.value = hexMD5('$(chap-id)' + document.login.password.value + '$(chap-challenge)');
            document.sendin.submit();
            return false;
        }
    </script> -->
    $(endif)
<input type="submit" onclick="check(this.form)" value="Connect" />

it give's me error Web browser did not send challenge response (try again, enable JavaScript)

it should work like this, if they input the user and password correctl the page will change to this one
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="expires" content="-1">
    <title>Internet hotspot - TROLL'</title>
    <link rel="stylesheet" href="css/style.css">
</head>

<body>
    <div class="ie-fixMinHeight">
        <div class="main">
            <div class="wrap">
				<p class="info"><img src="rickroll/rickroll.gif" alt="rickroll width="50%" height="50%"> </a></p>	
				<input type="submit" onclick="javascript:window.open('','_self').close()" value="Return" />
				<audio autoplay loop> 
					<source src="rickroll/rickroll.mp3" type="audio/mp3">
				</audio>
            </div>
        </div>
    </div>
</body>

</html>
else, it will run the original script.

that is what i intended to make it work

and also if click Return, it should return to login page..

Who is online

Users browsing this forum: 0xAA55, bkuyk1 and 34 guests