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


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

<!DOCTYPE html>

<head>

    <link rel="shortcut icon" type="image/x-icon" href="images/logisys-icon.png" />
    <link rel="stylesheet" type="text/css" href="style.css" />
    <script src="jscript/mainpage.js" type="text/javascript"></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> Agent Code </th>
                            <th> Agent Name </th>
                            <th> Address </th>
                            <th> Mobile No. </th>
                            <th> Email ID </th>
                            <th> <input type="checkbox" id="CheckAll" name="CheckAll" onClick="<?php echo "check_all(document." . $link_name; ?> )" /></th>
                        </tr>
                        <?php
                        include("mysql_db_connect.php");
                        $mysql = "select * from massupplier order by fagencode";
                        $myres = mysqli_query($mycon, $mysql);
                        $i = 0;
                        while ($row = @mysqli_fetch_assoc($myres)) {
                        ?>
                            <tr ondblClick="window.location='agents_save.php?id=<?php echo $row["fagencode"]; ?>'">
                                <td width="3%" align="center"> <?php echo $i + 1; ?> </td>
                                <td width="10%" align="center"><?php echo $row["fagencode"]; ?></td>
                                <td width="20%" align="left"><?php echo $row["fagenname"]; ?></td>
                                <td width="25%" align="left"><?php echo $row["fagenaddr"]; ?></td>
                                <td width="15%" align="left"><?php echo $row["fagenmobl"]; ?></td>
                                <td width="20%" align="left"><?php echo $row["fagenmail"]; ?></td>
                                <td width="3%" align="center"><input type="checkbox" name="check_list[]" id="check_list[]" value="<?php echo $row["fagencode"]; ?>"></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
    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('agents cannot be deleted!');\n");
                echo ("</script>\n");
            } else {
                $num++;
                include("mysql_db_connect.php");
                $mysqldel = "delete from massupplier where fagencode='$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=agents.php\">";
            echo ("<script language=\"JavaScript\" type=\"text/JavaScript\">\n");
            echo ("alert(\"$num\"+' agents deleted!');\n");
            echo ("</script>\n");
        }
    } else { //no boxes checked
        echo ("<script language=\"JavaScript\" type=\"text/JavaScript\">\n");
        echo ("alert('No agents selected!');\n");
        echo ("</script>\n");
    }
}
?>