-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcus.updateBankAccount.smartToll.php
76 lines (66 loc) · 1.71 KB
/
cus.updateBankAccount.smartToll.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
<?php
/**
Page Info
Requires : DatabaseConnect.smartToll
@author : Sudipta Saha
@since : 23rd Jan, 2018
This page is a replica of a bank account having simple transaction functionalities to add money to bank account.
*/
/*
1= Invalid data or empty data
2= Improper email id and password
3= Failed DatabaseConnectivity, try again.
4= Duplicate username, rejected.
5= MYSQL error
6= no such user
7= not enough balance
*/
/*
* The status codes for tour:
* 0 - Default tour status value.
* 1 - Travelling.
* 2 - Completed.
*/
$curpage=$_SERVER['SCRIPT_NAME'];
$db_tablename='tourDetails';
$errorCode;
$successvalue;
$minbal=5;
if(isset($_POST['username'])){
if(!empty($_POST['username']) && !empty($_POST['money'])){
require 'DatabaseConnect.smartToll.php';
$username=$_POST['username'];
$money=$_POST['money'];
//Make connection to database
if(makeConnection()){
//update bank information depending on money that is to be added.
$secondquery="UPDATE `bankaccount` SET money=$money WHERE username='".mysqli_real_escape_string($db_con,$username)."'";
if($db_result=mysqli_query($db_con,$secondquery)){
$successvalue='true';
$errorCode='null';
}
else{
$successvalue='false';
$errorCode='5';
}
mysqli_close($db_con);
}
else{
$successvalue='false';
$errorCode='3';
}
}
else{
$successvalue='false';
$errorCode='1';
}
}
else{
$successvalue='false';
$errorCode='1';
}
if(!empty($successvalue)){
$result= array('success' => $successvalue, 'errorCode' => (string)$errorCode);
$result=json_encode($result);
echo $result;
}