0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 18.190.239.189


Current Path : /var/www/html/gcg/adm/admin/js/
Upload File :
Current File : /var/www/html/gcg/adm/admin/js/registration.js

var universityResp;
function loadmaster()
{
    var email = getUrlParameter('email');
    var mobile = getUrlParameter('mob');
    var hash = getUrlParameter('hash');

    var parameters = "&email="+email+"&mob="+mobile+"&hash="+hash;
    $.ajax({
        type: 'post',
        url: 'validateEmail.php',
        data: parameters,
        success: function(response)
        {
            if(response == 'failure')
            {
                $("#signupform").css("display","none");
                $("#signup_err").css("display","block");
            }
            else
            {
                response = JSON.parse(response);
                //console.log(response.state);
                var opstate = "<option value=''>--SELECT--</option>";
            	for(var i=0;i<response.state.length;i++)
                {
                    var state = response.state[i];
                    opstate += "<option value='"+state.fstate+"'>"+state.fstate+"</option>";
                }
                $("#state").append(opstate)
                universityResp = response.university;
            }
        } 
    });
}

$("#state").change(function(){
    var univ = this.value;
    var matchuniv = universityResp.filter(function(el){
        return el.fstate == univ;
    })
    var opstate = "<option value=''>--SELECT--</option>";
    for(var i=0;i<matchuniv.length;i++)
    {
        var university = matchuniv[i];
        opstate += "<option value='"+university.funivcode+"'>"+university.funivname+"</option>";
    }
    $("#univ").append(opstate);
})


var getUrlParameter = function getUrlParameter(sParam) {
    var sPageURL = decodeURIComponent(window.location.search.substring(1)),
        sURLVariables = sPageURL.split('&'),
        sParameterName,
        i;
    for (i = 0; i < sURLVariables.length; i++) {
        sParameterName = sURLVariables[i].split('=');

        if (sParameterName[0] === sParam) {
            return sParameterName[1] === undefined ? true : sParameterName[1];
        }
    }
};

function validateRegno()
{
    if(!$('#validateForm').valid()){
        console.log('invalid');
        return;
    }
	var state = document.getElementById("state").value;
	var univ = document.getElementById("univ").value;
	var regno = document.getElementById("regno").value;
	var univcode = univ;
	
    if(state == '')
    {
        alert('Select State');
        document.getElementById('state').focus();
        return;
    }
    if(univ == '')
    {
        alert('Select University');
        document.getElementById('univ').focus();
        return;
    }
    var parameters = "&regno="+regno+"&univcode="+univcode;
    $.ajax({
        type: 'post',
        url: 'validateRegno.php',
        data: parameters,
        success: function(response)
        {
        	//$("#perdet").css('display','block');
        	response = eval('(' + response + ')');
        	console.log(response.status);
            if(response.status == 'success')
            {
                $('#validateForm').hide();
            	$("#name").html(response.fname);
            	$("#fatname").html(response.ffather);
                var category = response.category;
                var opcat = "<option value=''>--SELECT--</option>";
                for(var i=0;i<category.length;i++)
                {
                    var cat = category[i];
                    opcat += "<option value='"+cat.fcategory+"'>"+cat.fdescpn+"</option>";
                }
                 $("#category").append(opcat);

                $("#perdet").css('display','block');
                $("#perdeterr").css('display','none');
            }
            else
            {
                $("#perdeterr").html("You are not registered to any of our Universities");
                $("#perdeterr").css('display','block');
                $("#perdet").css('display','none');
            }
        } 
    });
}

function register()
{
    $('#perdet').valid({
        rules: {
            'terms': {
                required: true
            },
            'confirm': {
                equalTo: '[name="password"]'
            }
        },
        highlight: function (input) {
            console.log(input);
            $(input).parents('.form-line').addClass('error');
        },
        unhighlight: function (input) {
            $(input).parents('.form-line').removeClass('error');
        },
        errorPlacement: function (error, element) {
            $(element).parents('.input-group').append(error);
            $(element).parents('.form-group').append(error);
        }
    });
    var email = getUrlParameter('email');
    var mobile = getUrlParameter('mob');
	var state = document.getElementById("state").value;
	var univ = document.getElementById("univ").value;
	var regno = document.getElementById("regno").value;
    var cpasswd = document.getElementById("cpassword").value;
    var passwd = document.getElementById("password").value;
    var category = document.getElementById("category").value;
    var feetype = document.getElementById("feetype").value;//
    var univcode = univ;
    if( cpasswd !== passwd)
    {
        alert("you have confirmed the wrong password");
        document.getElementById('cpassword').focus();
        return;
    }
    if( cpasswd.length < 8)
    {
        alert("password should be greater than 8 charecters");
        document.getElementById('password').focus();
        return;
    }
    if(category == '')
    {
        alert("Select category");
        document.getElementById('category').focus();
        return;
    }
    var parameters = "&regno="+regno+"&univcode="+univcode+"&passwd="+cpasswd
                        +"&mob="+mobile+"&email="+email+"&category="+category
                        +"&feetype="+feetype;
    console.log(parameters);
    $.ajax({
        type: 'post',
        url: 'registration.php',
        data: parameters,
        success: function(response)
        {
            if(response == 'success')
            {
                window.location.href = "index.html";
            }
            else
            {

            }
        } 
    });
}