/var/www/hkosl.com/e-ims/file_manager/delete_company.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
include 'config.php';

// Check if the user is logged in

if ((!isSet($_SESSION['loginname'])) || ($loggin <> '1'))
{
header("Location: login.php");
exit;
}
require(
"configure.php"); 

$index            $_POST["index"];
$nowdate         date("Y-m-d H:i:s");
//print_r($_POST); 
//exit;

$companyid        $_POST["companyid"];
if (
is_array($companyid)){
    foreach (
$companyid as $x => $v)    {
        
$tcompanyid $companyid[$x];
        
//Soft Delete Company DB
        
$sql "update file_company set status='0', deleted='1', lastupby=:lastupby, lastupdate=:lastupdate where companyid=:companyid";
        
$sql_param = array();
        
$sql_param[':lastupby'] = $_SESSION['loginid'];
        
$sql_param[':lastupdate'] = $nowdate;
        
$sql_param[':companyid'] = $tcompanyid;
        
$sth Db::getDbh()->prepare($sql);
        
$sth->execute($sql_param);
        if( 
$error $sth->getError($sql_param) ){
            
var_dump($error);
        }
    }
}

if(!
is_array($companyid)){
    echo
"<script language='javascript'>
        alert('Please Select A File.');
        history.back();
        </script>"
;
        exit;
}

$dbh null;

header("Location: index.php?index=$index");
?>