<?php
include"initialize_page.php";
      if(isset($_REQUEST['id'])&&$_REQUEST['id']!=""&&isset($_REQUEST['accid'])&&$_REQUEST['accid']!="")
         {
			 $user_id=$_REQUEST['id'];
			 $acc_id=$_REQUEST['accid'];
			 $test_creditcard=credit_cardyesno($user_id,$acc_id);
			   if($test_creditcard==0)
			    {
?>
<!DOCTYPE html>
<html lang="en">

<head>
  
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

	<title>Add New Credit Card </title>

	<!-- Bootstrap core CSS -->
	<link rel="stylesheet" href="assets/css/bootstrap/bootstrap.css" /> 

	<!-- datatables Styling  -->
    <link rel="stylesheet" href="assets/css/plugins/datatables/jquery.dataTables.css" />
    
    <!-- Fonts  -->
    <link href='http://fonts.googleapis.com/css?family=Raleway:400,500,600,700,300' rel='stylesheet' type='text/css'>
    
    <!-- Base Styling  -->
    <link rel="stylesheet" href="assets/css/app/app.v1.css" />

	<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via  -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
      <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
<script type="text/javascript" src="jquery-1.11.1.min.js"></script>
		<script type="text/javascript">
	 $(document).ready(function() {
    $("#addcustom").on('submit',(function(e) {
e.preventDefault();

$.ajax({
url: "controller.php", // Url to which the request is send
type: "POST",             // Type of request to be send, called as method
data: new FormData(this), // Data sent to server, a set of key/value pairs (i.e. form fields and values)
contentType: false,       // The content type used when sending data to the server.
cache: false,             // To unable request pages to be cached
processData:false,        // To send DOMDocument or non processed data file it is set to false
success: function(data)   // A function to be called if request succeeds
{
	//alert(data);
	if(data=="empty")
	{
		alert("Please Fill or Select All Fields...");
	}
	if(data=="done")
	{
		alert("Added successfully..");
		window.location.href='<?php   echo website_settingdata('x_weburl');   ?>admin/cards.php';
	}
	if(data=="select")
	{
	alert("Please Select Card Type..");	
	}
	if(data=="notnumeric")
	{
	alert("Withdrawal Limit should be in Numeric..");	
	}
	if(data=="emialalready")
	{
	alert("Email Already Exist Please Change..");	
	}
	if(data=="usernamealreadyexist")
	{
	alert("UserID Already Exist Please Change..");	
	}
	if(data=="usernamenotvalid")
	{
	alert("UserID not valid [UserID contains only dot(.), dash(-), underscore(_) and Min length is 3 and Max length is 50 ]..");	
	}
	if(data=="pinnotmatch")
	 {
	alert("Account Pin and Verify Pin Number should be same..");	 
	 }
	 if(data=="passnotmatch")
	 {
	alert("Password and Confirm Password should be same..");	 
	 }
	
}
});
}));
});
	
	</script>
		
</head>
<body>	

	
    
	<?php    include"xleftmenu.php"; ?>
    
    <section class="content">
    	
         <?php  include"xheader.php";  ?>
        <!-- Header Ends -->
        
        <div class="warper container-fluid">
        	
            <div class="page-header"><h2>Add New Credit Card </h2></div>
            
            
            <div class="row">
            
            	<div class="col-md-12">
                
                	<div class="panel panel-default">
                        
                       
                        <div class="panel-body">
                        
                       
                         <form method="post" action="" id="addcustom">
                    <input type="hidden" name="q" value="add_new_creditcard">
                  <input type="hidden" name="user_id" value="<?php   echo $user_id; ?>">
                   <input type="hidden" name="acc_id" value="<?php   echo $acc_id; ?>">       
                            
                         <div class="form-group">
                            	<div class="row">
            	<div class="col-lg-6 col-md-6 col-sm-6">
               
                  <div class="form-group">
                    <label for="exampleInputEmail1">Credit Card Number</label>
                    <input type="text" class="form-control"  name="ccnumber"  required>
                    </div>
               <div class="form-group">
                     <label for="exampleInputEmail1">Card Type</label>
                   <br>
                   <input type="radio" name="cardtype" value="mastercard" >Master Card &nbsp;&nbsp;&nbsp;  <input type="radio" name="cardtype" value="visa">Visa
                    </div>
               <div class="form-group">
                     <label for="exampleInputEmail1">Expiry Date</label><br>
                    <select name="exmounth">
                    <?php
					  for($i=1;$i<=12;$i++)
					    {
						echo '<option value="'.$i.'">'.$i.'</option>';	
						}
					?>
                    </select> 
                    &nbsp;&nbsp;&nbsp;&nbsp;
                     <select name="exyear">
                    <?php
					  for($j=2017;$j<=2030;$j++)
					    {
						echo '<option value="'.$j.'">'.$j.'</option>';	
						}
					?>
                    </select> (MM/YYYY)
                    </div>
             
                  
               
             
                   
                    
                   
               
               </div>
               
               <div class="col-lg-6 col-md-6 col-sm-6">
               
             
            
                <div class="form-group">
                   <label for="exampleInputEmail1">Name on Card</label>
                    <input type="text" class="form-control"   name="nameoncard" value="<?php  echo  user_bankuser($user_id,"x_fname"); ?> <?php  echo  user_bankuser($user_id,"x_lname"); ?>" required>
                    </div>
              <div class="form-group">
                   <label for="exampleInputEmail1">Card CVV2</label>
                    <input type="text" class="form-control"   name="cvvc"  required>
                    </div>
                    <div class="form-group">
                     <label for="exampleInputEmail1">Withdrawal Limit</label>
                    <input type="text" class="form-control"   name="wlimit"  required >
                    </div>
                    
                    
                    
                    
                    
               </div>
              
               </div>     
                            <div class="form-group">
                                <input type="submit" class="btn btn-primary"  value="Add Credit Card">
                               
                            </div>
                            </form>
                        </div>
                     
                    </div>
                    
                    
                    
                    
                    
                    
                </div>
                
                
            
            </div>
            
            
            
            
        </div>
    
            
                
        <!-- Warper Ends Here (working area) -->
        
        
        <footer class="container-fluid footer">
        	Copyright &copy; <?php   echo date('Y');  ?>
        </footer>
        
    
    </section>
    <!-- Content Block Ends Here (right box)-->
    
    
    
    <!-- JQuery v1.9.1 -->
	<script src="assets/js/jquery/jquery-1.9.1.min.js" type="text/javascript"></script>
    
    <!-- Bootstrap -->
    <script src="assets/js/bootstrap/bootstrap.min.js"></script>
    
    <!-- NanoScroll -->
    <script src="assets/js/plugins/nicescroll/jquery.nicescroll.min.js"></script>
    
    
	<!-- Data Table -->
    <script src="assets/js/plugins/datatables/jquery.dataTables.js"></script>
    <script src="assets/js/plugins/datatables/DT_bootstrap.js"></script>
    <script src="assets/js/plugins/datatables/jquery.dataTables-conf.js"></script>
    
    
    <!-- Custom JQuery -->
	<script src="assets/js/app/custom.js" type="text/javascript"></script>
    

    
	<script>
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
    
    ga('create', 'UA-56821827-1', 'auto');
    ga('send', 'pageview');
    
    </script>
</body>
</html>
<?php
				}
				else
				{
				header("location:index.php"); 	
				}
		 }
		 else
		 {
			header("location:index.php"); 
		 }
		 ?>
