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


Current Path : /var/www/html/oums/src/
Upload File :
Current File : /var/www/html/oums/src/sys_mainphp.php

<?php
$resp_mesg = "";
$resp_stat = "F";
$resp_file = "";

@$load_data = $_POST["load_data"];
if ($load_data == "mail_data") {
    if (filter_var($mail_code, FILTER_VALIDATE_EMAIL)) {
        $resp_stat = "T";
    }
    echo json_encode(array("mesg" => $resp_mesg, "stat" => $resp_stat));
}

function get_time_diff($time1, $time2)
{
    $time1 = strtotime("1/1/1980 $time1");
    $time2 = strtotime("1/1/1980 $time2");

    if ($time2 < $time1) {
        $time2 += 86400;
    }

    return date("H:i", strtotime("1980-01-01 00:00:00") + ($time2 - $time1));
}

function get_dept_name($dept_code)
{
    $dept_name = "";
    include("sys_connect.php");
    $mysql = "select * from masdept where fdeptcode='$dept_code'";
    $myres = mysqli_query($mycon, $mysql);
    while ($row = mysqli_fetch_assoc($myres)) {
        $dept_name = $row['fdeptname'];
    }
    if ($dept_code == '%') {
        $dept_name = "ALL";
    }
    return $dept_name;
}

function get_empl_name($empl_code)
{
    $empl_name = "";
    include("sys_connect.php");
    $mysql = "select * from masempl where femplcode='$empl_code'";
    $myres = mysqli_query($mycon, $mysql);
    while ($row = mysqli_fetch_assoc($myres)) {
        $empl_name = $row['femplname'];
    }
    if ($empl_code == '%') {
        $empl_name = "ALL";
    }
    return $empl_name;
}

function get_desn_name($empl_desn)
{
    $desn_name = "";
    include("sys_connect.php");
    $mysql = "select * from masdesn where fempldesn='$empl_desn'";
    $myres = mysqli_query($mycon, $mysql);
    while ($row = mysqli_fetch_assoc($myres)) {
        $desn_name = $row['fempldesn'];
    }
    if ($empl_desn == '%') {
        $desn_name = "ALL";
    }
    return $desn_name;
}

function get_bank_name($bank_code)
{
    $bank_name = "";
    include("sys_connect.php");
    $mysql = "select * from masbank where fbankcode='$bank_code'";
    $myres = mysqli_query($mycon, $mysql);
    while ($row = mysqli_fetch_assoc($myres)) {
        $bank_name = $row['fbankname'];
    }
    if ($bank_code == '%') {
        $bank_name = "ALL";
    }
    return $bank_name;
}

function get_clnt_name($clnt_code)
{
    $clnt_name = "";
    include("sys_connect.php");
    $mysql = "select * from masclient where fclntcode='$clnt_code'";
    $myres = mysqli_query($mycon, $mysql);
    while ($myrow = mysqli_fetch_assoc($myres)) {
        $clnt_name = $myrow['fclntname'];
    }
    if ($clnt_code == '%') {
        $clnt_name = "ALL";
    }
    return $clnt_name;
}

function get_type_desc($work_type)
{
    $type_desc = "";
    include("sys_connect.php");
    $mysql = "select * from maswork_type where fworktype='$work_type'";
    $myres = mysqli_query($mycon, $mysql);
    while ($myrow = mysqli_fetch_assoc($myres)) {
        return $type_desc = $myrow['ftypedesc'];
    }
    if ($work_type == '%') {
        return $type_desc = "ALL";
    }
}

function set_user_logs($dept_id, $user_id, $logs_type, $logs_remk)
{
    include("sys_connect.php");
    $user_ip = $_SERVER['REMOTE_ADDR'];
    $user_mc = get_mcid();

    $mysql = "insert into sys_logs (fdeptcode,fusercode,flogsdate,flogsipad,flogsmcad,flogstype,fremarks,fdeleted) 
    values('$dept_id','$user_id',now(),'$user_ip','$user_mc','$logs_type','$logs_remk','F')";
    $myres = mysqli_query($mycon, $mysql);

    if ($logs_type == 'LOGI') {
        $mysql = "update masempl set flastlogi = now() where ifnull(fusercode,'-')='$user_id'";
        $myres = mysqli_query($mycon, $mysql);
    }

    if ($logs_type == 'LOGO') {
        $mysql = "update masempl set flastlogo = now() where ifnull(fusercode,'-')='$user_id'";
        $myres = mysqli_query($mycon, $mysql);
    }
}


if ($load_data == "page_data") {
    $file_name = $_POST['file_name'];
    include("sys_connect.php");
    $mysql = "select * from sys_menu where fmenulink='$file_name'";
    $myres = mysqli_query($mycon, $mysql);
    while ($row = mysqli_fetch_assoc($myres)) {
        $page_titl = $row['fmenuname'];
        $grid_rows = $row['fgridrows'];

        $page_link = "";
        if ($row['flinkaddn'] == 'T') {
            $page_link .= "<a id='btn_addn' class='btn btn-primary btn-sm' href=# onClick='addn_data();'><span class='glyphicon glyphicon-plus'></span> Add </a>";
        }
        if ($row['flinkedit'] == 'T') {
            $page_link .= "<a id='btn_edit' class='btn btn-primary btn-sm' href=# onClick='edit_data();'><span class='glyphicon glyphicon-edit'></span> Edit </a>";
        }
        if ($row['flinkdele'] == 'T') {
            $page_link .= "<a id='btn_dele' class='btn btn-danger btn-sm' href=# onClick='dele_data();'><span class='glyphicon glyphicon-trash'></span> Delete </a>";
        }
        if ($row['flinksave'] == 'T') {
            $page_link .= "<a id='btn_save' class='btn btn-success btn-sm' href=# onClick='save_data();'><span class='glyphicon glyphicon-save'></span> Save </a>";
        }
        if ($row['flinkrept'] == 'T') {
            $page_link .= "<a id='btn_rept' class='btn btn-info btn-sm' href=# onClick='rept_data();'><span class='glyphicon glyphicon-list-alt'></span> Report </a>";
        }
        if ($row['flinkview'] == 'T') {
            $page_link .= "<a id='btn_view' class='btn btn-info btn-sm' href=# onClick='view_data();'><span class='glyphicon glyphicon-list'></span> View </a>";
        }
        if ($row['flinkcncl'] == 'T') {
            $page_link .= "<a id='btn_cncl' class='btn btn-danger btn-sm' href=# onClick='cncl_data();'><span class='glyphicon glyphicon-remove'></span> Cancel</a>";
        }
        if ($row['flinkclrs'] == 'T') {
            $page_link .= "<a id='btn_clrs' class='btn btn-danger btn-sm' href=# onClick='clrs_data();'><span class='glyphicon glyphicon-refresh'></span> Clear </a>";
        }
    }
    echo json_encode(array("mesg" => $resp_mesg, "stat" => $resp_stat, "file" => $resp_file, "titl" => $page_titl, "rows" => $grid_rows, "lnks" => $page_link));
}


function get_mcid()
{
    ob_start(); // Turn on output buffering
    system('ipconfig /all');    //Get the ipconfig details using system commond
    $sys_con = ob_get_contents();   // Capture the output into a variable
    ob_clean(); // Clean (erase) the output buffer
    $str_pos = strpos($sys_con, "Physical");        //Search the "Physical" | Find the position of Physical text
    $mac_add = substr($sys_con, ($str_pos + 36), 17);       // Get Physical Address
    return $mac_add;        //return Mac Address
}


function validate_string($input_text)
{
    $input_text = preg_replace("/\r\r\r\r|\n\n\n\n/", "\n", $input_text);
    $input_text = preg_replace("/\r\r\r|\n\n\n/", "\n", $input_text);
    $input_text = strtoupper(preg_replace("/\r\r|\n\n/", "\n", $input_text));
    $input_text = str_replace("'", '`', $input_text);
    $input_text = str_replace('  ', ' ', $input_text);
    $input_text = str_replace(' ,', ',', $input_text);

    return $input_text;
}