Server IP : 162.241.126.129 / Your IP : 3.135.209.20 Web Server : Apache System : Linux 162-241-126-129.cprapid.com 4.18.0-477.27.2.el8_8.x86_64 #1 SMP Fri Sep 29 08:21:01 EDT 2023 x86_64 User : rvway5nu4 ( 1018) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/rvway5nu4/www/admin/banner/ |
Upload File : |
<?php include("../../config/data.config.php"); if (!isset($_SESSION["SESS_v_adminLoggedIn"])) { header ("Location: $MAP_VROOT_FILE_PATH/admin/login.php"); exit; } //echo '<pre>'; print_r( $_SESSION ); echo '</pre>'; echo $target = "$DOCUMENT_ROOT$PIC_DIR/banner/$filename"; exit; include("$LIB_DIR/functions.lib.php"); include("$LIB_DIR/db.php"); include("$LIB_DIR/db/mysqli.php"); include("$LIB_DIR/data.constant.php"); include("$LIB_DIR/sitemsgs.php"); include("$LIB_DIR/class.paging.php"); include("$LIB_DIR/functions.mailer.php"); global $SITE_URL, $IMG_DIR; $db = new Db( $DB_HOST, $DB_USERNAME, $DB_PASSWORD, $DB_NAME, $DB_REPORT_ERROR, $DB_PERSISTENT_CONN); if(($_POST['submitForm']) && ($_POST['submitForm'] == 'yes') ){ AddProduct($_POST['v_title'], $_POST['c_status'],$_POST['i_sortOrder'],$db); } $sid3chld0 = 'actve'; $sid3chld2 = 'actve'; $sid3show = 'show'; function AddProduct( $v_title, $c_status, $i_sortOrder, $db) { global $PROMPT, $ARR_GLOBAL_STATUS, $ARR_USERS, $ARR_STATUS, $HTTP_SESSION_VARS, $HTTP_POST_FILES, $HTTP_POST_VARS, $DOCUMENT_ROOT, $PIC_DIR, $BANNER_DIR, $TEMP_DIR; $userNameFlag = FALSE; $userEmailFlag = FALSE; $sql = "SELECT 9 FROM tbl_by_manufacturer WHERE v_title = '".$v_title."' "; $result=$db->query($sql); if($result->num_rows) { $PROMPT = '<div class="alert alert-warning alert-dismissable"> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">X</button> <strong><i class="fa fa-exclamation-circle"></i> Warning : </strong>Already : '.$v_title.' with same group. </div>'; //$_SESSION['msg'] = $PROMPT; //header('Location: '.SUB_DIR_PROJECT.'/admin/banner/by_manufacturesadd.php'); //exit; } $sqlIn = "INSERT INTO tbl_by_manufacturer SET v_title = '".$v_title."', c_status = '".$c_status."', i_sortOrder = '".$i_sortOrder."', i_addedBy = '".$_SESSION['SESS_i_userID']."', dt_addedDate = NOW() "; $db->query($sqlIn); $new_i_productID = $db->getLastId(); if($new_i_productID){ if ($_FILES["v_image"]["size"] > 0) { $filename = $_FILES["v_image"]["name"]; $fileArray = explode(".", $filename); $extension = strtolower(end($fileArray)); $newFileName = "banner/by_manufacture_".$new_i_productID.".$extension"; if ($extension == 'jpg' || $extension == 'jpeg' || $extension == 'gif' || $extension == 'png' || $extension == 'bit') { $target = "$DOCUMENT_ROOT$PIC_DIR/$newFileName"; $filename2 = $newFileName; while (file_exists("$target")) { $random_number = rand(10000, 99999); $newFileName = $random_number."_".$filename2; $target = "$DOCUMENT_ROOT$newFileName"; } if(move_uploaded_file($_FILES["v_image"]["tmp_name"], $target)) { $query1 = "update tbl_by_manufacturer set v_image = '$newFileName' where i_bannerID = '$new_i_productID'"; $db->query($query1); $flag = true; } } else { $message .="Photo not uploaded. Unsupported file format."; } } ///// $PROMPT ='<div class="alert alert-success alert-dismissable"> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">X</button> <strong><i class="fa fa-check-circle"></i> Success :</strong>'.$v_title. ' '.$message.'added successfully. </div>'; }else { $PROMPT = '<div class="alert alert-warning alert-dismissable"> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">X</button> <strong><i class="fa fa-exclamation-circle"></i> Warning :</strong> Sorry try again.; </div>'; } $_SESSION['msg'] = $PROMPT; header('Location: '.SUB_DIR_PROJECT.'/admin/banner/by_manufacturesadd.php'); exit; } ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>Carivon</title> <meta name="description" content=""> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="robots" content="all,follow"> <!-- Bootstrap CSS--> <link rel="stylesheet" href="<?php echo $SITE_URL; ?>/admin/vendor/bootstrap/css/bootstrap.min.css"> <!-- Font Awesome CSS--> <link rel="stylesheet" href="<?php echo $SITE_URL; ?>/admin/vendor/font-awesome/css/font-awesome.min.css"> <!-- Fontastic Custom icon font--> <link rel="stylesheet" href="<?php echo $SITE_URL; ?>/admin/css/fontastic.css"> <!-- Google fonts - Roboto --> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700"> <!-- jQuery Circle--> <link rel="stylesheet" href="<?php echo $SITE_URL; ?>/admin/css/grasp_mobile_progress_circle-1.0.0.min.css"> <!-- Custom Scrollbar--> <link rel="stylesheet" href="<?php echo $SITE_URL; ?>/admin/vendor/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.css"> <!-- theme stylesheet--> <link rel="stylesheet" href="<?php echo $SITE_URL; ?>/admin/css/style.default.css" id="theme-stylesheet"> <!-- Custom stylesheet - for your changes--> <link rel="stylesheet" href="<?php echo $SITE_URL; ?>/admin/css/custom.css"> <!-- Favicon--> <link rel="shortcut icon" href="img/favicon.ico"> <!-- Tweaks for older IEs--><!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script><![endif]--> </head> <body> <!-- Side Navbar --> <?php require_once(ABSPATH.'../admin/common/admin_sidebar.php'); ?> <div class="page"> <!-- navbar--> <?php require_once(ABSPATH.'../admin/common/admin_header_nav.php'); ?> <!-- Counts Section --> <section class="dashboard-counts section-padding"> <div class="container-fluid"> <div class="row"> <!-- Count item widget--> <div class="col-xl-12 col-md-12 col-lg-12 card"> <!-- Start Form --> <div class="col-lg-8 col-sm-12"> <form method="post" enctype="multipart/form-data"> <div class=""> <div class="card-header d-flex align-items-center"> <h4>Add By Manufacturer</h4> </div> <div class="card-body"> <form class="form-horizontal"> <div class="form-group row"> <label class="col-sm-2 form-control-label">Title</label> <div class="col-sm-10"> <input type="text" name="v_title" class="form-control"> </div> </div> <div class="line"></div> <div class="form-group row"> <label class="col-sm-2 form-control-label">Pic</label> <div class="col-sm-10"> <input type="file" name="v_image" class="form-control"><span class="text-small text-gray help-block-none">Image size should be same for good look</span> </div> </div> <div class="line"></div> <div class="form-group row"> <label class="col-sm-2 form-control-label">Status</label> <div class="col-sm-10"> <select name="c_status" class="form-control"> <option value="1" >Active</option> <option value="0" >Inactive</option> </select> </div> </div> <div class="line"></div> <div class="form-group row"> <label class="col-sm-2 form-control-label">Sort Order</label> <div class="col-sm-10"> <input type="number" name="i_sortOrder" class="form-control"> </div> </div> <div class="line"></div> <div class="form-group row"> <div class="col-sm-4 offset-sm-2"> <input type="hidden" name="submitForm" value="yes" class="form-control"> <button type="submit" class="btn btn-primary">Add</button> <button type="reset" class="btn btn-secondary">Cancel</button> </div> </div> </form> </div> </div> </form> </div> <!-- End Form --> </div> </div> </div> </section> <!-- Header Section--> <?php require_once(ABSPATH.'../admin/common/admin_footer.php'); ?> </div> <?php require_once(ABSPATH.'../admin/common/admin_footer_js.php'); ?> </body> </html>