Your IP : 216.73.216.26


Current Path : /home2/wtmwscom/public_html/admin/
Upload File :
Current File : /home2/wtmwscom/public_html/admin/delete.php

<?php
session_start();
include '../connection.php';
//include 'lib.php';
include '../function_lib.php';

if(!isset($_SESSION['userid'])) redirect('product_user_list.php');
if(isset($_GET['recid']) && isset($_GET['table'])){
    $table = $_GET['table'];
    $recid = $_GET['recid'];
    //$recid_field_name = $table == 'group' ? 'group_id' : 'price_id';
    $recid_field_name = $_GET['rfn'];
    if($_GET['file'] ==0){
        mysqli_query($connection, "delete from `$table` where $recid_field_name = '$recid'");
    }
    else{
        $filename = mysqli_fetch_object(mysqli_query($connection, "select filename from $table where $recid_field_name = '$recid'"))->filename;
        if(!empty($filename)) unlink('p_upload/'.$filename);
        mysqli_query($connection, "delete from `$table` where $recid_field_name = '$recid'");
    }
    setMessage("Success", "succ");
    redirect($_GET['redirect']);
}
?>