<?php
include'connection.php';
include'time.php';
    // Change Profile Programme// 
    
    $usrid = $_GET['usrid'];
    $amount = $_GET['amount'];
    $pdate = $_GET['date'];
    $PayMode = $_GET['PayMode'];
    $bank = $_GET['bank'];
    $txnNo = $_GET['txnNo'];
    $rmark = $_GET['rmark'];
    
    $quGetDupPayment="select * from paymentreq where Txnnumber='$txnNo' and Status='PENDING' or Txnnumber='$txnNo' and Status='APPROVED'";
    $reGetDupPayment=mysqli_query($con,$quGetDupPayment);
    $DupPayment=mysqli_num_rows($reGetDupPayment);
    if($DupPayment==0)
    {
            $qinsert="insert into paymentreq(Date,Time,Userid,Paymentdate,Amount,Mode,Txnnumber,Bankname,Remarks,Status)
	            values('$date','$time','$usrid','$pdate','$amount','$PayMode','$txnNo','$bank','$rmark','PENDING')";
            if(mysqli_query($con,$qinsert))
            {
                echo "<div class='msg-div'>
                        <form method='post'>
                        <h3>Request Submitted Successfully !</h3><br>
                        <i class='fa fa-check-circle' aria-hidden='true' id='okIcon'></i><br><br>
                        <button type='submit' class='btnPopup'>OK</button><br><br>
                        </form>
                    </div>";
            }
    }
    else
    {
        echo "<div class='msg-div'>
                <form method='post'>
                <h3>Duplicate Payment Not Allowed !</h3><br>
                <i class='fa fa-ban' aria-hidden='true' id='NotokIcon'></i><br><br>
                <button type='submit' class='btnPopup'>OK</button><br><br>
                </form>
            </div>";
    }
?>