| Current Path : /home2/wtmwscom/public_html/admin/ |
| Current File : /home2/wtmwscom/public_html/admin/outbox.php |
<?php
$title = "Outbox";
include 'header.php';
//include_once('lib/ps_pagination.php');
if (isset($_POST['submit'])) {
$uid = mysqli_real_escape_string($connection,$_POST['uid']);
$subject = mysqli_real_escape_string($connection,$_POST['subject']);
$message = mysqli_real_escape_string($connection,$_POST['message']);
if ($uid != 'all') {
mysqli_query($connection, "INSERT INTO `message` (`by`,`to`,`subject`,`message`,`datetime`) VALUES('admin','" . $uid . "','" . $subject . "','" . $message . "','" . date('Y-m-d H:i:s') . "')");
} else {
$child_ids = get_child_ids(100);
foreach ($child_ids as $key => $level) {
foreach ($level as $key => $value) {
mysqli_query($connection, "INSERT INTO `message` (`by`,`to`,`subject`,`message`,`datetime`) VALUES('admin','" . $value . "','" . $subject . "','" . $message . "','" . date('Y-m-d H:i:s') . "')");
}
}
}
setMessage('Message send successfully.', 'alert-success');
redirect("./outbox.php");
}
?>
<div class="container-fluid">
<div class="row">
<div class="col-sm-12">
<div class="page-title-box">
<h4 class="page-title">Outbox</h4>
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="javascript:void(0);">Lexa</a></li>
<li class="breadcrumb-item"><a href="javascript:void(0);">Support</a></li>
<li class="breadcrumb-item active">Outbox</li>
</ol>
<!-- <div class="state-information d-none d-sm-block">
<div class="state-graph">
<div id="header-chart-1"></div>
<div class="info">Balance $ 2,317</div>
</div>
<div class="state-graph">
<div id="header-chart-2"></div>
<div class="info">Item Sold 1230</div>
</div>
</div>-->
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="card m-b-20">
<div class="card-body">
<!-- <h4 class="mt-0 header-title">Basic example</h4>
<p class="text-muted m-b-30">For basic styling—light padding and
only horizontal dividers—add the base class <code>.table</code> to any
<code><table></code>.
</p>-->
<table class="table mb-0 table-bordered table-striped">
<thead>
<tr>
<th>Subject</th>
<th>Message</th>
<th>Receiver</th>
<th>Time</th>
<th>Attach File</th>
</tr>
</thead>
<tbody>
<?php
$query = "SELECT * FROM `message` WHERE `by`='admin' ORDER BY `datetime` DESC";
$rs = mysqli_query($connection, $query);
// $i = 1;
if ($rs) {
while ($row = mysqli_fetch_object($rs)) {
$name = mysqli_fetch_object(mysqli_query($connection, "SELECT login_id, name FROM user WHERE uid='" . $row->to . "'"));
?>
<tr>
<!--<td><?php echo $i++; ?></td>-->
<td><?php echo $row->subject; ?></td>
<td><?php echo $row->message; ?></td>
<td><?php echo $name->name . " (" . $name->login_id . ")"; ?></td>
<td><?php echo date("d M, Y h:i A", strtotime($row->datetime)); ?></td>
<td>
<?php if (file_exists("../static/backend/user-resource/uploads/attachment/" . $row->filename) && $row->filename != '') { ?>
<a href="../static/backend/user-resource/uploads/attachment/<?php echo $row->filename; ?>" target="_blank">View File</a>
<?php } ?>
</td>
</tr>
<?php
}
}
?>
</tbody>
</table>
<?php //echo $pager->renderFullNav(); ?>
</div>
</div>
</div> <!-- end col -->
</div>
<!--table content ends here-->
</div>
<?php include 'footer.php'; ?>