forked from zunaidm/MoneyTransferSystem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtransection.php
90 lines (86 loc) · 2.5 KB
/
transection.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php include 'config/Database.php' ?>
<?php
session_start();
if($_SESSION['type'] == 'admin'){
include 'inc/headeradmin.php';
}
else if($_SESSION['type'] == 'employee'){
include 'inc/headeremployee.php';
}
else
{
header("Location: "."index.php");
}
?>
<?php
if(isset($_GET["id"])){
$trxid = $_GET['id'];
$db = new Database();
$query = "DELETE FROM money WHERE trxid = '$trxid' ";
$db->select($query);
header('Location: '.'transection.php');
}
?>
<div class="desh-main-content">
<br>
<div class="title">
Transection Histrory
</div>
<div class="transection-top">
<form>
<!– <div class="search-box">
<!– <input type="text" name="search" placeholder="Search">
<!– <input type="submit" name="submit-search" value="Search" class="btn-search">
<!–</div>
</form>
</div>
<div class="main">
<div class="transection-table">
<table>
<tr>
<th>Sender Mobile</th>
<th>Receiver Mobile</th>
<th>Amount</th>
<th>Trx ID</th>
<th>Type</th>
<th>Sent By</th>
<th>Received By</th>
<?php if($_SESSION['type'] == 'admin'){?>
<th>Option</th>
<?php }?>
</tr>
<?php
$db = new Database();
$user = $_SESSION['username'];
if($_SESSION['type'] == 'admin'){
$query = "SELECT * FROM money";
}
else{
$query = "SELECT * FROM money WHERE sentby = '$user' OR receivedby = '$user'";
}
$users = $db->select($query);
if($users){
while ($result = $users->fetch_assoc()) {
# code...
?>
<tr>
<td><?php echo $result['sphone']; ?></td>
<td><?php echo $result['rphone']; ?></td>
<td><?php echo $result['amount']; ?></td>
<td><?php echo $result['trxid']; ?></td>
<td><?php echo $result['type']; ?></td>
<td><?php echo $result['sentby']; ?></td>
<td><?php echo $result['receivedby']; ?></td>
<?php if($_SESSION['type'] == 'admin'){?>
<td>
<a href= <?php echo "transection.php?id=".$result['trxid'];?> > <span class="fa fa-trash-o"></span></a>
</td>
<?php }?>
</tr>
<?php } }?>
</table>
</div>
</div>
</div>
</body>
</html>