<?php 
	include 'header.php';





    $sql = mysqli_query($link, "SELECT * FROM  settings ");
    if (mysqli_num_rows($sql) > 0) {
        $row = mysqli_fetch_assoc($sql);
        $_sitename = $row['sitename'];
        $_siteurl = $row['siteurl'];
        $_sitemail = $row['sitemail'];
        $_admin_email = $row['admin_email'];
        $_reg_bonus_amt = $row['reg_bonus_amt'];
        $_reg_bonus = $row['reg_bonus'];
        $_ref_bonus_amt = $row['ref_bonus_amt'];
        $_ref_bonus = $row['ref_bonus'];
     }

          if (isset($_POST['submit'])) {
          $sitename = trim($_POST['sitename']);
          $siteurl = trim($_POST['siteurl']);
          $sitemail = trim($_POST['sitemail']);
          $sitemail = trim($_POST['sitemail']);
          $admin_email = trim($_POST['admin_email']);
          $regbonusamount= trim($_POST['regbonusamount']);
          $regbonus = trim($_POST['regbonus']);
          $refbonusamount = trim($_POST['refbonusamount']);
          $refbonus = trim($_POST['refbonus']);
      
            $Sql = mysqli_query($link, "UPDATE settings SET sitename = '$sitename', siteurl = '$siteurl', sitemail ='$sitemail', admin_email = '$admin_email', reg_bonus_amt = '$regbonusamount', reg_bonus = '$regbonus', ref_bonus = '$refbonus', ref_bonus_amt = '$refbonusamount' ");
            if ($Sql) {
           echo "<script>
               alert(' Updated Successfully');
           </script>";
            }
  }








 ?>


 <!-- Content wrapper scroll start -->
        <div class="content-wrapper-scroll">

          <!-- Content wrapper start -->
          <div class="content-wrapper">

            <!-- Row start -->
            <div class="row">
              <div class="col-sm-12 col-12">

                <!-- Card start -->
                <div class="card">
                  <div class="card-header">
                    <div class="card-title">Site Setting</div>
                  </div>
                  <div class="card-body">

                    <!-- Row start -->
                    <form method="POST" action="sitesetting.php" >
                    <div class="row">
              
                      <div class="col-xxl-6 col-xl-6 col-lg-6 col-md-6 col-sm-6 col-6">
                        <div class="mb-3">
                          <label for="inputEmail" class="form-label">Site name</label>
                          <input type="text" class="form-control" id="inputEmail" name="sitename" value="<?php echo $_sitename ?>">
                        </div>
                      </div>
                       <div class="col-xxl-6 col-xl-6 col-lg-6 col-md-6 col-sm-6 col-6">
                        <div class="mb-3">
                          <label for="inputNumber" class="form-label">Siteurl</label>
                          <input type="text" class="form-control" id="inputNumber" name="siteurl" value="<?php  echo $_siteurl  ?>">
                        </div>
                      </div>
                      <div class="col-xxl-6 col-xl-6 col-lg-6 col-md-6 col-sm-6 col-6">
                        <div class="mb-3">
                          <label for="inputCompanyName" class="form-label">Site Mail</label>
                          <input type="text" class="form-control" id="inputCompanyName" name="sitemail" value=" <?php echo $sitemail ?> ">
                        </div>
                      </div>

                      <div class="col-xxl-6 col-xl-6 col-lg-6 col-md-6 col-sm-6 col-6">
                        <div class="mb-3">
                          <label for="inputCompanyName" class="form-label">Admin Email</label>
                          <input type="text" class="form-control" id="inputCompanyName" name="admin_email" value="<?php echo $_admin_email   ?> ">
                        </div>
                      </div>
                      
                      <div class="col-xxl-6 col-xl-6 col-lg-6 col-md-6 col-sm-6 col-6">
                        <div class="mb-3">
                          <label for="inputCompanyName" class="form-label">Reg bonus amount</label>
                          <input type="text" class="form-control" id="inputCompanyName" name="regbonusamount" value="<?php echo $_reg_bonus_amt  ?> ">
                        </div>
                      </div>

                      <div class="col-xxl-6 col-xl-6 col-lg-6 col-md-6 col-sm-6 col-6">
                        <div class="mb-3">
                          <label for="inputCompanyName" class="form-label">Reg bonus</label>
                          <input type="text" class="form-control" id="inputCompanyName" name="regbonus" value="<?php echo $_reg_bonus  ?> ">
                        </div>
                      </div>


                      <div class="col-xxl-6 col-xl-6 col-lg-6 col-md-6 col-sm-6 col-6">
                        <div class="mb-3">
                          <label for="inputCompanyName" class="form-label">Ref bonus amount</label>
                          <input type="text" class="form-control" id="inputCompanyName" name="refbonusamount" value="<?php echo $_ref_bonus_amt ?> ">
                        </div>
                      </div>


                      
                      <div class="col-xxl-6 col-xl-6 col-lg-6 col-md-6 col-sm-6 col-6">
                        <div class="mb-3">
                          <label for="inputCompanyName" class="form-label">Ref bonus</label>
                          <input type="text" class="form-control" id="inputCompanyName" name="refbonus" value="<?php echo $_ref_bonus ?> ">
                        </div>
                      </div>
              
            
                    <!-- Row end -->

                      <button class="btn btn-success" name="submit" type="submit">Submit</button>

                    <!-- Form actions footer end -->

                    </form>

                  </div>
                </div>
                <!-- Card end -->

              </div>

            </div>
            <!-- Row end -->

          </div>
          <!-- Content wrapper end -->




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