-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathsend.php
98 lines (85 loc) · 2.88 KB
/
send.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
<?php include 'config/Database.php' ?>
<?php
session_start();
if($_SESSION['type'] == 'admin'){
include 'inc/headeradmin.php';
}
else if($_SESSION['type'] == 'employee'){
include 'inc/headeremployee.php';
}
else
{
header("Location: "."index.php");
}
?>
<script src="js/javascript.js"></script>
<div class="desh-main-content">
<br>
<div class="title">
Send Money
</div>
<div>
<div class="reg-container">
<form name="send" method="post">
<br>
<span>Sender:</span>
<div>
<input type="text" name="sname" placeholder="Sender Full Name" required >
</div>
<div>
<input type="text" name="sphone" placeholder="Sender Phone" required onmouseout="checkphn();">
</div>
<span id="sphneror" style="color:red"></span>
<div>
<input type="text" name="amount" placeholder="Send Amount" required>
</div>
<br>
<span>Receiver:</span>
<div>
<input type="text" name="rname" placeholder="Receiver Full Name" required>
</div>
<div>
<input type="text" name="rphone" placeholder="Receiver Phone" required " onmouseout="checkphn();">
</div>
<span id="rphneror" style="color:red"></span>
<br>
<input type="submit" name="submit" value="SUBMIT" class="btn-login" onclick="return checkphn();">
</form>
</div>
</div>
</div>
<?php
if($_SERVER["REQUEST_METHOD"]=="POST"){
$sname = $_POST['sname'];
$sphone = $_POST['sphone'];
$amount = $_POST['amount'];
$rname = $_POST['rname'];
$rphone = $_POST['rphone'];
$pin = rand(1000,9999);
$trxid = 'TRX'.rand(1000,9999).rand(1000,9999);
$sentby = $_SESSION['username'];
$db = new Database();
$query = "INSERT INTO money(sname,sphone,amount,rname,rphone,pin,trxid,sentby,type) VALUES('$sname','$sphone','$amount','$rname','$rphone','$pin','$trxid','$sentby','sent')";
$inserted_rows = $db->insert($query);
if ($inserted_rows) {
echo "<div class='success'>Money Sent Successful.
</div>";
// SMS Sending
require('textlocal.class.php');
$textlocal = new Textlocal('[email protected]', '3fc067a1a4a3929');
$numbers = array($rphone);
$sender = 'GET MONEY';
$message = 'You Have Received '.$amount. ' TK from '.$sphone.' , Your Pin: '.$pin.' And Trx ID: '.$trxid.' .';
$response = $textlocal->sendSms($numbers, $message, $sender);
//print_r($response);
$numbers = array($sphone);
$sender = 'GET MONEY';
$message = 'Sent Money ' .$amount.' TK to '.$rphone.' Successful. TrxID:'.$trxid. '.';
$response = $textlocal->sendSms($numbers, $message, $sender);
}else {
echo "<div class='error'>Transection Not Successful !</div>";
}
}
?>
</body>
</html>