ok

Mini Shell

Direktori : /home/ngwcolle/public_html/mis/admin/
Upload File :
Current File : /home/ngwcolle/public_html/mis/admin/manage_settings.php

<?php
include('includes/checklogin.php');
check_login();
// $rid = $_GET['pid'];
// error_reporting(E_ALL);
if (isset($_GET['delid'])) {
 
  $rdid = intval($_GET['delid']);
  echo $rdid;
  $sql = "DELETE  from tbl_scholarship where id=:rid";
  $query = $dbh->prepare($sql);
  $query->bindParam(':rid', $rdid);
  // $query->execute();
  if ($query->execute()) {
    echo "<script>alert('Scholarship Data Deleted');</script>";
    // $url = "edit_student.php?pid=".$_GET['rid'];
    echo "<script>window.location.href = 'manage_Scholarship.php'</script>";
  } else {
    echo '<script>alert("update failed! try again later")</script>';
  }
}
if (isset($_POST['submit'])) {
  $schname = $_POST['schname'];
  $course = $_POST['course'];
  $category = $_POST['category'];
//   foreach ($_GET['category'] as $value) {
//     $instructor.= $value.",";
// }
// $choice=mysql_real_escape_string($_POST[‘game’]);
$choice1=implode(',',$category);
  // $feed = $_POST['passout'];
  // $breed = $_POST['breed'];
  // $adetails = $_POST['details'];
  // $aimage = $_FILES["animalimage"]["name"];
  // move_uploaded_file($_FILES["animalimage"]["tmp_name"], "images/" . $_FILES["animalimage"]["name"]);
  $sql = "SELECT * from tbl_scholarship where schname='$schname' and coursename='$course'";
  $query = $dbh->prepare($sql);
  // $query->bindParam(':aid', $aid, PDO::PARAM_STR);
  $query->execute();
  $results = $query->fetchAll(PDO::FETCH_OBJ);
  if ($query->rowCount() > 0) {
    echo "<script>alert('Scholarship alreadt inserted.Check for another session..');</script>";
  } else {
    $sql = "INSERT INTO tbl_scholarship(schname,coursename,studentsof) VALUES(:aname,:degree,:cage)";
    $query = $dbh->prepare($sql);
    $query->bindParam(':aname', $schname);
    $query->bindParam(':degree', $course, PDO::PARAM_STR);
    $query->bindParam(':cage', $choice1, PDO::PARAM_STR);
    // $query->bindParam(':admitted', $cage);
    // $query->bindParam(':clc', $feed);
    // $query->bindParam(':adetails', $adetails, PDO::PARAM_STR);
    // $query->bindParam(':aimage', $aimage, PDO::PARAM_STR);
    $query->execute();
    $lastInsertId = $dbh->lastInsertId();
    if ($lastInsertId) {
      echo "<script>alert('Scholarship inserted successfully');</script>";
      echo "<script>window.location.href = 'manage_Scholarship.php'</script>";
    } else {
      $error = "Something went wrong. Please try again";
    }
  }
}
?>
<!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, shrink-to-fit=no">
  <meta name="description" content="">
  <meta name="author" content="">
  <link href="img/logo/logo.png" rel="icon">
  <title>Admin - Edit Scholarship</title>
  <link href="vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
  <link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css">
  <link href="css/ruang-admin.min.css" rel="stylesheet">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/bbbootstrap/libraries@main/choices.min.css">
  <script src="https://cdn.jsdelivr.net/gh/bbbootstrap/libraries@main/choices.min.js"></script>
  <style>
    .errorWrap {
      padding: 10px;
      margin: 0 0 20px 0;
      background: #fff;
      border-left: 4px solid #dd3d36;
      -webkit-box-shadow: 0 1px 1px 0 rgba(0, 0, 0, .1);
      box-shadow: 0 1px 1px 0 rgba(0, 0, 0, .1);
    }

    .succWrap {
      padding: 10px;
      margin: 0 0 20px 0;
      background: #fff;
      border-left: 4px solid #5cb85c;
      -webkit-box-shadow: 0 1px 1px 0 rgba(0, 0, 0, .1);
      box-shadow: 0 1px 1px 0 rgba(0, 0, 0, .1);
    }
  </style>
</head>
<body id="page-top">
  <div id="wrapper">
    <!-- Sidebar -->
    <?php include('includes/sidebar.php'); ?>
    <!-- Sidebar -->
    <div id="content-wrapper" class="d-flex flex-column">
      <div id="content">
        <!-- TopBar -->
        <?php include('includes/header.php'); ?>
        <!-- Topbar -->

        <!-- Container Fluid-->
        <div class="container-fluid" id="container-wrapper">
          <div class="d-sm-flex align-items-center justify-content-between mb-4">
            <h1 class="h3 mb-0 text-gray-800">Setting</h1>
            <ol class="breadcrumb">
              <li class="breadcrumb-item"><a href="dashboard.php">Home</a></li>
              <li class="breadcrumb-item active" aria-current="page">Web Settings</li>
            </ol>
          </div>

          <div class="row">
            <div class="col-lg-12">
              <!-- Form Basic -->
              <div class="card mb-4">
                <div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
                  <h6 class="m-0 font-weight-bold text-primary">Edit Settings</h6>
<!-- <h6><a href="sch_entry.php" class="btn btn-success btn-sm">Add Beneficiary </a>
<a href="sch_entry.php" class="btn btn-info btn-sm">Reports </a></h6> -->
                </div>
                <div class="card-body">
                  <?php
                  if ($error) { ?>
                    <div class="errorWrap">
                      <strong>ERROR</strong>:<?php echo htmlentities($error); ?>
                    </div>
                  <?php
                  } else if ($msg) { ?>
                    <div class="succWrap">
                      <strong>SUCCESS</strong>:<?php echo htmlentities($msg); ?>
                    </div>
                  <?php
                  } ?>
                  <div class="row">
                    <div class="col-md-6">
                      <?php
                    $sql = "SELECT * from tblsetting where id='1'";
                $query = $dbh -> prepare($sql);
               
                $query->execute();
                $results=$query->fetchAll(PDO::FETCH_OBJ);
                                
                  foreach($results as $result)
                  { 
                    ?>
                    <form class="form-sample" method="post" enctype="multipart/form-data">
                    <div class="input-group">
                      <label for="letterno" class="input-group">Last Letter No.</label>
  <input type="text" class="form-control" id="letterno" name="lastletter" value="<?php echo $result->lastletterno;?>"disabled placeholder="Last Letter no." aria-label="Recipient's username" aria-describedby="basic-addon2">
  <div class="input-group-append">
    <button class="btn btn-outline-primary" id="edit" type="button">Edit</button>
    <button class="btn btn-outline-success" type="submit" name="letterno">Update</button>
  </div>
</div>
<?php }?>
                        

                      </form>


                    </div>
                    <div class="col-md-6">
                      <form class="form-sample" method="post" enctype="multipart/form-data">
                        <div class="row">
                          <div class="form-group col-md-12">
                            <label class="col-sm-12 pl-0 pr-0">Year Closing(Reset Counter)</label>
                           <button class="btn btn-success form-control" name="rstletter" type="submit" onclick="return confirm('Are you sure?');">Reset Letter(Issue Register)</button>
                           <button class="btn btn-success form-control mt-2" name="rstletter" type="submit" onclick="return confirm('Are you sure?');">Reset Account(Ledger)</button>
                           <button class="btn btn-success form-control mt-2" name="rstletter" type="submit" onclick="return confirm('Are you sure?');">Reset Letter(Issue Register)</button>
                            
                          </div>
                        </div>
                        
                        
                          </div>

                        </div>

                        <!-- <div class="row">
                          <div class="form-group col-md-12">
                            <label class="col-sm-12 pl-0 pr-0">Students Passout/CLC</label>
                            <div class="col-sm-12 pl-0 pr-0">
                              <input type="number" name="passout" class="form-control">
                            </div>
                          </div>

                        </div> -->
                       
                      </form>

<?php
if(isset($_POST['letterno']))
{
  $lastletter=$_POST['lastletter'];
  $sql="update tblsetting set lastletterno=:aname where id='1'";
  $query = $dbh->prepare($sql);
  $query->bindParam(':aname',$lastletter,PDO::PARAM_STR);
  $query->execute();
  if($query->execute()){
    echo "<script>alert('Letter last index details updated successfully');</script>";
    echo "<script>window.location.href = 'manage_settings.php'</script>";
  
 }else{
   $msg="Failed Please try again later";
 }
}

// update tblaccount set prevbalance=amtbalance,amtbalance=0 WHERE id=6
?>

                    </div>
                  </div>




                </div>
              </div>

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

          <!-- Modal Logout -->
          <?php include('includes/modal.php'); ?>

        </div>
        <!---Container Fluid-->
      </div>
      <!-- Footer -->
      <?php include('includes/footer.php'); ?>
      <!-- Footer -->
    </div>
  </div>

  <!-- Scroll to top -->
  <a class="scroll-to-top rounded" href="#page-top">
    <i class="fas fa-angle-up"></i>
  </a>

  <script src="vendor/jquery/jquery.min.js"></script>
  <script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
  <script src="vendor/jquery-easing/jquery.easing.min.js"></script>
  <script src="js/ruang-admin.min.js"></script>
  <script>
    $(document).ready(function() {

      var multipleCancelButton = new Choices('#choices-multiple-remove-button', {
        removeItemButton: true,
        maxItemCount: 5,
        searchResultLimit: 10,
        renderChoiceLimit: 10
      });


    });
  </script>
   <script> 
        $(document).ready(function () { 
          $("#letterno").prop('disabled', true);
            $("#edit").click(function () { 
                alert("You are updating the letter no.!"); 
                $("#letterno").prop('disabled', false);
                $("#letterno").focus();
            }); 
        }); 
    </script> 
</body>

</html>

Zerion Mini Shell 1.0