<?php
include("include/connection.php");
session_start();

if(isset($_POST['submit']))
{
  
  $userid=$_SESSION['frontuserid'];
   $amount_1= $_POST['deposit'];
   $utr_no= $_POST['refrence'];
   $phone=$_POST['phone'];
   $refcode=$userid.refcode();
   
   $sqlyt = mysqli_query($con,"select * from tbl_walletsummery where utr_no='$utr_no'");
   $count = mysqli_num_rows($sqlyt);
   if($count == '0')
   {
  $sql = "INSERT INTO tbl_walletsummery (phone,userid,orderid,amount,amount_1,utr_no,type,actiontype,status)
                                 VALUES ('$phone','$userid','$refcode', '$amount_1', '$amount_1','$utr_no','credit','recharge','0')";
   if(mysqli_query($con, $sql)){  

    echo "<script>
alert('Amount Recharge Request sucessfully');
window.location.href='myaccount';
</script>";  

    }else{  

    echo "<script>
alert('Amount Recharge Request not sucessfully');
window.location.href='checkout';
</script>";  

    }  
   }else{  

    echo "<script>
alert('UTR no already exists');
window.location.href='checkout';
</script>";  

    }  
}
?>