• MikroTik.com
  • RouterBOARD
  • User Meeting
  • Training
  • User Manual
  • Support
  • Downloads
  • Videos
Register |   * Login | HOME

View unanswered posts | View active topics

Script to redirect a page with a timer  Page 1 of 1
 [ 5 posts ]  Post new topic Reply to topic
  Print view Previous topic | Next topic 
Author Message
thiagomedeiros
 Post subject: Script to redirect a page with a timer
PostPosted: Tue Apr 03, 2012 10:03 pm 
Offline
just joined

Joined: Tue Apr 03, 2012 9:38 pm
Posts: 4
Karma: 0
Hi i'm a novice with Mikrotik. Before this i used BrazilFW.

Now i have a RB750UP 5.14 version, and i have some clients that i share my connection with them.
But, you know, some clients takes some time to pay and i need to show a warning page to this clients.

I imagined a script that redirect all pages that run in port 80 to this warning ip for a couple of time, like 30 seconds and then disable this script.

Imagined something like this:

if client-ip and client-port-dest == 80 goto 108.174.50.18 set timer to 30seconds and then disable this rule

I need the help of community to translate this code in MK script.
In this case i'll schedule this rule to run every 8 hours in the days 15 to 20, every moth.
I don't want to use hotspot.
My connection is pppoe and i share with nat (masquerade).


Top
 Profile  
 
c0d3rSh3ll
 Post subject: Re: Script to redirect a page with a timer
PostPosted: Wed Apr 04, 2012 7:41 pm 
Offline
Member Candidate
Member Candidate
User avatar

Joined: Mon Jul 25, 2011 8:42 pm
Posts: 225
Karma: 27

Location: [admin@Chile] >
add this rules

/ip firewall nat
add action=dst-nat chain=dstnat comment=redirect disabled=no dst-port=80 protocol=tcp src-address-list=bloqueo to-addresses=108.174.50.18 to-ports=80

add your clients to show a warning page to this address-list

/ip firewall address-list
add address=0.0.0.0 disabled=no list=bloqueo

and then scheduler to run this script

ip fire nat enable [/ip firewall nat find comment=redirect]; delay delay-time=30 ; ip fire nat disable [/ip firewall nat find comment=redirect]


sorry by my english

_________________
if you want support fast and good, send an email to c0d3rSh3ll@ hotmail.com, basic and advanced configurations for just value.

if my answer helped you, please give me karma


Top
 Profile  
 
thiagomedeiros
 Post subject: Re: Script to redirect a page with a timer
PostPosted: Wed Apr 18, 2012 11:29 pm 
Offline
just joined

Joined: Tue Apr 03, 2012 9:38 pm
Posts: 4
Karma: 0
Thanks, i'll try next week. I'm travelling now.


Top
 Profile  
 
thiagomedeiros
 Post subject: Re: Script to redirect a page with a timer
PostPosted: Tue May 22, 2012 8:12 pm 
Offline
just joined

Joined: Tue Apr 03, 2012 9:38 pm
Posts: 4
Karma: 0
It works very well, thank you!


Top
 Profile  
 
thiagomedeiros
 Post subject: Re: Script to redirect a page with a timer
PostPosted: Wed May 23, 2012 4:42 pm 
Offline
just joined

Joined: Tue Apr 03, 2012 9:38 pm
Posts: 4
Karma: 0
Spanish:
¿Hay una manera de hacer el desbloqueo se realiza sólo cuando el usuario accede a una página, de lo contrario permanecer encerrado hasta que se realice esta acción?

En BrazilFW bloqueo estuvo activo hasta el usuario hace clic en Continuar (en la alerta a la página redireccionada). Por ejemplo, hoy activado el bloqueo y el usuario utiliza Internet sólo de mañana, en cuyo caso el bloqueo está activado hasta que haga clic en la página de advertencia para desbloquear.

MK me estoy convirtiendo en un bloqueo en un tiempo de 1 hora. El problema: El bloqueo se enciende durante 2 minutos (el tiempo que he elegido) y luego 2 minutos después de que el bloqueo está desactivado. Esto es, si el usuario ha accedido a entre el 8, 9, 10 en punto, entró en la cuadra y vi la página, pero si se utiliza el Internet las 8:30 o 11:45 no puede ver.


English:
Is there a way to make the unlocking is done only when the user accesses a page, otherwise stay locked up until he perform this action?

In BrazilFW lock was active until the user clicks on Continue (on page redirected warning). For example, today activated the lock and the user uses the internet only tomorrow, in which case the lock is on until it clicks on the page warning to unlock.

MK I'm turning in a lock in a time of 1 hour. The problem: The lock is turned on for 2 minutes (the time I chose) and then 2 minutes after that the lock is disabled. That is if the User has accessed between 8, 9, 10 o'clock, he entered the block and saw the page, but if he used the Internet 8:30 or 11:45 he can not see.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  Page 1 of 1
 [ 5 posts ] 

Board index » RouterOS » Scripting

All times are UTC + 2 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Karma functions powered by Karma MOD © 2007, 2009 m157y