| Server IP : 89.117.53.150 / Your IP : 216.73.216.11 Web Server : Apache System : Linux server2.hostofiraq.site 5.15.0-186-generic #196-Ubuntu SMP Sat Jun 20 16:09:34 UTC 2026 x86_64 User : iscmbt-kufa-atu ( 1014) PHP Version : 8.2.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/iscmbt-kufa-atu/public_html/form/ |
Upload File : |
<?php
session_start();
if (!isset($_SESSION['user_id'])) {
header('Location: login.php');
exit();
}
require 'contadb.php';
$search = isset($_GET['search']) ? $_GET['search'] : '';
$results_per_page = 5;
$page = isset($_GET['page']) ? (int)$_GET['page'] : 1;
$offset = ($page - 1) * $results_per_page;
$sql = "SELECT * FROM researchers WHERE researcher_name LIKE :search LIMIT :offset, :results_per_page";
$stmt = $pdo->prepare($sql);
$stmt->bindValue(':search', '%' . $search . '%', PDO::PARAM_STR);
$stmt->bindValue(':offset', $offset, PDO::PARAM_INT);
$stmt->bindValue(':results_per_page', $results_per_page, PDO::PARAM_INT);
$stmt->execute();
$requests = $stmt->fetchAll(PDO::FETCH_ASSOC);
$total_sql = "SELECT COUNT(*) AS total FROM researchers WHERE researcher_name LIKE :search";
$total_stmt = $pdo->prepare($total_sql);
$total_stmt->execute([':search' => '%' . $search . '%']);
$total_rows = $total_stmt->fetch(PDO::FETCH_ASSOC)['total'];
$total_pages = ceil($total_rows / $results_per_page);
require 'header.php';
?>
<div class="container mt-5 animate__animated animate__fadeIn">
<h2 class="text-center mb-4">Dashboard </h2>
<div class="row mb-4">
<div class="col-md-6">
<form method="GET" action="dashboard.php" class="mb-3">
<div class="input-group">
<input type="text" name="search" class="form-control" placeholder="..." value="<?= htmlspecialchars($search) ?>">
<button type="submit" class="btn btn-primary ml-2">
<i class="fas fa-search"></i> Search
</button>
</div>
</form>
</div>
<div class="col-md-6 text-right">
<a href="export.php" class="btn btn-success btn-block">
<i class="fas fa-file-export"></i> Export
</a>
</div>
</div>
<div class="table-responsive">
<table class="table table-bordered table-striped table-hover">
<thead class="thead-dark">
<tr>
<th>Name</th>
<th>Title</th>
<th>Degree</th>
<th>Specialization</th>
<th>Email</th>
<th>Mobile Number</th>
<th>Affiliation</th>
<th>Area of Interest</th>
<th>Journal Category</th>
<!-- <th>File</th> -->
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php foreach ($requests as $request): ?>
<tr id="request-<?= $request['id'] ?>">
<td><?= htmlspecialchars($request['researcher_name']) ?></td>
<td><?= htmlspecialchars($request['title']) ?></td>
<td><?= htmlspecialchars($request['degree']) ?></td>
<td><?= htmlspecialchars($request['specialization']) ?></td>
<td><?= htmlspecialchars($request['institutional_email']) ?></td>
<td><?= htmlspecialchars($request['mobile_number']) ?></td>
<td><?= htmlspecialchars($request['affiliation']) ?></td>
<td><?= htmlspecialchars($request['area_of_interest']) ?></td>
<td><?= htmlspecialchars($request['journal_selection']) ?></td>
<!-- <td>
<?php if (!empty($request['file_path'])): ?>
<a href="<?= $request['file_path'] ?>" target="_blank" class="btn btn-info btn-sm">
<i class="fas fa-eye"></i> File
</a>
<?php else: ?>
<span class="text-muted">Not Found File </span>
<?php endif; ?>
</td> -->
<td class="d-flex">
<button class="btn btn-danger btn-sm mr-1" onclick="deleteRequest(<?= $request['id'] ?>)">
<i class="fas fa-trash"></i> Delete
</button>
<button class="btn btn-primary btn-sm" onclick="contactResearcher('<?= $request['institutional_email'] ?>')">
<i class="fas fa-envelope"></i> Mail
</button>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<!-- Pagination -->
<nav aria-label="Page navigation">
<ul class="pagination justify-content-center">
<?php if ($page > 1): ?>
<li class="page-item">
<a class="page-link" href="?search=<?= urlencode($search) ?>&page=<?= $page - 1 ?>">
<i class="fas fa-chevron-left"></i> Previous
</a>
</li>
<?php endif; ?>
<?php for ($i = 1; $i <= $total_pages; $i++): ?>
<li class="page-item <?= $i == $page ? 'active' : '' ?>">
<a class="page-link" href="?search=<?= urlencode($search) ?>&page=<?= $i ?>"><?= $i ?></a>
</li>
<?php endfor; ?>
<?php if ($page < $total_pages): ?>
<li class="page-item">
<a class="page-link" href="?search=<?= urlencode($search) ?>&page=<?= $page + 1 ?>">
Next <i class="fas fa-chevron-right"></i>
</a>
</li>
<?php endif; ?>
</ul>
</nav>
</div>
<script>
function deleteRequest(id) {
if (confirm('Are you sure you want to delete this request?')) {
$.ajax({
url: 'delete_request.php',
type: 'POST',
data: {
id: id
},
success: function(response) {
if (response === 'success') {
$('#request-' + id).fadeOut(400, function() {
$(this).remove();
});
} else {
alert('An error occurred while deleting');
}
},
error: function(xhr, status, error) {
alert('Connection error: ' + error);
}
});
}
}
function contactResearcher(email) {
window.location.href = 'mailto:' + email;
}
</script>
<?php require 'footer.php'; ?>