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 : 3.129.73.6


Current Path : /var/www/html/studentportal_wait/js/
Upload File :
Current File : /var/www/html/studentportal_wait/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").html(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()
{
    
	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;
    }
    if(!$('#validateForm').valid()){
        return;
    }
    var parameters = "&regno="+regno+"&univcode="+univcode;
    $.ajax({
        type: 'post',
        url: 'validateRegno.php',
        data: parameters,
        success: function(response)
        {
        	response = eval('(' + response + ')');
            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()
{
    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 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;
    }
    var parameters = "&regno="+regno+"&univcode="+univcode+"&passwd="+cpasswd.toUpperCase()
                        +"&mob="+mobile+"&email="+email;
    $.ajax({
        type: 'post',
        url: 'registration.php',
        data: parameters,
        success: function(response)
        {
            if(response == 'success')
            {
                window.location.href = "index.html";
            }
            else
            {

            }
        } 
    });
}