HEX
Server: Apache
System: Linux server1.royalgt4.com 4.18.0-553.89.1.lve.el8.x86_64 #1 SMP Wed Dec 10 13:58:50 UTC 2025 x86_64
User: mostafedeg (1125)
PHP: 5.6.40
Disabled: mail,passthru,parse_ini_file,show_source,eval,assert,pcntl_exec,dl,putenv,proc_open,popen
Upload Files
File: /home/mostafedeg/public_html/erp/controllers/companyproduces.php
<?php
include("../public/impOpreation.php");
$do = $_GET['do'];
$today = date("Y-m-d H:i:s");
$date = date("Y-m-d");

if (empty($do)) {  
    $smarty->display("header.html");
    $smarty->display("companyproducesview/add.html");
    $smarty->display("footer.html");
} elseif ($do == "show") {
    $companyproduces = R::findAll('companyproduces','del < 2');
    $smarty->assign('companyproduces', $companyproduces);
    $smarty->display("header.html");
    $smarty->display("companyproducesview/show.html");
    $smarty->display("footer.html");
} elseif ($do == "edit") {
    $id = filter_input(INPUT_GET, 'id');
    $companyproduces = R::load('companyproduces', $id);
    $smarty->assign('companyproduces', $companyproduces);
    $smarty->display("header.html");
    $smarty->display("companyproducesview/edit.html");
    $smarty->display("footer.html");
}else if ($do == 'savedata') {
    $companyname = filter_input(INPUT_POST, 'companyname');
    $companyid = filter_input(INPUT_POST, 'companyid');
    if (!$companyid) {;
        $companyproduces = R::dispense('companyproduces');
        $companyproduces->del = 0;
        $companyproduces->addtoday = date("Y-m-d H:i:s");        
        $companyproduces->adduserid = $_SESSION['userid'];
        $companyproduces->deltoday = '';      
        $companyproduces->deluserid = '';
    }else{
        $companyproduces = R::load('companyproduces',$companyid);
        $companyproduces->del = 1;
        $companyproduces->updatetoday = date("Y-m-d H:i:s");         
        $companyproduces->updateuserid = $_SESSION['userid'];
    }
         $companyproduces->companyname  = $companyname;
    try {
         R::store($companyproduces);
        header("location:companyproduces.php?do=show");
    } catch (Exception $e) {
        header("location:companyproduces.php");
    }
}else if ($do == 'delete') {
    $id = filter_input(INPUT_GET, 'id');
    $tables = R::load('companyproduces',$id);
    $tables->del = 2;
    $tables->deltoday = date("Y-m-d H:i:s");
    $tables->deluserid = $_SESSION['userid'];
    R::store($tables);
    header("location:companyproduces.php?do=show");
}else if ($do == 'companyproduces') {

    $row_array = array();
    $return_arr = array();
    $name = $_POST['searchTerm'];
    $productsData = R::getAll("SELECT id, companyname as name
    FROM companyproduces 
    WHERE del < 2 and companyname LIKE '%" . $name . "%'  limit 50");
    foreach ($productsData as $pro) {
        $row_array['id'] = $pro['id'];
        $row_array['text'] = $pro['name'];
        array_push($return_arr, $row_array);
    }

    echo json_encode($return_arr);
}