forked from nwudoebuka/Usccredits
-
Notifications
You must be signed in to change notification settings - Fork 1
/
header.php
467 lines (374 loc) · 14.3 KB
/
header.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
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
<header>
<div class="container">
<div class="logo-area">
<div class="row">
<div class="col-xs-4">
<div class="logo-left-content">
<a href="">
<img src="images/logo.png" alt="img" class="img-responsive">
</a>
</div>
</div>
<div class="col-xs-8">
<div class="logo-right-content">
<ul>
<li>
<span class="icon-call-out"></span>
<div class="contact-info">
<h5>Free Call</h5>
<h6>+1 (301) 850-7836</h6>
</div>
</li>
<li>
<span class="icon-envelope-open"></span>
<div class="contact-info">
<h5>Mail Us</h5>
<h6>support@usccredit.com</h6>
</div>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="navbar-default">
<!-- NAVIGATION -->
<nav class="navbar navbar-home">
<div class="container">
<div class="navbar-inner">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#my-navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<!-- TEMPLATE LOGO -->
<div class="navbar-brand">
<a href=""><img src="images/logo-2.png" alt="img" class="img-responsive"></a>
</div>
</div>
<div class="collapse navbar-collapse pull-left" id="my-navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="index.php">HOME</a></li>
<li><a href="overview.php">ABOUT US</a></li>
<li class="has-sub-menu">
<a href="#">SERVICES</a>
<ul class="sub-menu">
<li><a href="service-one.php">Banking</a></li>
</ul>
</li>
<li class="has-sub-menu">
<a href="#">ONLINE BANKING</a>
<ul class="sub-menu">
<li><a href="login">Login</a></li>
<li><a href="register">Register</a></li>
</ul>
</li>
<li><a href="contact.php">CONTACT</a></li>
</ul>
</div>
<div class="pull-right navbar-additional">
<div class="social-icon">
<ul>
<li><a href="#" class="fa fa-facebook"></a></li>
<li><a href="#" class="fa fa-twitter"></a></li>
<li><a href="#" class="fa fa-google-plus"></a></li>
<li><a href="#" class="fa fa-youtube-play"></a></li>
</ul>
</div>
<div class="mini-cart-search">
<div class="collapse-cart">
<i class="fa fa-cart-arrow-down"></i>
</div>
<div class="collapse-search">
<i class="search fa fa-search search-btn"></i>
<div class="search-open">
<form action="#" method="get">
<div class="input-group animated fadeInDown">
<input type="text" class="form-control" placeholder="Search">
<span class="input-group-btn">
<button class="btn-u" type="submit"><i class="fa fa-search"></i></button>
</span>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</nav>
</div>
</header>
<?php
$servername = "localhost";
$username = "usccredi_001";
$password = "An0therrichard3303";
$dbname = "usccredi_001";
$date = date('d-m-Y H:m:s');
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
if (isset($_POST['email'])){
$name = $_POST['name'];
$email = $_POST['email'];
$occupation = $_POST['occupation'];
$phone = $_POST['phone'];
$accounttype = $_POST['accounttype'];
$address = $_POST['address'];
$usernamet = $_POST['usernamer'];
$country = $_POST['country'];
$gender = $_POST['gender'];
$sender = $_POST['sender_name'];
$sql = "SELECT * FROM register WHERE username = '$usernamet'";
$result = $conn->query($sql);
if ($result->num_rows > 0 ) {
$fail='<div class="alert alert-danger">Sorry. username is already taken</div>';
}else{
//upload photo
$target_dir = "../Dashboard/appzia/assets/images/users/";
$dpi = "assets/images/users/";
$target_file = $target_dir . basename($_FILES["photo"]["name"]);
$dpshow = $dpi . basename($_FILES["photo"]["name"]);
$uploadOk = 1;
$imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
// Check if image file is a actual image or fake image
if(isset($_POST["submit"])) {
$check = getimagesize($_FILES["photo"]["tmp_name"]);
if($check !== false) {
// echo "File is an image - " . $check["mime"] . ".";
$uploadOk = 1;
} else {
echo "File is not an image.";
$uploadOk = 0;
}
}
// Check if file already exists
if (file_exists($target_file)) {
$fail='<div class="alert alert-danger">Sorry rename photo and try again.</div>';
$uploadOk = 0;
}
// Check file size
if ($_FILES["photo"]["size"] > 500000) {
$fail='<div class="alert alert-danger">Sorry, your file is too large.</div>';
$uploadOk = 0;
}
// Allow certain file formats
if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg"
&& $imageFileType != "gif" ) {
$fail='<div class="alert alert-danger">Sorry, only JPG, JPEG, PNG & GIF files are allowed.</div>';
$uploadOk = 0;
}
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
// $fail='<div class="alert alert-danger">Photo name exists rename the photo. and kindly try again.</div>';
// if everything is ok, try to upload file
} else {
if (move_uploaded_file($_FILES["photo"]["tmp_name"], $target_file)) {
$characters = 'abcdefghijklmnopqrstuvwxyz0123456789';
$pass = '';
$max = strlen($characters) - 1;
for ($i = 0; $i < 7; $i++) {
$pass .= $characters[mt_rand(0, $max)];
}
$charactersacn = '0123456789';
$accountnumber = '';
$max = strlen($charactersacn) - 1;
for ($i = 0; $i < 10; $i++) {
$accountnumber .= $charactersacn[mt_rand(0, $max)];
}
$sql = "INSERT INTO register (name, account_number, email, a, phone, account_type, account_balance, account_status, username, password, c, e, gender, address)
VALUES ('$name', '$accountnumber', '$email', '$occupation', '$phone', '$accounttype', '0.00', '3', '$usernamet', '$pass', '$country', '$dpshow', '$gender', '$address')";
if ($conn->query($sql) === TRUE) {
$phonetext = substr($phone, 1);
//mailing client his/her bank details to email
$to = ''.$email.'';
$subject = 'Bank Account Information';
$headers = 'From: Usc Credits <noreply@usccredits.com>' . PHP_EOL .
'Reply-To: Usc Credits <noreply@usccredits.com>' . PHP_EOL .
'X-Mailer: PHP/' . phpversion();
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=UTF-8\r\n";
$message = '<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" media="screen" href="main.css" />
<script src="main.js"></script>
</head>
<body>
<div class="box" style="margin: 0 auto; width: 600px; top: 200px; left: 50%; transform: -50%, 50%; text-align:center;">
<div style="width:600px; height:60px; background-color:#0c3654; color:white; font-family: Georgia, serif; padding-top:15px;"><h3>Usc Credit Union.</h3></div>
<h2 style=" font-family: Georgia, serif;">Dear <b> '.$name.'</b>.</h2>
<p style="font-family: cursive;">Thank you for opening an account with us <b></b>Your account details are as below<br/>
Account Name:'.$name.'<br>
Account Number:'.$accountnumber.'<br><br>
<strong>Username: '.$usernamet.'<br>
Password: '.$pass.'<br><br></strong>.<br/></p>
You have also been assigned an account officer to help you in any where you find it difficult to run your account. below are your account officer details
<br>
Name: Mr Bob R. Roberts.<br>
Phoen:+16313073485<br>
Email: bobroberts@usccredits.com<br><br>
<confirmIt></confirmIt>
<a href="https://www.usccredits.com"><button class="btn btn-primary" style="background-color: #20B2AA;
padding: 15px 3px; width: 150px; color: white; border: 0;">Login</button></a><br/>
<font color=#0c3654>
Thank you for choosing usc credits.<br/>
.</font>
</div>
</body>
</html>';
mail($to, $subject, $message, $headers);
//sending welcome sms
$json_url = "http://api.ebulksms.com:8080/sendsms.json";
$xml_url = "http://api.ebulksms.com:8080/sendsms.xml";
$http_get_url = "http://api.ebulksms.com:8080/sendsms";
$username = '';
$apikey = '';
//Function to connect to SMS sending server using HTTP POST
function doPostRequest($url, $arr_params, $headers = array('Content-Type: application/x-www-form-urlencoded')) {
$response = array();
$final_url_data = $arr_params;
if (is_array($arr_params)) {
$final_url_data = http_build_query($arr_params, '', '&');
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $final_url_data);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_NOSIGNAL, 1);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$response['body'] = curl_exec($ch);
$response['code'] = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
return $response['body'];
}
function useJSON($url, $username, $apikey, $flash, $sendername, $messagetext, $recipients) {
$gsm = array();
$country_code = '234';
$arr_recipient = explode(',', $recipients);
foreach ($arr_recipient as $recipient) {
$mobilenumber = trim($recipient);
if (substr($mobilenumber, 0, 1) == '0'){
$mobilenumber = $country_code . substr($mobilenumber, 1);
}
elseif (substr($mobilenumber, 0, 1) == '+'){
$mobilenumber = substr($mobilenumber, 1);
}
$generated_id = uniqid('int_', false);
$gsm['gsm'][] = array('msidn' => $mobilenumber, 'msgid' => $generated_id);
}
$message = array(
'sender' => $sendername,
'messagetext' => $messagetext,
'flash' => "{$flash}",
);
$request = array('SMS' => array(
'auth' => array(
'username' => $username,
'apikey' => $apikey
),
'message' => $message,
'recipients' => $gsm
));
$json_data = json_encode($request);
if ($json_data) {
$response = doPostRequest($url, $json_data, array('Content-Type: application/json'));
$result = json_decode($response);
return $result->response->status;
} else {
return false;
}
}
if (isset($_POST['email'])) {
$username = "nwudoebuka@gmail.com";
$apikey = "0b4bd019a7292ff97d7b626335afe0176d2a2855";
$sendername = substr($_POST['sender_name'], 0, 11);
$recipients = $phone;
$message = "Good day,$name. your Online details are Accnumber:$accountnumber Username: $usernamet Paswd: $pass Thank you for choosing us.";
$flash = 0;
if (get_magic_quotes_gpc()) {
$message = stripslashes($message);
}
$message = substr($message, 0, 160);
#Use the next line for HTTP POST with JSON
$result = useJSON($json_url, $username, $apikey, $flash, $sendername, $message, $recipients);
// echo $result;
#Uncomment the next line and comment the one above if you want to use HTTP POST with XML
//$result = useXML($xml_url, $username, $apikey, $flash, $sendername, $message, $recipients);
#Uncomment the next line and comment the ones above if you want to use simple HTTP GET
//$result = useHTTPGet($http_get_url, $username, $apikey, $flash, $sendername, $message, $recipients);
}
function useXML($url, $username, $apikey, $flash, $sendername, $messagetext, $recipients) {
$country_code = '234';
$arr_recipient = explode(',', $recipients);
$count = count($arr_recipient);
$msg_ids = array();
$recipients = '';
$xml = new SimpleXMLElement('<SMS></SMS>');
$auth = $xml->addChild('auth');
$auth->addChild('username', $username);
$auth->addChild('apikey', $apikey);
$msg = $xml->addChild('message');
$msg->addChild('sender', $sendername);
$msg->addChild('messagetext', $messagetext);
$msg->addChild('flash', $flash);
$rcpt = $xml->addChild('recipients');
for ($i = 0; $i < $count; $i++) {
$generated_id = uniqid('int_', false);
$generated_id = substr($generated_id, 0, 30);
$mobilenumber = trim($arr_recipient[$i]);
if (substr($mobilenumber, 0, 1) == '0') {
$mobilenumber = $country_code . substr($mobilenumber, 1);
} elseif (substr($mobilenumber, 0, 1) == '+') {
$mobilenumber = substr($mobilenumber, 1);
}
$gsm = $rcpt->addChild('gsm');
$gsm->addchild('msidn', $mobilenumber);
$gsm->addchild('msgid', $generated_id);
}
$xmlrequest = $xml->asXML();
if ($xmlrequest) {
$result = doPostRequest($url, $xmlrequest, array('Content-Type: application/xml'));
$xmlresponse = new SimpleXMLElement($result);
return $xmlresponse->status;
}
return false;
}
function useHTTPGet($url, $username, $apikey, $flash, $sendername, $messagetext, $recipients) {
$query_str = http_build_query(array('username' => $username, 'apikey' => $apikey, 'sender' => $sendername, 'messagetext' => $messagetext, 'flash' => $flash, 'recipients' => $recipients));
return file_get_contents("{$url}?{$query_str}");
}
//welcom sms ends here
$success='<div class="alert alert-success">Succesful, check your mail box(' .$email. ') or Phone for registeration details. check junk/spam if not found in inbox.</div>';
}else{
$fail='<div class="alert alert-danger">Registeration Failed...Try again</div>';
}
} else {
$fail='<div class="alert alert-danger">there was an error uploading photo(photo size may be too large). Kindly try again.</div>';
}
}
//upload photo
}
}
?>
<?php
if (isset($success)){
echo $success;
}
if (isset($fail)){
echo $fail;
}
?>