-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtransferir.php
More file actions
218 lines (201 loc) · 5.91 KB
/
Copy pathtransferir.php
File metadata and controls
218 lines (201 loc) · 5.91 KB
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Pagamento</title>
<style type="text/css">
.texto1 {
font-family: Verdana, Geneva, sans-serif;
text-align: center;
}
.texto1 strong {
font-family: Verdana, Geneva, sans-serif;
text-align: center;
}
.texto1 a {
text-align: center;
}
</style>
</head>
<body>
<?php
include('conectar.php');
include('restt.php');
$ncartaopro = $_POST['ncartaopro'];
$quantia = $_POST['quantia'];
$tamo = $_POST['tamo'];
$dataHora = date("d/m/Y H:i:s");
//---- Infos eu
$query_eu = "SELECT * FROM usuarios WHERE ncartao = ?";
$stmt_eu = $mysqli->prepare($query_eu);
$stmt_eu->bind_param("i", $login_ncartaou);
$stmt_eu->execute();
$res_eu = $stmt_eu->get_result();
$infoeu = $res_eu->fetch_array();
$creditu = $infoeu['credito'];
$senho = $infoeu['senha'];
if($tamo != $senho){
echo '<table align="center" background="Imagens/backpayed.png" width="681 " height="452" border="0">
<tr>
<td height="111"><h1 class="texto1"> </h1></td>
</tr>
<tr>
<td height="136"><span class="texto1">
<h1>Sua senha está errada!</h1>
</span>
<p class="texto1"> <a href="transfer.php">Clique aqui para voltar</a>
</p>
</td>
</tr>
<tr>
<td> </td>
</tr>
</table>';
}else{
//---- Infos cartao transferido
$query_transferido = "SELECT * FROM usuarios WHERE ncartao = ?";
$stmt_transferido = $mysqli->prepare($query_transferido);
$stmt_transferido->bind_param("s", $ncartaopro);
$stmt_transferido->execute();
$res_transferido = $stmt_transferido->get_result();
$infotransferido = $res_transferido->fetch_array();
$creditam = $infotransferido['credito'];
$novquanteu = "$creditu"-"$quantia";
$novquantam = "$creditam"+"$quantia";
if($ncartaopro == $login_ncartaou){
echo '
<table align="center" background="Imagens/backpayed.png" width="681 " height="452" border="0">
<tr>
<td height="111"><h1 class="texto1"> </h1></td>
</tr>
<tr>
<td height="136">
<span class="texto1">
<h1>Você não pode transferir créditos a si mesmo!</h1>
</span>
<p class="texto1"> <a href="transfer.php">Clique aqui para voltar</a>
</p>
</td>
</tr>
<tr>
<td> </td>
</tr>
</table>
';
}else{
if($quantia == 0){
echo '
<table align="center" background="Imagens/backpayed.png" width="681 " height="452" border="0">
<tr>
<td height="111"><h1 class="texto1"> </h1></td>
</tr>
<tr>
<td height="136"><span class="texto1">
<h1>Você não pode transferir F$ 0!</h1>
</span>
<p class="texto1"> <a href="transfer.php">Clique aqui para voltar</a>
</p>
</td>
</tr>
<tr>
<td> </td>
</tr>
</table>
';
}else{
if($quantia > $creditu){
echo '
<table align="center" background="Imagens/backpayed.png" width="681 " height="452" border="0">
<tr>
<td height="111"><h1 class="texto1"> </h1></td>
</tr>
<tr>
<td height="136"><span class="texto1">
<h1>Você não possui créditos suficientes para transferir esta quantia!</h1>
</span>
<p class="texto1"> <a href="transfer.php">Clique aqui para voltar</a>
</p>
</td>
</tr>
<tr>
<td> </td>
</tr>
</table>
';
}else{
$query_update_1 = "UPDATE usuarios SET credito = ? WHERE ncartao = ?";
$stmt_update_1 = $mysqli->prepare($query_update_1);
$stmt_update_1->bind_param(
"ss",
$novquantam,
$ncartaopro
);
$stmt_update_1->execute();
$query_update_2 = "UPDATE usuarios SET credito = ? WHERE ncartao = ?";
$stmt_update_2 = $mysqli->prepare($query_update_2);
$stmt_update_2->bind_param(
"ss",
$novquanteu,
$login_ncartaou
);
$stmt_update_2->execute();
$msg_1 = "Transferência de F$ $quantia para cartão n° $ncartaopro";
$msg_2 = "Transeferência de F$ $quantia recebida de cartã n° $login_ncartaou";
$query_insert_1 = "INSERT INTO registros (ncartao, mensagem, custo, saldo, saldoantes, data) VALUES (?, ?, ?, ?, ?, ?)";
$stmt_insert_1 = $mysqli->prepare($query_insert_1);
$stmt_insert_1->bind_param("isiiis",
$login_ncartaou,
$msg_1,
$quantia,
$novquanteu,
$creditu,
$dataHora
);
$stmt_insert_1->execute();
$query_insert_2 = "INSERT INTO registros (ncartao, mensagem, custo, saldo, saldoantes, data) VALUES (?, ?, ?, ?, ?, ?)";
$stmt_insert_2 = $mysqli->prepare($query_insert_2);
$stmt_insert_2->bind_param("isiiis",
$ncartaopro,
$msg_2,
$quantia,
$novquantam,
$creditam,
$dataHora
);
$stmt_insert_2->execute();
?><table align="center" background="Imagens/backpayed.png" width="681 " height="452" border="0">
<tr>
<td height="111"><h1 class="texto1"><strong>Transferência efetuada com sucesso!</strong></h1></td>
</tr>
<tr>
<td height="205"><table align="center" width="200" border="0">
<tr>
<td class="texto1">Você transferiu: </td>
<td class="texto1">F$ <?=$quantia;?></td>
</tr>
<tr>
<td class="texto1">Para o cartão de n°: </td>
<td class="texto1"><?=$ncartaopro;?></td>
</tr>
<tr>
<td class="texto1">Seu saldo final: </td>
<td class="texto1">F$ <?=$novquanteu;?></td>
</tr>
<tr>
<td height="38" colspan="2" class="texto1"></td>
</tr>
</table></td>
</tr>
<tr>
<td class="texto1"><a href="cliente.php">Clique aqui para voltar à página do cliente</a></td>
</tr>
</table>
<p class="texto1"><br />
<br>
</p><?php
}
}
}
}
?>
</body></html>