| Server IP : 210.245.233.93 / Your IP : 216.73.216.226 Web Server : Apache/2.2.15 (CentOS) System : Linux webserver2.onesolution.com.hk 2.6.32-754.35.1.el6.x86_64 #1 SMP Sat Nov 7 12:42:14 UTC 2020 x86_64 User : apache ( 48) PHP Version : 5.3.3 Disable Function : exec, shell_exec, system, passthru, popen, proc_open, pcntl_exec MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/onesolution.com.hk/onesupport/customer/ |
Upload File : |
<?php
require_once(__DIR__ . '/../checkuser.php');
function index() {
global $dbh, $sqlsrv_dbh;
$sql = "SELECT * FROM v_cm_customer_support V_CM_CUSTOMER_SUPPORT ORDER BY company_name";
$parameters = array();
$pagination = new MySqlPagination($sql, $parameters);
$sql .= $pagination->getSqlLimitAndOffset();
if (!($sth = $dbh->prepare($sql))) {
throw new Exception("sql prepare statement failure: $sql");
}
$sth->setFetchMode(PDO::FETCH_ASSOC);
if (!$sth->execute($parameters)) {
throw new Exception("sql execute statement failure: $sql");
}
$customers = $sth->fetchAll();
$sql2 = "SELECT * FROM v_cm_customer_support V_CM_CUSTOMER_SUPPORT ORDER BY company_name";
if (!($sth = $dbh->prepare($sql2))) {
throw new Exception("sql prepare statement failure: $sql2");
}
$sth->setFetchMode(PDO::FETCH_ASSOC);
if (!$sth->execute()) {
throw new Exception("sql execute statement failure: $sql2");
}
$all_customers = $sth->fetchAll();
$sql3 = "SELECT * FROM v_cm_customer_support V_CM_CUSTOMER_SUPPORT where cust_id = '".(int)$_GET["customer_id"]."'";
if (!($sth = $dbh->prepare($sql3))) {
throw new Exception("sql prepare statement failure: $sql3");
}
$sth->setFetchMode(PDO::FETCH_ASSOC);
if (!$sth->execute()) {
throw new Exception("sql execute statement failure: $sql3");
}
$that_customers = $sth->fetchAll();
return array(
'customers' => $customers,
'all_customers' => $all_customers,
'that_customers' => $that_customers,
'pagination' => $pagination->toString(),
);
}
extract(index());
?><!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php require(__DIR__ . '/../inc/_head_meta.php'); ?>
<?php require(__DIR__ . '/../inc/_head_css.php'); ?>
<style type="text/css">
body {
padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
padding-bottom: 40px;
}
</style>
<?php require(__DIR__ . '/../inc/_head_script.php'); ?>
</head>
<body>
<?php require(__DIR__ . '/../inc/_navbar.php'); ?>
<div class="container">
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
<div class="hero-unit" style="padding:10px">
<a href="#" id="search_btn" class="btn btn-link"><h4><i class="icon-list-alt"></i> Search Form</h4></a>
<script type="text/javascript">
$(function() {
$('#search_btn').click(function(event) {
event.preventDefault();
$('#search_form').toggle();
});
$('.date-picker').datetimepicker({ pickTime: false });
$('.time-picker').datetimepicker({ pickDate: false, pickSeconds: false });
$('.select2').select2();
$('#search_form').validate();
});
</script>
<form id="search_form" class="form-horizontal" method="get">
<div class="control-group">
<?php $attribute = 'customer_id'; $label = 'Customer'; ?>
<label class="control-label" for="<?=$attribute?>"><?=$label?></label>
<div class="controls">
<select id="<?=$attribute?>" name="<?=$attribute?>" placeholder="Select a <?=$label?>" class="select2">
<option value=""></option>
<?php foreach ($all_customers as $customer): ?>
<option value="<?=$customer['cust_id']?>"<?=$customer['cust_id'] == $$attribute ? ' selected="selected"' : ''?>><?=$customer['enable'] == 1 ? '' : '[Disabled] '?><?=h($customer['company_name'])?></option>
<?php endforeach; ?>
</select>
</div>
</div>
<div class="control-group">
<div class="controls">
<button type="submit" class="btn btn-primary"><i class="icon-search icon-white"></i> Search</button>
<a href="index.php?show_all=1" class="btn">Show All</a>
</div>
</div>
</form>
</div>
</div><!--/span-->
</div><!--/row-->
</div>
<?php
if(empty($_GET["customer_id"])){
echo $pagination;
}
?>
<table class="table table-striped">
<caption class="text-left"><h2>Customers</h2></caption>
<thead>
<tr>
<th> </th>
<th>Number</th>
<th>Company Name</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<?php
if(empty($_GET["customer_id"])){
foreach ($customers as $customer){
?>
<tr>
<td><a href="view.php?id=<?=$customer['cust_id']?>" class="btn"><i class="icon-pencil"></i></a></td>
<td><?=$customer['cust_id']?></td>
<td><?=h($customer['company_name'])?></td>
<td>
<i class="<?=$customer['enable'] == 1 ? 'icon-ok' : 'icon-remove'?>"></i>
<?=$customer['enable'] == 1 ? 'Enable' : 'Disable'?>
</td>
</tr>
<?php } }else{?>
<tr>
<td><a href="view.php?id=<?=$that_customers[0]['cust_id']?>" class="btn"><i class="icon-pencil"></i></a></td>
<td><?=$that_customers[0]['cust_id']?></td>
<td><?=h($that_customers[0]['company_name'])?></td>
<td>
<i class="<?=$that_customers[0]['enable'] == 1 ? 'icon-ok' : 'icon-remove'?>"></i>
<?=$that_customers[0]['enable'] == 1 ? 'Enable' : 'Disable'?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
<?php
if(empty($_GET["customer_id"])){
echo $pagination;
}
?>
<div class="scroll_to_top">
<a href="#" class="btn btn-link btn-mini scroll-to-top">Scroll to Top</a>
</div>
<script type="text/javascript">
$(function() {
$('.scroll-to-top').click(function(event) {
event.preventDefault();
scrollToTop();
});
});
</script>
<?php require(__DIR__ . '/../inc/_footer.php'); ?>
</div> <!-- /container -->
</body>
</html>