<?php include 'inc/header.php';?>
<?php include 'inc/sidebar.php';?>
<?php include 'inc/navbar.php';?>
<?php

  if(!empty($_POST)){

      $merchant_id = $_POST['merchant_id'];  
      $merchant_key = $_POST['merchant_key'];  
      $merchant_salt = $_POST['merchant_salt'];
      $web_url = $_POST['web_url'];

   
        

    $update = $dbh->prepare("UPDATE paytr_settings SET 
     merchant_id = '".$merchant_id."',
     merchant_key = '".$merchant_key."',
     merchant_salt = '".$merchant_salt."',
     web_url = '".$web_url."'
      WHERE id = 1 " );

      $update->execute();

      }
?>

<?php
$ayar = $dbh->query("SELECT * FROM paytr_settings WHERE id = 1 ", PDO::FETCH_ASSOC);
if ($ayar->rowCount()) {
    foreach ($ayar as $ayar) {
    }
}
?>
        <!-- Page Content-->
        <div class="page-content">
          <div class="container-fluid">
            <!-- Page-Title -->

            <form method="post" action="" enctype="multipart/form-data">
              
              <div class="row">
                <div class="col-sm-12">
                  <div class="page-title-box">
                    <div class="row">
                      <div class="col">
                        <h4 class="page-title">PayTR Ayarları</h4>
                        <ol class="breadcrumb">
                          <li class="breadcrumb-item"><a href="index.php">Anasayfa</a></li> 
                          <li class="breadcrumb-item active">PayTR Ayarları</li>
                        </ol>
                      </div><!--end col-->
                      <div class="col-auto align-self-center">
                        <button class="btn btn-primary" type="submit">
                          <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
                          GÜNCELLE
                        </button> 
                      </div><!--end col-->  
                    </div><!--end row-->                                                              
                  </div><!--end page-title-box-->
                </div><!--end col-->
              </div><!--end row-->
              <!-- end page title end breadcrumb -->


              <div class="row">
                <div class="col-lg-12">
                  <div class="card">
                    <div class="card-header">
                      <h4 class="card-title">PayTR Ayarları</h4>
                      <p class="text-muted mb-0">Değerli kullanıcı, bu alanda paytr sanal pos modülünü kullanmanız için gerekli ayar bilgilerini girmeniz gerekmektedir.</p> 
                    </div><!--end card-header-->
                    <div class="card-body">
                      <div class="row">

                        <div class="col-xl-6"> 
                          <div class="form-group">
                            <label for="exampleInputEmail1">Mağaza no (merchant_id) </label>
                            <input type="text" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" name="merchant_id" value="<?=$ayar['merchant_id'];?>" required=""> 
                          </div>
                        </div>

                        <div class="col-xl-6"> 
                          <div class="form-group">
                            <label for="exampleInputEmail1">Mağaza şifresi (merchant_key) </label>
                            <input type="text" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" name="merchant_key" value="<?=$ayar['merchant_key'];?>" required=""> 
                          </div>
                        </div>

                        <div class="col-xl-6"> 
                          <div class="form-group">
                            <label for="exampleInputEmail1">Mağaza gizli şifresi (merchant_salt) </label>
                            <input type="text" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" name="merchant_salt" value="<?=$ayar['merchant_salt'];?>" required=""> 
                          </div>
                        </div>

                        <div class="col-xl-6"> 
                          <div class="form-group">
                            <label for="exampleInputEmail1">Site URL (https://siteadiniz.com/) </label>
                            <input type="text" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" name="web_url" value="<?=$ayar['web_url'];?>" required=""> 
                          </div>
                        </div>

                      </div>
                       

                <br>    
                <button class="btn btn-primary btn-block" type="submit">
                  <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
                  GÜNCELLE
                </button>
              </form>                                           
            </div><!--end card-body-->
          </div><!--end card-->
        </div><!--end col-->


      </div><!--end row-->



    </div><!-- container -->

    <?php include 'inc/footer.php';?>

