Skip to content

Instantly share code, notes, and snippets.

Created November 7, 2015 20:26
Show Gist options
  • Save anonymous/797c0e8554a8ef91f2ff to your computer and use it in GitHub Desktop.
Save anonymous/797c0e8554a8ef91f2ff to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="baon-wifi-styles.css">
<script src="jquery-2.1.4.min.js"></script>
<title>WiFi</title>
</head>
<body>
<script type='text/javascript'>
function validateEmail(email)
{
var re = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
return re.test(email);
}
function doTrialLogin()
{
document.location.href = '$(link-login-only)?dst=' + encodeURIComponent('http://1.1.1.1') + '&username=T-$(mac-esc)';
}
function sendUserData()
{
jQuery('#error_block').remove();
jQuery('#email_field').removeClass('error');
jQuery('#check_field').removeClass('error');
jQuery('#firstname_field').removeClass('error');
jQuery('#lastname_field').removeClass('error');
jQuery('#phonenum_field').removeClass('error');
jQuery('#cardnum_field').removeClass('error');
var email = document.getElementById('email_field').value;
if (!validateEmail(email))
{
jQuery('#email_field').addClass('error');
jQuery('#input_fields').append('<p id="error_block" class="error-text">Введите правильный e-mail</p>');
return;
}
var check = document.getElementById('check_field').value;
if (check.length == 0)
{
jQuery('#check_field').addClass('error');
jQuery('#input_fields').append('<p id="error_block" class="error-text">Введите номер чека</p>');
return;
}
var firstname = document.getElementById('firstname_field').value;
if (firstname.length == 0)
{
jQuery('#firstname_field').addClass('error');
jQuery('#input_fields').append('<p id="error_block" class="error-text">Введите ваше имя</p>');
return;
}
var lastname = document.getElementById('lastname_field').value;
if (lastname.length == 0)
{
jQuery('#lastname_field').addClass('error');
jQuery('#input_fields').append('<p id="error_block" class="error-text">Введите вашу фамилию</p>');
return;
}
var phonenum = document.getElementById('phonenum_field').value;
if (phonenum.length == 0)
{
jQuery('#phonenum_field').addClass('error');
jQuery('#input_fields').append('<p id="error_block" class="error-text">Введите номер телефона</p>');
return;
}
var cardnum = document.getElementById('cardnum_field').value;
if (cardnum.length == 0)
{
jQuery('#cardnum_field').addClass('error');
jQuery('#input_fields').append('<p id="error_block" class="error-text">Введите номер дисконтной карты</p>');
return;
}
var mac = '$(mac)';
var identity = '$(identity)';
//jQuery.ajax({ url: 'http://1.1.1.1?id=' + encodeURIComponent(identity) + '&mac=' + encodeURIComponent(mac) + '&email=' + encodeURIComponent(email) + '&check=' + encodeURIComponent(check) });
/* var _url
= 'http://1.1.1.1?HotspotId=' + encodeURIComponent(identity)
+ '&Mac=' + encodeURIComponent(mac)
+ '&Email=' + encodeURIComponent(email)
+ '&TransactionId=' + encodeURIComponent(check)
+ '&D.firstname=' + encodeURIComponent(firstname)
+ '&D.lastname=' + encodeURIComponent(lastname)
+ '&D.phonenum=' + encodeURIComponent(phonenum)
+ '&D.cardnum=' + encodeURIComponent(cardnum);*/
// jQuery('body').append(_url);
// alert(_url);
var hostname = 'http://1.1.1.1';
var token_id = new Date().getTime();
jQuery.when(
jQuery.ajax({
url: hostname + '?tokenId=' + token_id + '&HotspotId=' + encodeURIComponent(identity) + '&Mac=' + encodeURIComponent(mac)
}),
jQuery.ajax({
url: hostname + '?tokenId=' + token_id + '&Email=' + encodeURIComponent(email)
}),
jQuery.ajax({
url: hostname + '?tokenId=' + token_id + '&TransactionId=' + encodeURIComponent(check)
}),
jQuery.ajax({
url: hostname + '?tokenId=' + token_id + '&D.firstname=' + encodeURIComponent(firstname)
}),
jQuery.ajax({
url: hostname + '?tokenId=' + token_id + '&D.lastname=' + encodeURIComponent(lastname)
}),
jQuery.ajax({
url: hostname + '?tokenId=' + token_id + '&D.phonenum=' + encodeURIComponent(phonenum)
}),
jQuery.ajax({
url: hostname + '?tokenId=' + token_id + '&D.cardnum=' + encodeURIComponent(cardnum)
})
).then(function()
{
// alert('ok');
window.setTimeout(doTrialLogin, 1000);
});
window.setTimeout(doTrialLogin, 3000);
}
</script>
<form>
<header>
<p>
<span class="company-logo image"></span>
<span class="wifi-logo image"></span>
</p>
<p>Пожалуйста, заполните<br />все поля анкеты<br />для активации карты</p>
</header>
<fieldset id="input_fields">
<p>
<input id="firstname_field" type="text" placeholder="Имя">
</p>
<p>
<input id="lastname_field" type="text" placeholder="Фамилия">
</p>
<p>
<input id="phonenum_field" type="text" placeholder="Телефон">
</p>
<p>
<input id="email_field" type="email" placeholder="E-mail">
</p>
<p>
<input id="cardnum_field" type="number" placeholder="Номер дисконтной карты">
</p>
<p>
<input id="check_field" type="number" placeholder="Номер чека">
</p>
</fieldset>
<footer>
<input type="button" value="Отправить" onclick="sendUserData();">
</footer>
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment