Community discussions

MUM Europe 2020
 
mostafaalsaady
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 50
Joined: Fri Mar 14, 2008 7:39 pm
Location: IRAQ

how to redirect user on hotspot after login

Thu May 05, 2011 3:36 pm

dear friends

i have question for u

i have mikrotik 4.16

i want user after they login automatically redirect to site that i choose

can that be done

and which file i edit >????
i tried
login - alogin ??????????????????

any one knows
LearnING MikrotiK
MTCNA - MTCWE - MTCRE - MTCTCE
 
SurferTim
Forum Guru
Forum Guru
Posts: 4637
Joined: Mon Jan 07, 2008 10:31 pm
Location: Miramar Beach, Florida

Re: how to redirect user on hotspot after login

Thu May 05, 2011 3:51 pm

You will need to replace a variable on the hotspot/login.html document on the router.
You must replace $(link-orig) with the url of the website you want them to get after login.
There are two, and both look like this:
<input type="hidden" name="dst" value="$(link-orig)">

Change them to
<input type="hidden" name="dst" value="http://www.mysite.com">

For more, see the docs here:
http://wiki.mikrotik.com/wiki/Manual:Cu ... ng_Hotspot
 
mostafaalsaady
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 50
Joined: Fri Mar 14, 2008 7:39 pm
Location: IRAQ

Re: how to redirect user on hotspot after login

Thu May 05, 2011 4:21 pm

thanx dear

i do it but it doesn't work
<input type="hidden" name="dst" value="www.hotmail.com" />

a href="$(link-login-only)?target=lv&dst=www.hotmail.com">

when i login it shows
http://10.0.0.1/www.hotmail.com

in the address bar
?????
LearnING MikrotiK
MTCNA - MTCWE - MTCRE - MTCTCE
 
SurferTim
Forum Guru
Forum Guru
Posts: 4637
Joined: Mon Jan 07, 2008 10:31 pm
Location: Miramar Beach, Florida

Re: how to redirect user on hotspot after login

Thu May 05, 2011 4:37 pm

You should replace only "$(link-orig)" in the two places I mentioned. Both are in forms. Both look like this:
<input type="hidden" name="dst" value="$(link-orig)" />

Maybe it wants a protocol also. Try in both places:
<input type="hidden" name="dst" value="http://www.hotmail.com" />

One is in the form "sendin" (first you will find) and the other is in the form "login" (farther down the page).

ADD: Try another link besides hotmail. It does another redirect to a SSL (https) login page. Try Google.
<input type="hidden" name="dst" value="http://www.google.com" />

Are you using trial users? The $(link-orig-esc) variable only applies to the trial user. You must escape the url if you want to use trial users.
http://www.google.com
url encodes to
http%3A%2F%2Fwww.google.com
 
mostafaalsaady
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 50
Joined: Fri Mar 14, 2008 7:39 pm
Location: IRAQ

Re: how to redirect user on hotspot after login

Thu May 05, 2011 6:36 pm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>internet hotspot > login</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="expires" content="-1" />
<style type="text/css">
body {color: #737373; font-size: 10px; font-family: verdana;}

textarea,input,select {
background-color: #FDFBFB;
border: 1px solid #BBBBBB;
padding: 2px;
margin: 1px;
font-size: 14px;
color: #808080;
}

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

</head>

<body>
$(if chap-id)
	<form name="sendin" action="$(link-login-only)" method="post">
		<input type="hidden" name="username" />
		<input type="hidden" name="password" />
		<input type="hidden" name="dst" value="www.hotmail.com" />
		<input type="hidden" name="popup" value="true" />
	</form>
	
	<script type="text/javascript" src="/md5.js"></script>
	<script type="text/javascript">
	<!--
	    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)

<div align="center">
<a href="$(link-login-only)?target=lv&dst=www.hotmail.com">Latviski</a>
</div>

<table width="100%" style="margin-top: 10%;">
	<tr>
	<td align="center" valign="middle">
		<div class="notice" style="color: #c1c1c1; font-size: 9px">Please log on to use the internet hotspot service<br />$(if trial == 'yes')Free trial available, <a style="color: #FF8080"href="$(link-login-only)?dst=$(link-orig-esc)&username=T-$(mac-esc)">click here</a>.$(endif)</div><br />
		<table width="280" height="280" style="border: 1px solid #cccccc; padding: 0px;" cellpadding="0" cellspacing="0">
			<tr>
				<td align="center" valign="bottom" height="175" colspan="2">
					<form name="login" action="$(link-login-only)" method="post"
					    $(if chap-id) onSubmit="return doLogin()" $(endif)>
						<input type="hidden" name="dst" value="$(link-orig)" />
						<input type="hidden" name="popup" value="true" />
						
							<table width="100" style="background-color: #ffffff">
								<tr><td align="right">login</td>
										<td><input style="width: 80px" name="username" type="text" value="$(username)"/></td>
								</tr>
								<tr><td align="right">password</td>
										<td><input style="width: 80px" name="password" type="password"/></td>
								</tr>
								<tr><td>&nbsp;</td>
										<td><input type="submit" value="OK" /></td>
								</tr>
							</table>
					</form>
				</td>
			</tr>
			<tr><td align="center"><a href="http://www.mikrotik.com" target="_blank" style="border: none;"><img src="img/logobottom.png" alt="mikrotik" /></a></td></tr>
		</table>
	
	<br /><div style="color: #c1c1c1; font-size: 9px">Powered by MikroTik RouterOS</div>
	$(if error)<br /><div style="color: #FF8080; font-size: 9px">$(error)</div>$(endif)
	</td>
	</tr>
</table>

<script type="text/javascript">
<!--
  document.login.username.focus();
//-->
</script>
</body>
</html>
LearnING MikrotiK
MTCNA - MTCWE - MTCRE - MTCTCE
 
mostafaalsaady
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 50
Joined: Fri Mar 14, 2008 7:39 pm
Location: IRAQ

Re: how to redirect user on hotspot after login

Thu May 05, 2011 6:50 pm

IT's OK dear IT worked thanx :)
LearnING MikrotiK
MTCNA - MTCWE - MTCRE - MTCTCE
 
Mombeini
just joined
Posts: 3
Joined: Fri Jul 17, 2015 10:04 pm
Location: Iran
Contact:

Re: how to redirect user on hotspot after login

Fri Aug 26, 2016 3:08 pm

thanks . it's work correctly
 
ferriston
just joined
Posts: 2
Joined: Mon Oct 16, 2017 5:54 am

Re: how to redirect user on hotspot after login

Mon Oct 16, 2017 6:32 am

I also need help with a captive portal to log in users in trial mode. Can anyone help?
 
kingston41
just joined
Posts: 1
Joined: Thu Nov 16, 2017 4:17 pm

Re: how to redirect user on hotspot after login

Thu Nov 16, 2017 4:24 pm

Double click on your HOTSPOT / SERVER PROFILE & YOU WILL SEE THE OPTION TO ENACLE THE TRIAL, JUST PLACE A TICK IN THE TRIAL BOX AND SAVE

Who is online

Users browsing this forum: No registered users and 79 guests