forked from thegr8dev/doctorpatientportal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
payprocess.php
54 lines (46 loc) · 1.34 KB
/
payprocess.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
<?php
session_start();
if(!isset($_SESSION['useremail'])){
echo "Access Denied";
}else{
if(isset($_POST['pay'])){
include('includes/conn.php');
$cardnum = $_POST['cno'];
$pin = $_POST['pin'];
if((strlen($cardnum)<16) || (strlen($pin)<4) ){
echo "Invalid Pin or card No. Go back and Correct";
}elseif((strlen($cardnum)>16) || (strlen($pin)>4) ){
echo "Invalid Pin or card No. Go back and Correct";
}
elseif((strlen($cardnum)==16) && (strlen($pin)==4) ){
$getid = $_POST['getid'];
function generateRandomString($length = 12) {
$characters = '201725782593';
$charactersLength = strlen($characters);
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, $charactersLength - 1)];
}
return $randomString;
}
$tid = generateRandomString();
$q = "UPDATE appointments SET tid = '$tid' where id = '$getid' ";
$r = mysqli_query($con,$q);
if($r = true){
echo '<script>';
echo 'alert("Payment Successfull");';
echo '</script>';
echo '<br><img style="margin-top:-2%;float:left;" width="50px" src="img/loading.gif">Redirecting you to dashboard......';
header("Refresh:2; url=patient.php");
}else{
echo "Payment fail";
}
}
?>
<?php
}else{
echo "Invalid Action";
}
}
?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>