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.222.184.207


Current Path : /var/www/html/jssu/js22.04.2016/
Upload File :
Current File : /var/www/html/jssu/js22.04.2016/index.js

//var $host_url='http://10.10.200.172/activity/app.php?a=';
//var $image_path='http://10.10.200.172/activity/libs/jquery/themes/basic/images/';
 var $host_url="http://"+window.location.host+"/"+window.location.pathname.split('/')[1]+"/app.php?a=";
var $image_path="http://"+window.location.host+"/"+window.location.pathname.split('/')[1]+"/jqGrid3.5/css/images/"; 
function trim($str)
{
  return $str.replace(/^\s*|\s*$/g,"");
}
		function loadwindow()
		{
		
			
			 CheckIE6Version();
			if(getCookie('username'))
			{
				document.getElementById('user_name').value = getCookie('username');
			}
			else
			{
			   document.getElementById('user_name').value ='Username';
			}
			if(getCookie('pswd'))
			{
				//document.getElementById('password').value = getCookie('pswd');
			}
			else
			{
			   document.getElementById('password').value ='******';
			}
			if(getCookie('college_code'))
			{
				document.getElementById('college_code').value = getCookie('college_code');
			}
			else
			{
			   document.getElementById('college_code').value ='CollegeCode';
			}
		}
		
			
		function validate()
		{
			
			return true;
		}
		
		function login()
		{
		
			if(trim(document.getElementById('user_name').value) == '')
			{
				alert("Please enter Username");
				document.getElementById('user_name').focus();
				return ;
				
			}
			else if(trim(document.getElementById('password').value) == '')
			{
				alert("Please enter Password");
				document.getElementById('password').focus();
				return ;
			}
			if(CheckIE6Version())
			{
				var college_code = document.getElementById('college_code').value;
				var user_name = (document.getElementById('user_name').value);
				var password = (document.getElementById('password').value);
				var $parameters = "usr="+user_name+"&password="+password+"&login_college_code="+college_code;
					$.ajax({
					url: $host_url+"validateUsernameAndPassword.demo",
					data:$parameters,
					success: validateUsernameAndPasswordResponse
				});
			}
		}	
			
				
		function validateUsernameAndPasswordResponse($responce)
		{
			$responce = eval('(' + $responce + ')');
			if ($responce.error_code == -1)
			{
				document.getElementById('user_name').focus();
				document.getElementById('password').value = '';				
				alert($responce.data);
			}
			else
			{
			
			var user_type=$responce.data.user_type;
			var user_id=$responce.data.internal_code;
			var college_name=$responce.data.college_name;
			var university_name=$responce.data.university_name;
			var real_name=$responce.data.real_name;
			
			var can_edit_help_text=$responce.data.can_edit_help_text;
			 
				var a_p = "";
				var d = new Date();
				var curr_hour = d.getHours();
				if (curr_hour < 12)
				a_p = "AM";
				else
				a_p = "PM";
				
				if (curr_hour == 0)
				{
					curr_hour = 12;
				}
				if (curr_hour > 12)
				{
					curr_hour = curr_hour - 12;
				}
				var curr_min = d.getMinutes();
				var login_time =  curr_hour + ":" + curr_min + " " + a_p;
			
				var cookie_value = "username="+document.getElementById('user_name').value+"&pswd="+document.getElementById('password')+"&adminlogin="+document.getElementById('user_name').value+"&userlogintime="+login_time;
				setCookie("Qx0",cookie_value,1);
				setCookie("username",trim(document.getElementById('user_name').value),1);
				setCookie("college_code",trim(document.getElementById('college_code').value),1);
				setCookie("login_time",login_time,1);
				//setCookie("login_date",login_date,1);
				setCookie("user_type",user_type,1);
				setCookie("college_name",college_name,1);
				setCookie("pswd",trim(document.getElementById('password').value),1); 
				setCookie("host_url",$host_url,1);
				setCookie("image_path",$image_path,1);
				setCookie("university_name",university_name,1);
				setCookie("real_name",real_name,1);
				setCookie("user_id",user_id,1);
				window.location.href="MainPage.html";				
				
			}
		}
		
		function setCookie(c_name,value,expiredays)
		{
			var exdate=new Date()
			exdate.setDate(exdate.getDate()+expiredays)
			document.cookie=c_name+ "=" +escape(value)+
			((expiredays==null) ? "" : ";expires="+exdate.toGMTString())
		}
		
		function getCookie(c_name)
		{
			if (document.cookie.length>0)
			  {
			  c_start=document.cookie.indexOf(c_name + "=")
			  if (c_start!=-1)
			    { 
			    c_start=c_start + c_name.length+1 
			    c_end=document.cookie.indexOf(";",c_start)
			    if (c_end==-1) c_end=document.cookie.length
			    return unescape(document.cookie.substring(c_start,c_end))
			    } 
			  }
			return "";
		}
		
		function dologin(event)
		{
			if (event.keyCode == 13)
				login();
		}
		 
function CheckIE6Version()
{
var BrowserType = BrowserDetect.browser;
var BrowserVersion = BrowserDetect.version;
if(BrowserType=="Explorer" && BrowserVersion==6)  
	{
	alert(" You are using IE6 Version,Use Mozilla Firefox or IE8");
	return false;			 
	}  
	return true;
}