-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuser.php
240 lines (215 loc) · 11.8 KB
/
user.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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
<?php
session_start();
require_once "mysql.php";
if (!isset($_SESSION["ID"])) {
echo "giris yap";
exit();
}
$form_id = $_SESSION["ID"];
$donation_info = mysqli_query($db, "SELECT * FROM donate");
$org_info1 = mysqli_query($db, "SELECT * FROM organizations");
$org_info2 = mysqli_query($db, "SELECT * FROM organizations");
$org_info3 = mysqli_query($db, "SELECT * FROM organizations");
if (
isset($_POST["miktar"]) && isset($_POST["ad-soyad"]) && isset($_POST["no"]) &&
isset($_POST["ay"]) && isset($_POST["yıl"]) && isset($_POST["cvc"]) && isset($_POST["kurum"])
) { //form çıktısı alındı mı kontrol eder.
$form_miktar = $_POST["miktar"];
$form_kurum = $_POST["kurum"];
$dt = date('Y-m-d');
mysqli_query($db, "INSERT INTO `donate` (`user_id`,`amount`,`org_id`,`date`) VALUES ('$form_id','$form_miktar','$form_kurum','$dt')");
//ilgili bilgiler veritabanına eklenir.
if (mysqli_errno($db) != 0) {
echo "Bir sorun oluştu";
exit();
}
header("Location: user.php");
} else {
?>
<html>
<head>
<meta charset="UTF-8">
<title>Donation Website</title>
<link rel="stylesheet" href="css/tabs.css">
<script src="https://kit.fontawesome.com/7dc3015a44.js" crossorigin="anonymous"></script>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://fonts.googleapis.com/css2?family=Nunito+Sans:wght@400;600&display=swap" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="css/neumorphic-login.css">
<link rel="stylesheet" href="css/bulma.min.css">
<link rel="stylesheet" href="css/main.min.css">
</head>
<body cz-shortcut-listen="true">
<section class="hero is-info">
<div class="hero-body">
<div class="container">
<h1 class="title">Welcome</h1>
<h2 class="subtitle">Check out the organizations and start donating!</h2>
</div>
</div>
<div class="tabs is-boxed is-centered main-menu" id="nav">
<ul>
<li data-target="pane-1" id="1" class="is-active">
<a>
<span class="icon is-small"></span>
<span>Organizations</span>
<span class="icon is-small"></span>
</a>
</li>
<li data-target="pane-2" id="2">
<a>
<span class="icon is-small"></span>
<span>Donate</span>
<span class="icon is-small"></span>
</a>
</li>
<li data-target="pane-3" id="3">
<a>
<span class="icon is-small"></span>
<span>Previous Donations</span>
<span class="icon is-small"></span>
</a>
</li>
</ul>
</div>
<div class="tab-content">
<div class="tab-pane is-active" id="pane-1">
<div class="columns">
<div class="container">
<div class="columns">
<div class="column">
<div class="content">
<?php
while ($answer1 = mysqli_fetch_assoc($org_info1)) {
echo "<p><strong>" . $answer1["name"] . "</strong><br>" . $answer1['about'] . "</p>";
}
?>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="tab-pane" id="pane-2">
<div class="content">
<section>
<div class="hero-body has-text-centered">
<div class="login">
<form action="user.php" method="post">
<div class="columns is-4">
<div class="field">
<div class="control column is-one-twos">
<label class="label has-text-left">Amount</label>
<input class="input" type="text" placeholder="Amount" name="miktar">
</div>
</div>
<div class="field">
<div class="control column is-one-twos">
<label class="label has-text-left">Organization</label>
<select name="kurum" class="select">
<option value="">Select Organization</option>
<?php
while ($answer2 = mysqli_fetch_assoc($org_info2)) { ?>
<option value=<?= $answer2["org_id"] ?>> <?= $answer2["name"] ?> </option>
<?php } ?>
</select>
</div>
</div>
</div>
<div class="field">
<div class="control">
<label class="label has-text-left">Name-Surname</label>
<input class="input" type="text" name="ad-soyad">
</div>
</div>
<div class="field">
<div class="control">
<label class="label has-text-left">Card Number</label>
<input class="input" type="text" name="no">
</div>
</div>
<div class="columns is-6">
<div class="field">
<div class="control column is-one-thirds">
<label class="label has-text-left">Month</label>
<input class="input" type="text" name="ay">
</div>
</div>
<div class="field">
<div class="control column is-one-thirds">
<label class="label has-text-left">Year</label>
<input class="input" type="text" name="yıl">
</div>
</div>
<div class="field">
<div class="control column is-one-thirds">
<label class="label has-text-left">CVC</label>
<input class="input" type="text" name="cvc">
</div>
</div>
</div>
<button type="submit" class="button is-block is-primary is-medium">Pay with Card</button>
</form>
</div>
</div>
</section>
</div>
</div>
<div class="tab-pane" id="pane-3">
<section class="section">
<div class="container">
<div class="b-table">
<div class="table-wrapper has-mobile-cards">
<table class="table is-fullwidth is-striped is-hoverable is-fullwidth">
<thead>
<tr>
<th>Name</th>
<th>Surname</th>
<th>Amount</th>
<th>Organization</th>
<th>Date</th>
</tr>
</thead>
<tbody>
<?php
$sql = "SELECT donate.*, organizations.name AS org_name, user.name AS user_name , user.surname AS user_surname
FROM donate
INNER JOIN organizations ON donate.org_id = organizations.org_id
INNER JOIN user ON donate.user_id = user.user_id
WHERE donate.user_id = $form_id";
$info = mysqli_query($db, $sql);
while ($answer3 = mysqli_fetch_assoc($info)) {
echo "<tr>";
echo "<td>" . $answer3["user_name"] . "</td>";
echo "<td>" . $answer3["user_surname"] . "</td>";
echo "<td>" . $answer3["amount"] . "</td>";
echo "<td>" . $answer3["org_name"] . "</td>";
echo "<td>" . $answer3["date"] . "</td>";
echo "</tr>";
}
?>
</tbody>
</table>
</div>
</div>
</div>
</section>
</div>
</div>
</section>
<div class="column is-8 is-offset-2">
<br>
<nav class="level">
<div class="level-right">
<small class="level-item" style="color: var(--textLight)">
Go to <a href="https://github.com/sumeyyedrl/PHP_MySQL_Project">Github</a>
</small>
</div>
</nav>
</div>
<script src="js/tabs.js"></script>
</body>
</html>
<?php
}
?>