$.validator.setDefaults({
submitHandler: function() {
}
});
$().ready(function() {
$("#Register").validate({
rules: {
mobile: {
required: true,
minlength: 10
},
password: {
required: true,
minlength: 1
},
rcode: {
required: false,
minlength: 6
},
remember: "required",
},
messages: {
password: {
required: "Please provide a password",
minlength: "Your password must be at least 1 characters long"
},
remember: "Please accept our policy",
}
});
});
$().ready(function() {
$("#loginForm").validate({
rules: {
login_mobile: {
required: true,
minlength: 10
},
login_password: {
required: true,
minlength: 1
},
},
messages: {
password: {
required: "Please provide a password",
minlength: "Your password must be at least 1 characters long"
},
remember: "Please accept our policy",
}
});
});
$(document).ready(function () {
$("#Register").on('submit',(function(e) {
e.preventDefault();
var mobile = $('input#mobile').val();
var password = $('input#password').val();
var rcode = $('input#rcode').val();
if ((mobile)== "") {
$("input#mobile").focus();
$('#mobile').addClass('borderline');
return false;
}
if (mobile.length<10) {
$("input#mobile").focus();
$('#mobile').addClass('borderline');
return false;
}
if ((password)= "") {
$("input#password").focus();
$('#password').addClass('borderline');
return false;
}
if (password.length<1) {
$("input#password").focus();
$('#password').addClass('borderline');
return false;
}
if ((rcode)== "") {
$("input#rcode").focus();
$('#rcode').addClass('borderline');
return false;
}
if($('#remember').is(':checked')){}
else{return false;}
$.ajax({
type: "POST",
url: "registerNow.php",
data: new FormData(this),
contentType: false,
cache: false,
processData:false,
success: function(html)
{ //alert('test');
var arr = html.split('~');
if (arr[0]== 1) {
$("#Register")[0].reset();
window.location.href = "successvisitorNow";
$('#registerthanksPopup').modal({backdrop: 'static', keyboard: false})
$('#registerthanksPopup').modal('show');
}
else if (arr[0]== 2) {
document.getElementById('regtoast').innerHTML = ('Mobile Number allready register with us !');
$('#registertoast').modal({backdrop: 'static', keyboard: false})
$('#registertoast').modal('show');
}
else if (arr[0]== 3) {
document.getElementById('regtoast').innerHTML = ('Wrong recommendation code enter !');
$('#registertoast').modal({backdrop: 'static', keyboard: false})
$('#registertoast').modal('show');
}
else if (arr[0]== 4) {
document.getElementById('regtoast').innerHTML = ('Please verify your mobile no. !');
$('#registertoast').modal({backdrop: 'static', keyboard: false})
$('#registertoast').modal('show');
}
else if(arr[0]==0)
{ document.getElementById('serror').innerHTML = ('Some Technical error !');
}
}
});
}));
$("#loginForm").on('submit',(function(e) {
e.preventDefault();
var loginmobile = $('input#login_mobile').val();
var loginpassword = $('input#login_password').val();
if ((loginmobile)== "") {
$("input#login_mobile").focus();
$('#login_mobile').addClass('borderline');
return false;
}
if (loginmobile.length<8) {
$("input#login_mobile").focus();
$('#login_mobile').addClass('borderline');
return false;
}
if ((loginpassword)== "") {
$("input#login_password").focus();
$('#login_password').addClass('borderline');
return false;
}
if (loginpassword.length<1) {
$("input#login_password").focus();
$('#login_password').addClass('borderline');
return false;
}
$.ajax({
type: "POST",
url: "loginNow.php",
data: new FormData(this),
contentType: false,
cache: false,
processData:false,
success: function(html)
{ //alert(html);
var arr = html.split('~');
if (arr[0]== 1) {
window.location.href = "myaccount";
}
else if(arr[0]==0)
{ document.getElementById('regtoast').innerHTML = ('Your Mobile & Password are invalid ');
$('#registertoast').modal({backdrop: 'static', keyboard: false})
$('#registertoast').modal('show');
}
else if(arr[0]==2)
{ document.getElementById('regtoast').innerHTML = ('Your Id is temporarily ban please contact admin at colorwinner01@gmail.com ');
$('#registertoast').modal({backdrop: 'static', keyboard: false})
$('#registertoast').modal('show');
}
else if(arr[0]==3)
{ document.getElementById('regtoast').innerHTML = ('Your Id is temporarily disable ');
$('#registertoast').modal({backdrop: 'static', keyboard: false})
$('#registertoast').modal('show');
}
}
});
//=====================change password================================================================
}));
//================================================match otp===================================================
$("#otpsubmitForm").on('submit',(function(e) {
e.preventDefault();
var otp = $('input#otp').val();
if ((otp)== "") {
$("input#otp").focus();
$('#otp').addClass('borderline');
return false;
}
$.ajax({
type: "POST",
url: "veryfynumberNow.php",
data: new FormData(this),
contentType: false,
cache: false,
processData:false,
success: function(html)
{ //alert(html);
var arr = html.split('~');
if (arr[0]== 1) {
$("#otpclose").click();
document.getElementById('regtoast').innerHTML = ('OTP match successfully !');
$('#registertoast').modal({backdrop: 'static', keyboard: false})
$('#registertoast').modal('show');
$('#mobile').attr('readonly', true);
}
else if(arr[0]==0)
{ document.getElementById('regtoast').innerHTML = ('Wrong OTP Entered !');
$('#registertoast').modal({backdrop: 'static', keyboard: false})
$('#registertoast').modal('show');
}
}
});
//=====================change password================================================================
}));
});
function mobileveryfication(){
var mobile = $('input#mobile').val();
if ((mobile)== "") {
$("input#mobile").focus();
$('#mobile').addClass('borderline');
return false;
}
if (mobile.length<10) {
$("input#mobile").focus();
$('#mobile').addClass('borderline');
return false;
}
$.ajax({
type: "Post",
data:"mobile=" + mobile+ "& type=" + "mobile",
url: "veryfynumberNow.php",
success: function (html) {
//alert(html);
var arr = html.split('~');
if (arr[0]== 1) {
//data = JSON.parse(arr[1])
//alert(data.Status);
//alert(data.Details);
$('#otpform').modal({backdrop: 'static', keyboard: false})
$('#otpform').modal('show');
}
else if (arr[0]== 2) {
document.getElementById('regtoast').innerHTML = ('Mobile Number allready register with us !');
$('#registertoast').modal({backdrop: 'static', keyboard: false})
$('#registertoast').modal('show');
}
return false;
},
error: function (e) {}
});
}