Hotspot External Login page login problem

Hi

this is my login.html script in my router.

... $(if chap-id) JavaScript required. Enable JavaScript to continue. $(endif) If you are not redirected in a few seconds, click 'continue' below
\ \ This is my external server login.php script. <?php $mac=$_POST['mac']; $ip=$_POST['ip']; $username=$_POST['username']; $linklogin=$_POST['link-login']; $linkorig=$_POST['link-orig']; $error=$_POST['error']; $chapid=$_POST['chap-id']; $chapchallenge=$_POST['chap-challenge']; $linkloginonly=$_POST['link-login-only']; $linkorigesc=$_POST['link-orig-esc']; $macesc=$_POST['mac-esc']; ?> mikrotik hotspot > login 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; }

Latviski
Please log on to use the mikrotik hotspot service

Free trial available, <a style=“color: #FF8080"href=”<?php echo $linkloginonly; ?>?dst=<?php echo $linkorigesc; ?>&username=T-<?php echo $macesc; ?>">click here.


login
password


<?php echo $error; ?>

\ \ Everything is working fine except any user changes his ipaddress and try to login or wrong username and password mikrotik router hangs. I am not getting any kind of errors. Please give me the solution to this problem.