-
Notifications
You must be signed in to change notification settings - Fork 0
/
welcome.php
176 lines (113 loc) · 4.32 KB
/
welcome.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<?php
include "connect.php";
session_start();
$_SESSION["username"] = htmlspecialchars($_GET["user_name"]);
?>
<!DOCTYPE html>
<html lang = "en">
<head>
<title>Welcome <?php echo $_GET["user_name"]; ?></title>
<meta charset = "utf-8">
<meta name = "viewport" content = "width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
</head>
<body>
<div class = "jumbotron jumbotron-fluid">
<div class = "container">
<h1>Welcome, <?php echo $_SESSION["username"];?></h1>
<p>Here is your credit details!<p>
<h3>Current Credits : <?php $sql = "SELECT current_credit FROM USER where name = '".$_SESSION["username"]."'"; $result = $conn->query($sql); echo $result->fetch_assoc()["current_credit"];?></h3>
</div>
</div>
<div class = "container">
<button data-toggle = "collapse" data-target = "#view_transaction" class = "btn btn-primary">Transaction History</button>
</div>
<div class = "container collapse" id = "view_transaction">
<div class = "table-responsive">
<table class = "table table-striped">
<thead>
<tr>
<th>Id</th>
<th>Send To</th>
<th>Send Amount</th>
<th>Date/Time</th>
</tr>
</thead>
<tbody>
<?php
$sql = "SELECT id,sendTo,sendAmount,stamp from Transaction where name = '".$_SESSION["username"]."' and status = 'send'";
$result = $conn->query($sql);
while($rows = $result->fetch_assoc()){
echo "<tr>";
echo "<td>".$rows["id"]."</td>";
echo "<td>".$rows["sendTo"]."</td>";
echo "<td>".$rows["sendAmount"]."</td>";
echo "<td>".$rows["stamp"]."</td>";
echo "</tr>";
}
?>
</tbody>
</table>
<table class = "table table-striped">
<thead>
<tr>
<th>Id</th>
<th>RecivedFrom To</th>
<th>Recived Amount</th>
<th>Date/Time</th>
</tr>
</thead>
<tbody>
<?php
$sql = "SELECT id,receivedFrom,receivedAmount,stamp from Transaction where name = '".$_SESSION["username"]."' and status = 'received'";
$result = $conn->query($sql);
while($rows = $result->fetch_assoc()){
echo "<tr>";
echo "<td>".$rows["id"]."</td>";
echo "<td>".$rows["receivedFrom"]."</td>";
echo "<td>".$rows["receivedAmount"]."</td>";
echo "<td>".$rows["stamp"]."</td>";
echo "</tr>";
}
?>
</tbody>
</table>
</div>
</div>
<br>
<div class = "container">
<button data-toggle = "collapse" data-target = "#view_user" class = "btn btn-primary">Transfer Credit</button>
</div>
<div class = "container collapse" id = "view_user">
<form action = <?php echo htmlspecialchars("transaction.php");?> method = "post" id = "view_user">
<div class = "form-group">
<label for = "user">Select a User</label>
<select class = "form-control" id = "user" name = "select_name">
<?php
$sql = "SELECT name from user";
$result = $conn->query($sql);
while($row = $result->fetch_assoc()){
if($row["name"]==$_SESSION["username"])
continue;
echo "<option>".$row["name"]."</option>\n";
}
$conn->close();
?>
</select>
</div>
<div class = "form-group">
<label for = "amount">Enter Amount:</label>
<input type="number" class="form-control" name = "amount" required>
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</div>
<br>
<div class = "container">
<a href = "logout.php" class = "btn btn-primary" role = "button">Go Back</a>
</div>
</body>
</html>