[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: vendors.php
<?php include("db/db.php");?> <?php include("includes/functions/functions.php");?> <?php if(!isset($_SESSION['name_Xw211qAAsq4'])){ header('Location: index'); exit(); } else{ $username = $_SESSION['name_Xw211qAAsq4']; if(isset($_POST['del'])){ $ID = mysqli_real_escape_string($new,$_POST['SID']); $DEL = mysqli_query($new,"DELETE FROM admin_vendors WHERE vendor_id = '$ID'"); $DELr = mysqli_query($new,"DELETE FROM expenses WHERE vendor_id = '$ID'"); } if(isset($_POST['update'])){ $vendor_name = filter_input(INPUT_POST, 'vendor_name', FILTER_SANITIZE_STRING); $vendor_name = htmlspecialchars($vendor_name, ENT_QUOTES, 'UTF-8'); $vendor_email = filter_input(INPUT_POST, 'vendor_email', FILTER_SANITIZE_STRING); $vendor_email = htmlspecialchars($vendor_email, ENT_QUOTES, 'UTF-8'); $phone = filter_input(INPUT_POST, 'phone', FILTER_SANITIZE_STRING); $phone = htmlspecialchars($phone, ENT_QUOTES, 'UTF-8'); $address = filter_input(INPUT_POST, 'address', FILTER_SANITIZE_STRING); $address = htmlspecialchars($address, ENT_QUOTES, 'UTF-8'); $vid = filter_input(INPUT_POST, 'vid', FILTER_SANITIZE_STRING); $vid = htmlspecialchars($vid, ENT_QUOTES, 'UTF-8'); $stmt_update_service = $con->prepare("UPDATE admin_vendors SET vendor_name = ?,vendor_email = ?,phone = ?,address = ? WHERE vendor_id = ?"); $stmt_update_service->execute(array($vendor_name,$vendor_email,$phone,$address,$vid)); } $error_message = ""; if(isset($_POST['insert'])){ $vendor_name = filter_input(INPUT_POST, 'vendor_name', FILTER_SANITIZE_STRING); $vendor_name = htmlspecialchars($vendor_name, ENT_QUOTES, 'UTF-8'); $vendor_email = filter_input(INPUT_POST, 'vendor_email', FILTER_SANITIZE_STRING); $vendor_email = htmlspecialchars($vendor_email, ENT_QUOTES, 'UTF-8'); $phone = filter_input(INPUT_POST, 'phone', FILTER_SANITIZE_STRING); $phone = htmlspecialchars($phone, ENT_QUOTES, 'UTF-8'); $address = filter_input(INPUT_POST, 'address', FILTER_SANITIZE_STRING); $address = htmlspecialchars($address, ENT_QUOTES, 'UTF-8'); $sele = mysqli_query($new,"SELECT * FROM admin_vendors WHERE vendor_name = '$vendor_name'"); $conrow = mysqli_fetch_array($sele); $dbvendor = $conrow['vendor_name']; if(empty($vendor_name)){ $error_message = "Vendor name is required"; } elseif($vendor_name === $dbvendor){ $error_message = "Vendor already Exist"; } else { $date = date("Y-m-d h:i"); $stmt = $con->prepare("insert into admin_vendors (vendor_name,vendor_email,phone,address,vdate) values(?,?,?,?,?)"); $stmt->execute(array($vendor_name,$vendor_email,$phone,$address,$date)); $error_message = "Vendor is added"; } } ?> <div id="layout-wrapper"> <div class="header-border"></div> <header id="page-topbar"> <?php include("includes/template/header.php");?> </header> <!-- Plugins css --> <link href="plugins/datatables/dataTables.bootstrap4.css" rel="stylesheet" type="text/css" /> <link href="plugins/datatables/responsive.bootstrap4.css" rel="stylesheet" type="text/css" /> <link href="plugins/datatables/buttons.bootstrap4.css" rel="stylesheet" type="text/css" /> <link href="plugins/datatables/select.bootstrap4.css" rel="stylesheet" type="text/css" /> <title><?php echo $shopname?> || <?php echo $pageTitle1;?></title> <script src="https://code.jquery.com/jquery-3.6.4.min.js" integrity="sha256-oP6HI9z1XaZNBrJURtCoUT5SUnxFr8s3BzRl+cbzUq8=" crossorigin="anonymous"></script> <script src='https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js'></script> <link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.css'/> <!-- App css --> <link href="assets/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> <link href="assets/css/icons.min.css" rel="stylesheet" type="text/css" /> <link href="assets/css/theme.min.css" rel="stylesheet" type="text/css" /> <div class="vertical-menu"> <?php include("includes/template/sidebar.php");?> </div> <div class="main-content"> <div class="page-content"> <div class="container-fluid"> <!-- start page title --> <div class="row"> <div class="col-12"> <h4 class="mb-0 font-size-18">All Vendors </h4> <div class="page-title-box d-flex align-items-center justify-content-between"> </div> </div> </div> <!-- end page title --> <div class="row"> <div class="col-12"> <div class="card"> <div class="card-body"> <button type="button" class="btn btn-primary waves-effect waves-light" data-toggle="modal" data-target=".bd-example-modal-lg">Add vendors</button> <br /><br /> <div class="table-responsive"> <table id="basic-datatable" class="table table-hover table-striped table-bordered"> <thead> <tr> <th>ID</th> <th>Vendor name</th> <th>Email </th> <th>Phone</th> <th>Date</th> <th>Address</th> <th>Action</th> </tr> </thead> <tbody> <?php $cont = 1; $stmt = $con->prepare("SELECT * FROM admin_vendors order by vendor_id DESC"); $stmt->execute(); $rows_services = $stmt->fetchAll(); ?> <tr> <?php foreach($rows_services as $service){ ?> <td><?php echo $cont++;?></td> <td><?php echo $service['vendor_name'];?></td> <td><?php echo $service['vendor_email'];?></td> <td><?php echo $service['phone'];?></td> <td><?php echo date("F,d, Y",strtotime($service['vdate'])) ?></td> <td><?php echo $service['address'];?></td> <td> <?php $edit_data = "edit_".$service["vendor_id"];?> <?php $delete_data = "delet_".$service["vendor_id"];?> <ul> <li class="list-inline-item" data-toggle="tooltip" title="Edit"> <a href="#" data-toggle="modal" data-target="#<?php echo $edit_data; ?>" data-placement="top"><i class="fa fa-edit"></i></a> </li> <li class="list-inline-item" data-toggle="tooltip" title="Delete"> <a href="#" data-toggle="modal" data-target="#<?php echo $delete_data; ?>" data-placement="top"><i class="fa fa-trash-alt" style="color:red"></i></a> </li> <div class="modal fade" id="<?php echo $delete_data; ?>" tabindex="-1" role="dialog" aria-labelledby="<?php echo $delete_data; ?>" aria-hidden="true"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalLabel">Delete Vendors</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <form method="POST"> Are you sure you want to delete this Vendors? </div> <input type="hidden" name="SID" value="<?php echo $service['vendor_id']; ?>"> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button> <button type="submit" name="del" class="btn btn-success">Delete</button> </form> </div> </div> </div> </div> <div class="modal fade bd-example-modal-lg12" id="<?php echo $edit_data; ?>" tabindex="-1" role="dialog" aria-labelledby="<?php echo $edit_data; ?>" aria-hidden="true"> <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title h4" id="myLargeModalLabel">Edit Vendor</h5> <button type="button" class="close waves-effect waves-light" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> <div id="response"></div> </div> <div class="modal-body"> <form method="post" accept-charset="utf-8"> <div class="row"> <div class="form-group col-md-6"> <label>Vendor name</label> <input type="text" name="vendor_name" value="<?php echo $service["vendor_name"]; ?>" class="form-control" style="height:40px"> </div> <input type="hidden" name="vid" value="<?php echo $service["vendor_id"]; ?>"> <div class="form-group col-md-6"> <label>Email</label> <input type="email" name="vendor_email" value="<?php echo $service["vendor_email"]; ?>" class="form-control" style="height:40px"> </div> <div class="form-group col-md-6"> <label>Phone number</label> <input type="number" name="phone" value="<?php echo $service["phone"]; ?>" class="form-control" style="height:40px"> </div> <div class="form-group col-md-6"> <label>Address/Location</label> <input type="text" name="address" value="<?php echo $service["address"]; ?>" class="form-control" style="height:40px"> </div> <div class="form-group col-md-4"> <button type="submit" name="update" class="btn btn-success form-control">Save</button> </div> </div> </form> </div> </div> </div> </div> </li> </ul> </td> </tr> <?php };?> </tbody> </table> </div> <!-- end card body--> </div> <!-- end card --> </div><!-- end col--> </div> <!-- end row--> </div> <!-- container-fluid --> </div> <!-- End Page-content --> <?php include("includes/template/footer.php");?> </div> <!-- end main content--> </div> <!-- Overlay--> <div class="menu-overlay"></div> <div class="modal fade bd-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true"> <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title h4" id="myLargeModalLabel">Add New Vendor</h5> <button type="button" class="close waves-effect waves-light" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> <div id="response"></div> </div> <div class="modal-body"> <form method="post" accept-charset="utf-8"> <div class="row"> <div class="form-group col-md-6"> <label>Vendor name</label> <input type="text" name="vendor_name" class="form-control" style="height:40px"> </div> <div class="form-group col-md-6"> <label>Email</label> <input type="email" name="vendor_email" class="form-control" style="height:40px"> </div> <div class="form-group col-md-6"> <label>Phone number</label> <input type="number" name="phone" class="form-control" style="height:40px"> </div> <div class="form-group col-md-6"> <label>Address/Location</label> <input type="text" name="address" class="form-control" style="height:40px"> </div> <div class="form-group col-md-4"> <button type="submit" name ="insert" class="btn btn-success form-control">Send</button> </div> </div> </form> </div> </div> </div> </div> <!-- third party js --> <script src="plugins/datatables/jquery.dataTables.min.js"></script> <script src="plugins/datatables/dataTables.bootstrap4.js"></script> <script src="plugins/datatables/dataTables.responsive.min.js"></script> <script src="plugins/datatables/responsive.bootstrap4.min.js"></script> <script src="plugins/datatables/dataTables.buttons.min.js"></script> <script src="plugins/datatables/buttons.bootstrap4.min.js"></script> <script src="plugins/datatables/buttons.html5.min.js"></script> <script src="plugins/datatables/buttons.flash.min.js"></script> <script src="plugins/datatables/buttons.print.min.js"></script> <script src="plugins/datatables/dataTables.keyTable.min.js"></script> <script src="plugins/datatables/dataTables.select.min.js"></script> <!-- third party js ends --> <!-- Datatables init --> <script src="assets/pages/datatables-demo.js"></script> <!-- App js --> <script src="assets/js/theme.js"></script> </body> </html> <?php }?>
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 60.07 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002