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


Current Path : /var/www/html/cnv/kus/js/
Upload File :
Current File : /var/www/html/cnv/kus/js/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 path_name =
  window.location.pathname.split("/")[1] +
  "/" +
  window.location.pathname.split("/")[2];
if (
  path_name == "index.html" ||
  path_name == "admin.php" ||
  path_name == "admin_login.php"
)
  path_name = "";
var $host_url =
  "https://" + window.location.host + "/" + path_name + "/app.php?a=";

function trim($str) {
  return jQuery.trim($str);
}
function logout() {
  $.ajax({
    type: "POST",
    async: false,
    url: $host_url + "logout.demo",
    data: "",
    success: logoutResponce
  });
}
function logoutResponce($responce) {
  $responce = eval("(" + $responce + ")");
}

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;
  }
  var username = document.getElementById("user_name").value;
  var password = document.getElementById("password").value;
  var $parameters = "usr=" + username + "&password=" + password;
  $.ajax({
    type: "POST",
    url: $host_url + "validateUsernameAndPassword",
    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 {
    window.location.href = "AdminMainPage.php";
  }
}
function dologin(event) {
  if (event.keyCode == 13) login();
}

function collegelogin() {
  if (trim(document.getElementById("college_code").value) == "") {
    alert("Please enter College code");
    document.getElementById("college_code").focus();
    return;
  }

  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;
  }
  var collcode = document.getElementById("college_code").value;
  var username = document.getElementById("user_name").value;
  var password = document.getElementById("password").value;
  var $parameters =
    "usr=" + username + "&password=" + password + "&collcode=" + collcode;
  $.ajax({
    type: "POST",
    url: $host_url + "validateCollUsernameAndPassword",
    data: $parameters,
    success: validateCollUsernameAndPasswordResponse
  });
}

function validateCollUsernameAndPasswordResponse($responce) {
  $responce = eval("(" + $responce + ")");
  if ($responce.error_code == -1) {
    document.getElementById("college_code").focus();
    document.getElementById("password").value = "";
    alert($responce.data);
  } else {
    window.location.href = "CollegeMainPage.php";
  }
}
function dologincoll(event) {
  if (event.keyCode == 13) collegelogin();
}