ok

Mini Shell

Direktori : /proc/thread-self/root/home2/selectio/www/ramali.in/dashboard/public/
Upload File :
Current File : //proc/thread-self/root/home2/selectio/www/ramali.in/dashboard/public/delievery-charge-form.php

<?php
include_once('includes/functions.php');
include_once('../includes/crud.php');
$db = new Database();
$fn = new custom_functions;
if (isset($_POST['btnChange'])) {
    if (ALLOW_MODIFICATION == 0 && !defined(ALLOW_MODIFICATION)) {
        echo '<label class="alert alert-danger">This operation is not allowed in demo panel!.</label>';
        return false;
    }
    $charge = $db->escapeString($fn->xss_clean($_POST['charge']));
    $charge1 = $db->escapeString($fn->xss_clean($_POST['charge1']));
    // create array variable to handle error
    $error  = array();
    if (empty($charge)) {
        $tax = 0;
    } else if (!is_numeric($charge)) {
        $error['charge'] = "*Charge should be in numeric.";
    }
    if (empty($charge1)) {
        $tax = 0;
    } else if (!is_numeric($charge1)) {
        $error['charge'] = "*Charge should be in numeric.";
    }
    if (is_numeric($charge)) {
        $sql_query = "UPDATE settings SET Value = " . $charge . "  WHERE Variable = 'Delievery Charge'";
        $db->sql($sql_query);
        $update_result = $db->getResult();
    }
    if (is_numeric($charge1)) {
        $sql_query = "UPDATE settings SET Value = " . $charge1 . "  WHERE Variable = 'Delievery Charge 1'";
        $db->sql($sql_query);
        $update_result = $db->getResult();
        if (!empty($update_result)) {
            $update_result = 0;
        } else {
            $update_result = 1;
        }
    }
    if ($update_result == 1) {
        $error['update_setting'] = " <h4><div class='alert alert-success'>
		* Settings update successfully</div></h4>";
    } else {
        $error['update_setting'] = "*Failed updating setting data";
    }
}
$sql = "select Value from `settings` where id in (3,4)";
$db->sql($sql);
$res = $db->getResult();
$previous_charge = $res[0]['Value'];
$previous_charge1 = $res[1]['Value'];

?>
<section class="content-header">
    <h1>Delievery Charge</h1>
    <?php echo isset($error['update_setting']) ? $error['update_setting'] : ''; ?>
    <ol class="breadcrumb">
        <li><a href="home.php"><i class="fa fa-home"></i> Home</a></li>
    </ol>
    <hr />
</section>
<section class="content">
    <div class="row">
        <div class="col-md-6">
            <!-- general form elements -->
            <div class="box box-primary">
                <div class="box-header with-border">
                    <h3 class="box-title">Delievery Charge</h3>
                </div><!-- /.box-header -->
                <!-- form start -->
                <form method="post" enctype="multipart/form-data">
                    <div class="box-body">
                        <div class="form-group">
                            <label for="exampleInputEmail1">Delievery Charge 1:</label><?php echo isset($error['charge']) ? $error['charge'] : ''; ?>
                            <input type="text" class="form-control" name="charge" value="<?php echo $previous_charge; ?>" />
                            <label for="exampleInputEmail1">Delievery Charge 2:</label><?php echo isset($error['charge']) ? $error['charge'] : ''; ?>
                            <input type="text" class="form-control" name="charge1" value="<?php echo $previous_charge1; ?>" />
                        </div>
                    </div><!-- /.box-body -->
                    <div class="box-footer">
                        <input type="submit" class="btn-primary btn" value="Update" name="btnChange" />
                    </div>
                </form>
            </div><!-- /.box -->
        </div>
    </div>
</section>
<div class="separator"> </div>
<?php $db->disconnect(); ?>

Zerion Mini Shell 1.0