-
Notifications
You must be signed in to change notification settings - Fork 0
/
add2.php
290 lines (258 loc) · 9.8 KB
/
add2.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
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
<?php
require_once('auth.php');
$connect = mysql_connect("localhost", "admin", "yahoo");
//create database
$create = mysql_query("CREATE DATABASE IF NOT EXISTS user_data") or die(mysql_error());
mysql_select_db("user_data");
$admin = "CREATE TABLE IF NOT EXISTS udetails_ext (
uid_id varchar(255) NOT NULL PRIMARY KEY,
demat varchar(255) NOT NULL,
pancard varchar(255) NOT NULL,
drvlicense varchar(255) NOT NULL,
electionid varchar(255) NOT NULL,
bid_1 INT NOT NULL,
bid_2 INT NOT NULL,
bid_3 INT NOT NULL,
cid_1 INT NOT NULL,
cid_2 INT NOT NULL
)";
$result = mysql_query($admin) or die(mysql_error());
$create = mysql_query("CREATE DATABASE IF NOT EXISTS user_data") or die(mysql_error());
mysql_select_db("user_data");
$admin = "CREATE TABLE IF NOT EXISTS udetails_ext_bank (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
uid_id varchar(255) NOT NULL,
id_uid INT NOT NULL,
bankaccount varchar(255) NOT NULL,
banktype varchar(255) NOT NULL,
bankname varchar(255) NOT NULL,
bank_amount INT(25) NOT NULL
)";
$result = mysql_query($admin) or die(mysql_error());
$create = mysql_query("CREATE DATABASE IF NOT EXISTS user_data") or die(mysql_error());
mysql_select_db("user_data");
$admin = "CREATE TABLE IF NOT EXISTS udetails_ext_credit (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
uid_id varchar(255) NOT NULL,
id_uid INT NOT NULL,
creditcard varchar(255) NOT NULL,
creditvalid varchar(255) NOT NULL,
creditcsv varchar(255) NOT NULL
)";
$result = mysql_query($admin) or die(mysql_error());
$create = mysql_query("CREATE DATABASE IF NOT EXISTS user_db") or die(mysql_error());
mysql_select_db("user_db");
$admin = "CREATE TABLE IF NOT EXISTS udetails_ext (
uid_id varchar(255) NOT NULL PRIMARY KEY,
demat varchar(255) NOT NULL,
pancard varchar(255) NOT NULL,
drvlicense varchar(255) NOT NULL,
electionid varchar(255) NOT NULL,
bid_1 INT NOT NULL,
bid_2 INT NOT NULL,
bid_3 INT NOT NULL,
cid_1 INT NOT NULL,
cid_2 INT NOT NULL
)";
$result = mysql_query($admin) or die(mysql_error());
$create = mysql_query("CREATE DATABASE IF NOT EXISTS user_db") or die(mysql_error());
mysql_select_db("user_db");
$admin = "CREATE TABLE IF NOT EXISTS udetails_ext_bank (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
uid_id varchar(255) NOT NULL,
id_uid INT NOT NULL,
bankaccount varchar(255) NOT NULL,
banktype varchar(255) NOT NULL,
bankname varchar(255) NOT NULL,
bank_amount INT(25) NOT NULL
)";
$result = mysql_query($admin) or die(mysql_error());
$create = mysql_query("CREATE DATABASE IF NOT EXISTS user_db") or die(mysql_error());
mysql_select_db("user_db");
$admin = "CREATE TABLE IF NOT EXISTS udetails_ext_credit (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
uid_id varchar(255) NOT NULL,
id_uid INT NOT NULL,
creditcard varchar(255) NOT NULL,
creditvalid varchar(255) NOT NULL,
creditcsv varchar(255) NOT NULL
)";
$result = mysql_query($admin) or die(mysql_error());
$bnkaccnt1=$_POST['bnkaccnt1'];
$bnkaccnt2=$_POST['bnkaccnt2'];
$bnkaccnt3=$_POST['bnkaccnt3'];
$typ1=$_POST['typ1'];
$typ2=$_POST['typ2'];
$typ3=$_POST['typ3'];
$bank1=$_POST['bank1'];
$bank2=$_POST['bank2'];
$bank3=$_POST['bank3'];
$credit1=$_POST['credit1'];
$credit2=$_POST['credit2'];
$valid1=$_POST['cmm1'];
$valid1.=$_POST['cyyyy1'];
$valid2=$_POST['cmm1'];
$valid2.=$_POST['cyyyy1'];
$csv1=$_POST['csv1'];
$csv2=$_POST['csv2'];
$demat=$_POST['demat'];
$pan=$_POST['pan'];
$eleid=$_POST['eleid'];
$drvlic=$_POST['drvlic'];
//select which database you want to edit
mysql_select_db("user_data");
//select the table
$result = mysql_query("select * from udetails ORDER BY id DESC LIMIT 1");
$r=mysql_fetch_array($result);
//the format is $variable = $r["nameofmysqlcolumn"];
$uid=$r["uid"];
$uidd = md5($uid);
$val_0=0;
$val_1=1;
$val_2=2;
$val_3=3;
$val_amt=10000;
function checkEmpty ($strString)
{
if (empty($strString))
{ return 0; }
else
{ return 1; }
}
/* ---------------- start ext_tables ----------------------------------- */
if (empty($bnkaccnt1))
{
mysql_select_db("user_data");
$insert = "INSERT INTO udetails_ext_bank (uid_id, id_uid) ".
"VALUES ('$uid', '$val_1')";
$results = mysql_query($insert) or die(mysql_error());
mysql_select_db("user_db");
$insert = "INSERT INTO udetails_ext_bank (uid_id, id_uid) ".
"VALUES ('$uidd', '$val_1')";
$results = mysql_query($insert) or die(mysql_error());
}
else {
mysql_select_db("user_data");
$insert = "INSERT INTO udetails_ext_bank (uid_id, id_uid, bankaccount, banktype, bankname, bank_amount) ".
"VALUES ('$uid', '$val_1', '$bnkaccnt1', '$typ1', '$bank1', '$val_amt')";
$results = mysql_query($insert) or die(mysql_error());
mysql_select_db("user_db");
$insert = "INSERT INTO udetails_ext_bank (uid_id, id_uid, bankaccount, banktype, bankname, bank_amount) ".
"VALUES ('$uidd', '$val_1', '$bnkaccnt1', '$typ1', '$bank1', '$val_amt')";
$results = mysql_query($insert) or die(mysql_error());
}
if (empty($bnkaccnt2))
{
mysql_select_db("user_data");
$insert = "INSERT INTO udetails_ext_bank (uid_id, id_uid) ".
"VALUES ('$uid', '$val_2')";
$results = mysql_query($insert) or die(mysql_error());
mysql_select_db("user_db");
$insert = "INSERT INTO udetails_ext_bank (uid_id, id_uid) ".
"VALUES ('$uidd', '$val_2')";
$results = mysql_query($insert) or die(mysql_error());
}
else {
mysql_select_db("user_data");
$insert = "INSERT INTO udetails_ext_bank (uid_id, id_uid, bankaccount, banktype, bankname, bank_amount) ".
"VALUES ('$uid', '$val_2', '$bnkaccnt2', '$typ2', '$bank2', '$val_amt')";
$results = mysql_query($insert) or die(mysql_error());
mysql_select_db("user_db");
$insert = "INSERT INTO udetails_ext_bank (uid_id, id_uid, bankaccount, banktype, bankname, bank_amount) ".
"VALUES ('$uidd', '$val_2', '$bnkaccnt2', '$typ2', '$bank2', '$val_amt')";
$results = mysql_query($insert) or die(mysql_error());
}
if (empty($bnkaccnt3))
{
mysql_select_db("user_data");
$insert = "INSERT INTO udetails_ext_bank (uid_id, id_uid) ".
"VALUES ('$uid', '$val_3')";
$results = mysql_query($insert) or die(mysql_error());
mysql_select_db("user_db");
$insert = "INSERT INTO udetails_ext_bank (uid_id, id_uid) ".
"VALUES ('$uidd', '$val_3')";
$results = mysql_query($insert) or die(mysql_error());
}
else {
mysql_select_db("user_data");
$insert = "INSERT INTO udetails_ext_bank (uid_id, id_uid, bankaccount, banktype, bankname, bank_amount) ".
"VALUES ('$uid', '$val_3', '$bnkaccnt3', '$typ3', '$bank3', '$val_amt')";
$results = mysql_query($insert) or die(mysql_error());
mysql_select_db("user_db");
$insert = "INSERT INTO udetails_ext_bank (uid_id, id_uid, bankaccount, banktype, bankname, bank_amount) ".
"VALUES ('$uidd', '$val_3', '$bnkaccnt3', '$typ3', '$bank3', '$val_amt')";
$results = mysql_query($insert) or die(mysql_error());
}
if (empty($credit1))
{
mysql_select_db("user_data");
$insert = "INSERT INTO udetails_ext_credit (uid_id, id_uid) ".
"VALUES ('$uid', '$val_1')";
$results = mysql_query($insert) or die(mysql_error());
mysql_select_db("user_db");
$insert = "INSERT INTO udetails_ext_credit (uid_id, id_uid) ".
"VALUES ('$uidd', '$val_1')";
$results = mysql_query($insert) or die(mysql_error());
}
else {
mysql_select_db("user_data");
$insert = "INSERT INTO udetails_ext_credit (uid_id, id_uid, creditcard, creditvalid, creditcsv) ".
"VALUES ('$uid', '$val_1', '$credit1', '$valid1', '$csv1')";
$results = mysql_query($insert) or die(mysql_error());
mysql_select_db("user_db");
$insert = "INSERT INTO udetails_ext_credit (uid_id, id_uid, creditcard, creditvalid, creditcsv) ".
"VALUES ('$uidd', '$val_1', '$credit1', '$valid1', '$csv1')";
$results = mysql_query($insert) or die(mysql_error());
}
if (empty($credit2))
{
mysql_select_db("user_data");
$insert = "INSERT INTO udetails_ext_credit (uid_id, id_uid) ".
"VALUES ('$uid', '$val_2')";
$results = mysql_query($insert) or die(mysql_error());
mysql_select_db("user_db");
$insert = "INSERT INTO udetails_ext_credit (uid_id, id_uid) ".
"VALUES ('$uidd', '$val_2')";
$results = mysql_query($insert) or die(mysql_error());
}
else {
mysql_select_db("user_data");
$insert = "INSERT INTO udetails_ext_credit (uid_id, id_uid, creditcard, creditvalid, creditcsv) ".
"VALUES ('$uid', '$val_2', '$credit2', '$valid2', '$csv2')";
$results = mysql_query($insert) or die(mysql_error());
mysql_select_db("user_db");
$insert = "INSERT INTO udetails_ext_credit (uid_id, id_uid, creditcard, creditvalid, creditcsv) ".
"VALUES ('$uidd', '$val_2', '$credit2', '$valid2', '$csv2')";
$results = mysql_query($insert) or die(mysql_error());
}
/* --------------------------------- end ext_tables------------------------------------- */
$bid1= checkEmpty($bnkaccnt1);
$bid2= checkEmpty($bnkaccnt2);
$bid3= checkEmpty($bnkaccnt3);
$cid1= checkEmpty($credit1);
$c1d2= checkEmpty($credit2);
mysql_select_db("user_data");
$insert = "INSERT INTO udetails_ext (uid_id, demat, pancard, electionid, drvlicense, bid_1, bid_2, bid_3, cid_1, cid_2) ".
"VALUES ('$uid', '$demat', '$pan', '$eleid', '$drvlic', '$bid1', '$bid2', '$bid3', '$cid1', '$cid2')";
$results = mysql_query($insert) or die(mysql_error());
mysql_select_db("user_db");
$insert = "INSERT INTO udetails_ext (uid_id, demat, pancard, electionid, drvlicense, bid_1, bid_2, bid_3, cid_1, cid_2) ".
"VALUES ('$uidd', '$demat', '$pan', '$eleid', '$drvlic', '$bid1', '$bid2', '$bid3', '$cid1', '$cid2')";
$results = mysql_query($insert) or die(mysql_error());
if ($result){
header ("Refresh: 3;add-user3.php");
}
else die(mysql_error());
?>
<!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=iso-8859-1" />
<title>Add Citizen Details | UID</title>
<link href="module.css" rel="stylesheet" type="text/css" />
</head>
<body>
<br><br><br>
<div class="err"> <img src="images/loading.gif"><br />Please wait... </img>
</body>
</html>