Redirecto to url with parameters after login

This may be a noobish question, but I can’t figure out what’s going on, but anyway.. I want the mikrotik to redirect to a specific url after login. I managed to do that by setting the value of the dst field (in the form located in login.html) to the url I need to redirect to. The thing is it’s not working as expected when using an url with parameters, I guess somewhere in the middle the url gets encoded and replaces all my & for & so my backend gets all incorrectly named parameters (except for the first parameter of the url).

For example:

<script type="text/javascript">
	function onSubmit() {
		document.sendin.username.value = 'admin';
		document.sendin.password.value = "";
		document.sendin.dst.value = "http://myServer.com/doStuff?paramOne=someValue&paramTwo=someOtherValue"; // SET DST VALUE
		document.sendin.popup.value = "false";
		document.sendin.user.value = "$(mac)"
		document.sendin.submit();
		return true;
	}
</script>

<div style="width: 100%; margin: 0 auto;">
	<div style="width: 100% !important; margin: 0 auto !important; text-align: center !important; margin-bottom: 10px;">
		<form name="sendin" action="http://10.1.0.1/login" onSubmit="onSubmit()" method="POST">
			<input type="hidden" name="username" value="admin">
			<input type="hidden" name="password" value="">
			<input type="hidden" name="popup" value="false">
			<input type="hidden" name="dst" value="$(link-orig)">
			<input type="hidden" name="user" value="$(mac)">
			<button>Login</button>
		</form>
	</div>
</div>

My server gets these parameters

{
  paramOne: someValue,
  amp;paramTwo: someOtherValue
}

How can I avoid this? What am I doing wrong?

Hello
open alogin.html file from hotspot Folder with html editor then replace $(link-redirect) with your address.
Then it upload on your router
for Example :

<html>
<head>
<title>mikrotik hotspot > redirect</title>
<meta http-equiv="refresh" content="2; url=$(link-redirect)">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="expires" content="-1">
<style type="text/css">
<!--
textarea,input,select {
    background-color: #FDFBFB;
    border: 1px #BBBBBB solid;
    padding: 2px;
    margin: 1px;
    font-size: 14px;
    color: #808080;
}

body{ color: #737373; font-size: 12px; font-family: verdana; }

a, a:link, a:visited, a:active { color: #AAAAAA; text-decoration: none; font-size: 12px; }
a:hover { border-bottom: 1px dotted #c1c1c1; color: #AAAAAA; }
img {border: none;}
td { font-size: 12px; color: #7A7A7A; }

-->
</style>
<script language="JavaScript">
<!--
    function startClock() {
        $(if popup == 'true')
        open('$(link-status)', 'hotspot_status', 'toolbar=0,location=0,directories=0,status=0,menubars=0,resizable=1,width=290,height=200');
    $(endif)
    location.href = 'http://mjsabri.ir';
    }
//-->
</script>
</head>
<body onLoad="startClock()">
<table width="100%" height="100%">
<tr>
    <td align="center" valign="middle">
    You are logged in
    <br><br>
    If nothing happens, click <a href="http://mjsabri.ir">here</a></td>
</tr>
</table>
</body>
</html>

Your answer makes me feel that I’m terrible at communicating ideas or that you didn’t get what I was trying to say, at all. I got the redirect part just right. The problem is with the params of the redirect url.

Does the URL open just fine on a browser?

What if you try to send the parameters without an ampersand (&) but with another character instead (+ for example?) and then parse that on your server to extract the arguments?

Or just strip the ‘amp;’ server-side?

I know this is a more like a botch rather than a long term solution.

Hi there! Did you find solution? I’ve met the same problem :frowning: