forked from akkireddy95/Online-Banking-system
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadd_beneficiary_process.php
56 lines (42 loc) · 2.23 KB
/
add_beneficiary_process.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
<?php
session_start();
if(!isset($_SESSION['customer_login']))
header('location:index.php');
?>
<?php
$sender_id=$_SESSION["login_id"];
$sender_name=$_SESSION["name"];
$Payee_name=$_REQUEST['name'];
$acc_no=$_REQUEST['account_no'];
$branch=$_REQUEST['branch_select'];
$ifsc=$_REQUEST['ifsc_code'];
include '_inc/dbconn.php';
$sql1="SELECT * FROM beneficiary1 WHERE sender_id='$sender_id' AND reciever_id='$acc_no'";
$result1= mysql_query($sql1);
$rws1= mysql_fetch_array($result1);
$s1=$rws1[1];
$s2=$rws1[3];
$sql="SELECT * FROM customer WHERE id='$acc_no'";
$result= mysql_query($sql) or die(mysql_error());
$rws= mysql_fetch_array($result) ;
if($sender_id==$rws[0]) //can't send request to himself
{
echo '<script>alert("You cant add yourself as a beneficiery!");';
echo 'window.location= "add_beneficiary.php";</script>';
}
elseif($s1==$sender_id && $s2==$acc_no)
{
echo '<script>alert("You cant add a beneficiery twice!");';
echo 'window.location= "add_beneficiary.php";</script>';
}
elseif($rws[1]!=$Payee_name && $rws[0]!=$acc_no && $rws[11]!=$branch && $rws[12]!=$ifsc)
{
echo '<script>alert("Beneficiary Not Found!\nPlease enter correct details");';
echo 'window.location= "add_beneficiary.php";</script>';
}
else{
$status="PENDING";
$sql="insert into beneficiary1 values('','$sender_id','$sender_name','$acc_no','$Payee_name','$status')";
mysql_query($sql) or die(mysql_error());
header("location:display_beneficiary.php");
}