File manager - Edit - /home/cipherteam/htdocs/cipherteam.in/yogi/AdminPanel/AddProduct.php
Back
<?php require_once("Connection.php"); if(!isset($_SESSION['username'])) { header("location:AdminLogin.php"); } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <!-- Tell the browser to be responsive to screen width --> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content=""> <meta name="author" content=""> <!-- Favicon icon --> <link rel="icon" type="image/png" sizes="16x16" href="../assets/images/favicon.png"> <title>Yogi Mineral</title> <!-- This page CSS --> <!-- chartist CSS --> <link href="../assets/node_modules/morrisjs/morris.css" rel="stylesheet"> <!-- Vector CSS --> <script src="assets/node_modules/sweetalert2/dist/sweetalert2.all.min.js"></script> <script src="assets/node_modules/sweetalert2/sweet-alert.init.js"></script> <link href="assets/node_modules/sweetalert2/dist/sweetalert2.min.css" rel="stylesheet"> <link href="../assets/node_modules/vectormap/jquery-jvectormap-2.0.2.css" rel="stylesheet" /> <!--c3 CSS --> <link href="dist/css/pages/easy-pie-chart.css" rel="stylesheet"> <!-- Custom CSS --> <link href="dist/css/style.min.css" rel="stylesheet"> <!-- Dashboard 1 Page CSS --> <link href="dist/css/pages/dashboard2.css" rel="stylesheet"> <!-- 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 file:// --> <!--[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]--> </head> <body class="horizontal-nav skin-megna fixed-layout"> <!--Connection--> <?php if(isset($_POST['type'])) { $p_type=$_POST["type"]; $image='IS_NULL'; $p_capacity=$_POST["capacity"]; $m_unit_id=$_POST["m_unit_id"]; $price=$_POST["price"]; $allowed_ext= array('jpg','jpeg','png'); $file_name =$_FILES['image']['name']; $tmp = explode('.',$file_name); $file_ext = strtolower(end($tmp)); $file_size=$_FILES['image']['size']; $file_tmp= $_FILES['image']['tmp_name']; if(!empty($file_tmp)) { if(in_array($file_ext,$allowed_ext) === true) { if($file_size < 1048576) { $data = file_get_contents($file_tmp); $base64 = 'data:image/' . $file_ext . ';base64,' . base64_encode($data); $sql = "INSERT INTO `Product` (`p_id`, `p_type`, `image`, `p_capacity`, `m_unit_id`, `price`) VALUES (NULL, '$p_type', '$base64', '$p_capacity', '$m_unit_id', '$price')"; $con->query($sql); echo '<script>swal({ title: "Saved!", text: "Product Created", type: "success", confirmButtonText: "OK" }); </script>'; } else { echo '<script>swal({ title: "Error!", text: "File size must be under 1MB", type: "error", confirmButtonText: "OK" }); </script>'; } } else { echo '<script>swal({ title: "Error!", text: "Extension not allowed.(only jpg,jpeg,png are allowed)", type: "error", confirmButtonText: "OK" }); </script>'; } } else { $sql = "INSERT INTO `Product` (`p_id`, `p_type`, `image`, `p_capacity`, `m_unit_id`, `price`) VALUES (NULL, '$p_type', '$image', '$p_capacity', '$m_unit_id', '$price')"; $con->query($sql); echo '<script>swal({ title: "Saved!", text: "Product Created", type: "success", confirmButtonText: "OK" }); </script>'; } } ?> <!-- ============================================================== --> <!-- Main wrapper - style you can find in pages.scss --> <!-- ============================================================== --> <div id="main-wrapper"> <!-- ============================================================== --> <!-- Topbar header - style you can find in pages.scss --> <!-- ============================================================== --> <header class="topbar"> <nav class="navbar top-navbar navbar-expand-md navbar-dark"> <!-- ============================================================== --> <!-- Logo --> <!-- ============================================================== --> <div class="navbar-header"> <a class="navbar-brand" href="index.html"> </div> <!-- ============================================================== --> <!-- End Logo --> <!-- ============================================================== --> <div class="navbar-collapse"> <!-- ============================================================== --> <!-- toggle and nav items --> <!-- ============================================================== --> <ul class="navbar-nav mr-auto"> <!-- This is --> <li class="nav-item"> <a class="nav-link nav-toggler d-block d-md-none waves-effect waves-dark" href="javascript:void(0)"><i class="ti-menu"></i></a> </li> <li class="nav-item"> <a class="nav-link sidebartoggler d-none waves-effect waves-dark" href="javascript:void(0)"><i class="icon-menu"></i></a> </li> <!-- ============================================================== --> <!-- Search --> <!-- ============================================================== --> </ul> <!-- ============================================================== --> <!-- User profile and search --> <!-- ============================================================== --> <ul class="navbar-nav my-lg-0"> <!-- ============================================================== --> <!-- ============================================================== --> <!-- User Profile --> <!-- ============================================================== --> <li class="nav-item dropdown u-pro"> <a class="nav-link dropdown-toggle waves-effect waves-dark profile-pic" href="" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><img src="logo1.png" alt="user" class=""> <span class="hidden-md-down">Mark <i class="fa fa-angle-down"></i></span> </a> <div class="dropdown-menu dropdown-menu-right animated flipInY"> <!-- text--> <a href="javascript:void(0)" class="dropdown-item"><i class="ti-user"></i> My Profile</a> <!-- text--> <div class="dropdown-divider"></div> <!-- text--> <a href="javascript:void(0)" class="dropdown-item"><i class="ti-settings"></i> Account Setting</a> <!-- text--> <div class="dropdown-divider"></div> <!-- text--> <a href="login.html" class="dropdown-item"><i class="fa fa-power-off"></i> Logout</a> <!-- text--> </div> </li> <!-- ============================================================== --> <!-- End User Profile --> <!-- ============================================================== --> <li class="nav-item right-side-toggle"> <a class="nav-link waves-effect waves-light" href="javascript:void(0)"><i class="ti-settings"></i></a></li> </ul> </div> </nav> </header> <!-- ============================================================== --> <!-- End Topbar header --> <!-- ============================================================== --> <!-- ============================================================== --> <!-- Left Sidebar - style you can find in sidebar.scss --> <!-- ============================================================== --> <aside class="left-sidebar"> <!-- Sidebar scroll--> <div class="scroll-sidebar"> <!-- Sidebar navigation--> <?php include("NavBarMenu.php"); ?> <!-- End Sidebar navigation --> </div> <!-- End Sidebar scroll--> </aside> <!-- ============================================================== --> <!-- End Left Sidebar - style you can find in sidebar.scss --> <!-- ============================================================== --> <!-- ============================================================== --> <!-- Page wrapper --> <!-- ============================================================== --> <div class="page-wrapper"> <!-- ============================================================== --> <!-- Container fluid --> <!-- ============================================================== --> <div class="container-fluid"> <!-- ============================================================== --> <!-- Bread crumb and right sidebar toggle --> <!-- ============================================================== --> <div class="row page-titles"> <div class="col-md-5 align-self-center"> <h4 class="text-themecolor">Add Product</h4> </div> <div class="col-md-7 align-self-center text-right"> <div class="d-flex justify-content-end align-items-center"> <?php if(isset($msg)) { echo $msg; } ?> </div> </div> </div> <!-- ============================================================== --> <!-- End Bread crumb and right sidebar toggle --> <!-- ============================================================== --> <!-- ============================================================== --> <!-- Info box --> <!-- ============================================================== --> <!-- row --> <div class="row"> <div class="col-12"> <div class="card"> <div class="card-body"> <h4 class="card-title">Add Product Details</h4> <form class="mt-4" method="post" action="AddProduct.php" enctype="multipart/form-data"> <div class="form-group"> <label for="p_type">Type</label> <input type="text" class="form-control" id="exampleInputEmail1" name="type" aria-describedby="emailHelp" placeholder="Enter Type" required> </div> <div class="form-group"> <label for="pho_no">capacity</label> <input type="number" class="form-control" id="exampleInputPassword1" name="capacity" placeholder="Enter Capacity" required> </div> <div class="form-group"> <label for="pho_no">Image</label> <input type="file" class="form-control" id="exampleInputPassword1" name="image" required> </div> <div class="form-group"> <label for="m_unit_id">Measurement Unit</label> <select class="custom-select col-12" name="m_unit_id" id="inlineFormCustomSelect"> <option selected>Choose...</option> <?php $sql = "SELECT `m_unit_master`.`m_unit_id` AS 'ID',`m_unit_master`.`m_unit` AS 'NAME' FROM `m_unit_master`"; $rows = $con->query($sql); while($row = $rows->fetch_assoc()) { ?> <option value="<?php echo $row['ID']; ?>"><?php echo $row['NAME']; ?></option> <?php } ?> </select> </div> <div class="form-group"> <label for="price">Price</label> <select name="price"> <option>select price</option> <option>10</option> <option>20</option> <option>25</option> <option>80</option> <option>100</option> <option>150</option> <option>180</option> </select> </div> <a href="Products.php" class="btn btn-info"><i class="icon-action-undo"></i> </a> <button type="submit" class="btn btn-primary">Submit</button> </form> </div> </div> </div> </div> <!-- row --> <!-- ============================================================== --> <!-- End Right sidebar --> <!-- ============================================================== --> </div> <!-- ============================================================== --> <!-- End Container fluid --> <!-- ============================================================== --> </div> <!-- ============================================================== --> <!-- End Page wrapper --> <!-- ============================================================== --> <!-- ============================================================== --> <!-- footer --> <!-- ============================================================== --> <!-- ============================================================== --> <!-- End footer --> <!-- ============================================================== --> </div> <!-- ============================================================== --> <!-- End Wrapper --> <!-- ============================================================== --> <!-- ============================================================== --> <!-- All Jquery --> <!-- ============================================================== --> <script src="../assets/node_modules/jquery/jquery-3.2.1.min.js"></script> <!-- Bootstrap popper Core JavaScript --> <script src="../assets/node_modules/popper/popper.min.js"></script> <script src="../assets/node_modules/bootstrap/dist/js/bootstrap.min.js"></script> <!-- slimscrollbar scrollbar JavaScript --> <script src="dist/js/perfect-scrollbar.jquery.min.js"></script> <!--Wave Effects --> <script src="dist/js/waves.js"></script> <!--Menu sidebar --> <script src="dist/js/sidebarmenu.js"></script> <!--Custom JavaScript --> <script src="dist/js/custom.min.js"></script> <!-- ============================================================== --> <!-- This page plugins --> <!-- ============================================================== --> <!-- Flot Charts JavaScript --> <script src="../assets/node_modules/flot/jquery.flot.js"></script> <script src="../assets/node_modules/flot.tooltip/js/jquery.flot.tooltip.min.js"></script> <!--sparkline JavaScript --> <script src="../assets/node_modules/sparkline/jquery.sparkline.min.js"></script> <!-- EASY PIE CHART JS --> <script src="../assets/node_modules/jquery.easy-pie-chart/dist/jquery.easypiechart.min.js"></script> <script src="../assets/node_modules/jquery.easy-pie-chart/easy-pie-chart.init.js"></script> <!-- Vector map JavaScript --> <script src="../assets/node_modules/vectormap/jquery-jvectormap-2.0.2.min.js"></script> <script src="../assets/node_modules/vectormap/jquery-jvectormap-world-mill-en.js"></script> <!-- Chart JS --> <script src="dist/js/dashboard2.js"></script> </body> </html>
| ver. 1.4 |
Github
|
.
| PHP 8.2.9 | Generation time: 0.05 |
proxy
|
phpinfo
|
Settings