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


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

<!DOCTYPE html>

<head>

    <link rel="stylesheet" type="text/css" href="style.css" />
    <script src="jscript/mainpage.js" type="text/javascript"></script>
    <script src="jquery/jquery-3.1.0/jquery.min.js" type="text/javascript"></script>

    <SCRIPT TYPE="text/javascript">
        $(document).ready(function() {
            $("#del").click(function() {
                if ($('input[type=checkbox]:checked').length < 1) {
                    alert("Select records to delete!");
                    return false;
                }
            });
        });
    </SCRIPT>
</head>

<body>
    <?php
    include("header.php");

    include("sys_module.php");
    get_page_info(basename($_SERVER['PHP_SELF']));

    @$page_mode = "";
    ?>
    <form name="<?php echo @$link_name; ?>" id="<?php echo @$link_name; ?>" action="<?php echo @$link_path; ?>" method="post">
        <div id="page-middle">
            <div class="page-container-head">
                <div id="page-container-titl"><?php echo @$page_mode . " " . @$link_tit; ?></div>
                <div id="page-container-link"><?php echo @$link_but; ?></div>
            </div>
            <div id="page-container-body">
                <div class="grid_outer">
                    <table class="table_grid" border="1">
                        <tr>
                            <th> # </th>
                            <th> Cat. Code </th>
                            <th> Category Name </th>
                            <th> <input type="checkbox" id="CheckAll" name="CheckAll" onClick="check_all(document.itemstype)" /></th>
                        </tr>
                        <?php
                        include("mysql_db_connect.php");
                        $mysql = "select * from masitemtype order by forder";
                        $myres = mysqli_query($mycon, $mysql);
                        $i = 0;
                        while ($row = @mysqli_fetch_assoc($myres)) {
                            if ($i % 2 == 0)
                                $classname = "evenRow";
                            else
                                $classname = "oddRow";

                        ?>
                            <tr class="<?php if (isset($classname)) echo $classname; ?>" ondblClick="window.location='itemstype_save.php?id=<?php echo $row["fitemtype"]; ?>'">
                                <td width="3%" align="center"> <?php echo $i + 1; ?> </td>
                                <td width="10%" align="center"><?php echo $row["fitemtype"]; ?></td>
                                <td width="70%" align="left"><?php echo $row["ftypedesc"]; ?></td>
                                <td width="3%" align="center"><input type="checkbox" name="check_list[]" id="check_list[]" value="<?php echo $row["fitemtype"]; ?>"></td>
                            </tr>
                        <?php
                            $i++;
                        }
                        ?>
                    </table>
                </div>
            </div>
        </div>
    </form>
</body>

</html>

<?php
if (isset($_POST['del'])) { //check to see if the delete button has been pressed
    include("mysql_db_connect.php");
    if (isset($_POST['check_list'])) { //check to see if any boxes have been checked 
        $num = 0; //used to count the number of rows that were deleted
        $box = $_POST['check_list'];
        while (list($key, $val) = @each($box)) { //loop through all the checkboxes
            if (strtoupper($val) == "") {
                echo ("<script language=\"JavaScript\" type=\"text/JavaScript\">\n");
                echo ("alert('Item Type cannot be deleted!');\n");
                echo ("</script>\n");
            } else {
                $num++;
                $mysqldel = "delete from masitemtype where fitemtype='$val'"; //delete any that match id
                $resdel = mysqli_query($mycon, $mysqldel); //send the query to mysql
            }
        }

        if ($num > 0) {
            //print the logs that were deleted
            echo "<meta http-equiv=\"refresh\" content=\"0;URL=itemstype.php\">";
            echo ("<script language=\"JavaScript\" type=\"text/JavaScript\">\n");
            echo ("alert(\"$num\"+' records deleted!');\n");
            echo ("</script>\n");
        }
    } else { //no boxes checked
        echo ("<script language=\"JavaScript\" type=\"text/JavaScript\">\n");
        echo ("alert('No Category selected!');\n");
        echo ("</script>\n");
    }
}
?>