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


Current Path : /proc/thread-self/root/var/www/html/college/js/
Upload File :
Current File : //proc/thread-self/root/var/www/html/college/js/backup.js

function viewAll() {
  $("#page_main_div").load("../html_modules/krvw.html", function () {
    document.getElementById("display_module_name").innerHTML =
      " Database Backup ";
    document.getElementById("module_name_for_save").value = "Database Backup";
    getDefaultHeadFooterLinks("Database Backup");

    if (location.protocol != "https:") {
      var protocol = "http://";
    } else {
      //var protocol = "https://";
      var protocol = "https://";
    }

    // var urlarr = window.location.pathname.split("/");
    // var $url = protocol + window.location.host + "/";
    // var $hoststr = "";
    // for (var j = 1; j < urlarr.length - 1; j++) {
    //   $hoststr += window.location.pathname.split("/")[j] + "/";
    // }
    // $host_url = $url + $hoststr + "app.php?a=";
    // $image_path = $url + $hoststr + "jqGrid3.5/cmes/tarka/images/";

    $.ajax({
      type: "post",
      url: $host_url + "connect.demo",
      success: function ($responce) {
        $responce = JSON.parse($responce);
        // console.log($responce.table);
        $data = $responce.database;
        // console.log($responce.database);
        // var count = $data.length;
        var new_row = "";
        var arrIndex = 0;

        // for (var countRows = 1; countRows <= count; countRows++) {
        //   var Databasename = $responce.database[arrIndex];
        //   new_row +=
        //     "<tr><td style='width:250px; margin-left:250px; border:1px solid #C5DBEC;padding:5px; font-size:15px; ' type='text' >" +
        //     Databasename +
        //     "</td>";
        //   new_row +=
        //     "<td style='width:30px;border:1px solid #C5DBEC;padding:5px;text-align:center;' type='text' ><input name='recstore' type='checkbox' value='" +
        //     Databasename +
        //     "' onclick = 'checkdb(this.id)' id='recstore" +
        //     countRows +
        //     "'/></td></tr>";
        //   ++arrIndex;
        // }
        // $("#table").append(new_row);
        $("#dbdownload").html($responce.table);
      },
    });
  });
}

function checkdb(id) {
  var checkboxes = document.getElementsByTagName("input");

  for (var i = 0; i < checkboxes.length; i++) {
    if (checkboxes[i].type == "checkbox" && id != checkboxes[i].id) {
      checkboxes[i].checked = false;
    }
  }
}

function backupdb() {
  var inputFileds = document.getElementsByTagName("input");

  var sendarr = new Array();
  var chkCnt = 0;
  var k = 0;
  for (var counter = 0; counter < inputFileds.length; counter++) {
    if (
      inputFileds[counter].type.toUpperCase() == "CHECKBOX" &&
      inputFileds[counter].name == "recstore"
    ) {
      ++chkCnt;
      if (document.getElementById("recstore" + chkCnt).checked == true) {
        sendarr[k] = document.getElementById("recstore" + chkCnt).value;
        ++k;
      }
    }
  }

  if (location.protocol != "https:") {
    var protocol = "http://";
  } else {
    //var protocol = "https://";
    var protocol = "http://";
  }

  var urlarr = window.location.pathname.split("/");
  var $url = protocol + window.location.host + "/";
  var $hoststr = "";
  for (var j = 1; j < urlarr.length - 1; j++) {
    $hoststr += window.location.pathname.split("/")[j] + "/";
  }
  $host_url = $url + $hoststr + "app.php?a=";
  $image_path = $url + $hoststr + "jqGrid3.5/cmes/tarka/images/";

  var myJSONText = sendarr;
  $.blockUI({
    message:
      "<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>",
  });
  $.ajax({
    type: "POST",
    url: $host_url + "backupdb.demo",
    data: "&sendarr=" + myJSONText,
    success: function ($responce) {
      $.unblockUI();

      document.getElementById("dlink").innerHTML = $responce;
    },
  });
}
function check_backup() {
  // console.log('hy');
  // return;
  let jsonObj = [];

  var checkboxes = $("#tabs input[type=checkbox]");

  let final_arr = [];
  let exam_app = [
    "admfeestr",
    "appcandsum",
    "appstudfee",
    "appcanddet",
    "candsum",
    "canddet",
    "studfee",
    "degcntr",
  ];
  let marks = ["collia", "marks", "marks_pr", "practical_entry_freeze"];
  let results = [
    "res_fee",
    "resmarks",
    "resmarksdet",
    "res_stud",
    "res_studsum",
  ];
  let exam_prep = [
    "room_allotment",
    "colldesp",
    "absent",
    "ansstud",
    "masroom",
  ];
  let convo = ["dctran", "dcstud"];
  let online_service = [
    "servtran",
    "servproc",
    "servfeestr",
    "servfee",
    "servdetl",
    "servtype",
  ];
  let tdvs = [
    "tdvs_abreq",
    "tdvs_check",
    "tdvs_control",
    "tdvs_deggrp",
    "tdvs_masboard",
    "tdvs_mascomp",
    "tdvs_masdev",
    "tdvs_masmenu",
    "tdvs_masqp",
    "tdvs_masrev",
    "tdvs_masteach",
    "tdvs_qptempdetl",
    "tdvs_qptemphead",
    "tdvs_tabdetl",
    "tdvs_tabhead",
    "tdvs_tabpkt",
    "tdvs_tabsum",
    "tdvs_tabulate",
    "tdvs_tabuser",
    "tdvs_valcntr",
  ];
  let masters = [
    "degree",
    "subject",
    "student",
    "college",
    "colldeg",
    "collexam",
  ];

  // deg subject , student, college, colldeg, collexam,

  // if (checkboxes.length == "0") {
  //   alert("Plaese Select Table");
  //   return;
  // }

  let bkname = "";
  for (var i = 0, n = checkboxes.length; i < n; i++) {
    if (checkboxes[i].checked) {
      item = {};

      item["id"] = checkboxes[i].id;
      item["value"] = "Yes";
      jsonObj.push(item);
    } else {
      item = {};

      item["id"] = checkboxes[i].id;
      item["value"] = "No";
      jsonObj.push(item);
    }
  }

  for (var i = 0; i < jsonObj.length; i++) {
    if (jsonObj[i].value == "Yes" && jsonObj[i].id == "exam_app") {
      exam_app.map((el, i) => {
        return final_arr.push(el);
      });
      bkname += "exam_app_";
    }
    if (jsonObj[i].value == "Yes" && jsonObj[i].id == "marks") {
      marks.map((el, i) => {
        return final_arr.push(el);
      });
      bkname += "marks_";
    }
    if (jsonObj[i].value == "Yes" && jsonObj[i].id == "results") {
      results.map((el, i) => {
        return final_arr.push(el);
      });
      bkname += "results_";
    }
    if (jsonObj[i].value == "Yes" && jsonObj[i].id == "exam_prep") {
      exam_prep.map((el, i) => {
        return final_arr.push(el);
      });
      bkname += "exam_prep_";
    }
    if (jsonObj[i].value == "Yes" && jsonObj[i].id == "convo") {
      convo.map((el, i) => {
        return final_arr.push(el);
      });
      bkname += "convo_";
    }
    if (jsonObj[i].value == "Yes" && jsonObj[i].id == "online_service") {
      online_service.map((el, i) => {
        return final_arr.push(el);
      });
      bkname += "online_service_";
    }
    if (jsonObj[i].value == "Yes" && jsonObj[i].id == "tdvs") {
      tdvs.map((el, i) => {
        return final_arr.push(el);
      });
      bkname += "tdvs_";
    }
    if (jsonObj[i].value == "Yes" && jsonObj[i].id == "masters") {
      masters.map((el, i) => {
        return final_arr.push(el);
      });
      bkname += "masters_";
    }
  }
  // console.log(final_arr.length);
  // return;
  if (final_arr.length == 0) {
    alert("Please Select Atlest One Table");
    return;
  }
  var final_array = JSON.stringify(final_arr);
  // console.log(final_array);
  // return;

  $.blockUI({
    message:
      "<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>",
  });

  $.ajax({
    type: "POST",
    url: $host_url + "backupdb_1.demo",
    data: "&final_array=" + final_array + "&bkname=" + bkname,
    // data: "&sendarr=" + myJSONText,
    success: function (responce) {
      var response = JSON.parse(responce);
      // console.log(response);
      alert(response.status);
      $.unblockUI();
      viewAll();
    },
  });
}

function delete_zip(del) {
  // console.log(del);
  // return;
  var r = confirm("Are you Sure ?");
  if (r === true) {
    $.ajax({
      type: "POST",
      url: $host_url + "delete_zip.demo",
      data: "&del=" + del,

      success: function (responce) {
        var response = JSON.parse(responce);

        if (response == 1) {
          viewAll();
          return;
        }
      },
    });
  } else {
    return;
  }
}