403Webshell
Server IP : 103.234.187.230  /  Your IP : 216.73.216.216
Web Server : Apache
System : Linux lserver42043-ind.megavelocity.net 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64
User : apache ( 48)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/rsdgroup/adminPanel/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/rsdgroup/adminPanel/addNutritionalInformation.php
<?php 
include_once("session.php");
include_once("settings.php");
include_once("functions.php");

if($_REQUEST["mode"]=="Edit")
{
$mode="Edit";
$mode2="EDIT";
$mode1="Update";
$id=$_REQUEST['id'];
$rs_tblsite=mysql_query("select * from `tblNutritionalInformation` where `id`='$id'");
$array_tblsite=mysql_fetch_assoc($rs_tblsite);
$Species_Id=$array_tblsite['Species_Id'];
$Category_Id=$array_tblsite['Category_Id'];
$Product_Id=$array_tblsite['Product_Id'];
$nutritional_information_approx_value=$array_tblsite['nutritional_information_approx_value'];

$nutritional_information_arr = json_decode($array_tblsite['nutritional_information'],true);

foreach($array_tblsite as $key=>$value)
{
   $$key=$value;
}
 }
else
{
$mode="Add";
$mode2="ADD";
$mode1="Add";
}
?>
<LINK href="mel.css" type=text/css 
rel=stylesheet><LINK href="sdmenu.css" 
type=text/css rel=stylesheet>

<script language="JavaScript" src="../js/jquery-1.4.4.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
    var ingredients_count_val = <?php echo count($nutritional_information_arr); ?>;
    var max_fields      = 15; //maximum input boxes allowed
    var wrapper         = $(".input_fields_wrap"); //Fields wrapper
    var add_button      = $(".field_button"); //Add button ID
    
	if(ingredients_count_val >0)
    {
      var x = ingredients_count_val; //initlal text box count
    }else {
      var x = 0;  
    }
	
    //var x = 1; //initlal text box count
    $(add_button).click(function(e){ //on add input button click
        e.preventDefault();
        if(x < max_fields){ //max input box allowed
            
            x = x+1; //text box increment
            $(wrapper).append('<div id="r'+x+'" style="margin-top:10px;"><input type="text" id="nutritional_information_key'+x+'" name="nutritional_information_key[]" class="textfield" value="" size="30"/>&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" id="nutritional_information_value'+x+'" name="nutritional_information_value[]" class="textfield" value="" size="30"/><a href="javascript:void(0);" style="color:#000000;" onclick="removeRow('+x+');"><img src="../images/remove.png" border="0" alt="Remove"></a></div>'); //add input box
        }
    });
    
   
    /*$(wrapper).on("click","a .remove_field", function(e){ //user click on remove text
	    
        e.preventDefault(); 
		
		$(this).parent('div').remove(); 
		alert("yes");
		x--;
    });*/
	
});  	

function removeRow(rnum) {  
jQuery('#r'+rnum).remove();
}

function validate()
{ 
  var Species_Id = document.getElementById("Species_Id").value;
  var Category_Id = document.getElementById("Category_Id").value;
  var prdId = document.getElementById("product_id").value;
  var nutri_approx_value = document.getElementById("nutritional_information_approx_value").value;
  var ingredients_count_val = <?php echo count($nutritional_information_arr); ?>;
  
  var max_fields = 15;
  if(ingredients_count_val)
  {
    var max_fields_val = max_fields - ingredients_count_val;
  } else {
    var max_fields_val     = max_fields;
  } 

   
  if(Species_Id == "")
  {
    alert("Please select brand name");
	document.getElementById("Species_Id").focus();
	return false;
  } 
  if(Category_Id == "")
  {
    alert("Please select category name");
	document.getElementById("Category_Id").focus();
	return false;
  }  
  if(prdId == "")
  {
    alert("Please select product name");
	document.getElementById("product_id").focus();
	return false;
  } 
  if(nutri_approx_value == "")
  {
    alert("Please select product name");
	document.getElementById("nutritional_information_approx_value").focus();
	return false;
  } 
  
  if(max_fields_val >0)
  {
    for(i=1;i<max_fields_val;i++)
	{
	   var nutritional_information_key = "nutritional_information_key"+i;
	   var nutritional_information_value = "nutritional_information_value"+i;
	   var nutri_info_key = document.getElementById(nutritional_information_key).value;
       var nutri_info_value = document.getElementById(nutritional_information_value).value;
	   
	   if(nutri_info_key == "")
	   {
	     alert("Please enter nutritional information key");
		 document.getElementById(nutritional_information_key).focus();
		 return false;
	   }
	   if(nutri_info_value == "")
	   {
	     alert("Please enter nutritional information value");
		 document.getElementById(nutritional_information_value).focus();
		 return false;
	   }
	}
  }
  
  return true; 
}
</script>
<script language="JavaScript" src="ajax.js"></script>

<script type="text/javascript">
function getCategory(val){

	$.ajax({ 
		type: "POST", 
		url: "ajax/categoryList.php",
		data: "Species_Id="+val, 
		success: function(res){	 
			$("#Category_Id").html(res);
		}
	});
}

function getProduct(){
	var Category_Id = $("#Category_Id").val();
	$.ajax({ 
		type: "POST", 
		url: "ajax/categoryList.php",
		data: "Category_Id="+Category_Id, 
		success: function(res){	 
			$("#product_id").html(res);
		}
	});
}
</script>

<table width="94%" border="0" cellspacing="0" cellpadding="0">
  <tr> 
    <td><form action="write_NutritionalInformation.php" method="post" enctype="multipart/form-data"  name="product_nutritional_information_form" id="product_nutritional_information_form" onsubmit="return validate();">
        <fieldset>
        <legend>Product Nutritional Information 
        <?=$mode2?>
        FORM</legend>
        <table width="97%" border="0" cellspacing="1" cellpadding="0">
		  
		  <tr> 
            <td height="22" class="general">Brand Name :</td>
            <td height="22" >
			<select name="Species_Id"  class="textfield" id="Species_Id" onchange="getCategory(this.value);"/>
			<option value="">-- Please Select Brand --</option>
			<?php 
			 $sql_query = mysql_query("select * from tblSpecies where isDeleted='no'");
			  while($rows = mysql_fetch_assoc($sql_query)) { 
			?> 
			<option value="<?php echo $rows['Species_Id'];?>" <?php if($Species_Id == $rows['Species_Id']) { echo "selected";}?>><?php echo $rows['Species_Name'];?></option>
			<?php } ?>
			</select> 
              
			</td>
          </tr>
		  
		   <tr> 
            <td width="31%" height="22" class="general"> Category Name :</td>
            <td width="69%" height="22" > <div id="cat1"> 
            <select name="Category_Id"  class="textfield" id="Category_Id" onchange="getProduct(this.value);"/>
			<option value="">-- Please Select Category --</option>
			<?php 
			 $sql_query = mysql_query("select tc.* from tblCategory AS tc JOIN tblSpecies AS ts ON (ts.Species_Id=tc.Species_Id) where ts.isDeleted='no' ");
			  while($rows = mysql_fetch_assoc($sql_query)) { 
			?> 
			<option value="<?php echo $rows['Category_Id'];?>" <?php if($Category_Id == $rows['Category_Id']) { echo "selected";}?>><?php echo $rows['Category_Name'];?></option>
			<?php } ?>
			</select> 
              </div></td>
          </tr>
		  
		  
		  
		  <tr> 
            <td width="31%" height="22" class="general"> Product Name :</td>
            <td width="69%" height="22" > <div id="cat1"> 
                <?php 
				$query = "select `Product_Id`,`Product_Name` from `tblProduct` ";
				$result= mysql_query($query);
				?>
				<select name="product_id" id="product_id">
				<option value="">-- Please Select Product --</option>
				<?php 
				while($rows = mysql_fetch_assoc($result))
				{
				?>
				 <option value="<?php echo $rows['Product_Id'];?>" <?php if($Product_Id == $rows['Product_Id']) { echo "Selected=Selected"; } ?>><?php echo $rows['Product_Name'];?></option>
				<?php } ?>
				</select>
              </div></td>
          </tr>
		  
          <tr> 
            <td height="22" class="general">Nutritional Information (Approx Value) :</td>
            <td height="22"><input name="nutritional_information_approx_value" type="text" class="textfield" id="nutritional_information_approx_value"  
			value="<?php echo $nutritional_information_approx_value;?>" size="35"/> <span>For Eg:100 ml (Approx)</span>
			</td>
          </tr>
		  
		  <tr> 
            <td height="22" colspan="2" class="heading" style="padding-top:10px; padding-bottom:10px;">Nutritional Information :</td>
          </tr>
		  
		  <tr> 
            <td height="22" class="general">Nutritional Information Key :</td>
             <td height="22" class="general">Nutritional Information Value :</td>
          </tr>
		  
		  <?php if($_REQUEST['mode']=="Edit" && $_REQUEST['id']!="") { ?>
		  <tr> 
            <td height="22" class="general" colspan="2">
			
			<div class="input_fields_wrap">
			<?php $k=1;
                if(count($nutritional_information_arr)>0){ 
				 //echo "<pre>";print_r($nutritional_information_arr); die;
                foreach($nutritional_information_arr as $key_fc=>$val_fc) {  
                $rec_nutritional_facts_indx = $val_fc;
                foreach($rec_nutritional_facts_indx as $key1_fc=>$val1_fc) {  
            ?>
			  <div id="r1" style="padding-top:10px;"> 
				<input name="nutritional_information_key[]" type="text" class="textfield" id="nutritional_information_key<?php echo $k; ?>"  
				value="<?php echo $key1_fc; ?>" size="30"/> &nbsp;&nbsp;
				
				<input name="nutritional_information_value[]" type="text" class="textfield" id="nutritional_information_value<?php echo $k; ?>"  
				value="<?php echo $val1_fc; ?>" size="30"/>
				
			  </div>
			<?php $k++; } } } ?> 
			<span style="dispaly:block;"> <a href="javascript:void(0);" style="color:#000000;" class="field_button">Add More Nutritional Information </a></span> 
		   </div>
			
			</td>
          </tr>
		  <?php } else { ?>
			  <tr> 
				<td height="22" class="general" colspan="2">
				
				<div class="input_fields_wrap">
				  <div id="r1"> 
					<input name="nutritional_information_key[]" type="text" class="textfield" id="nutritional_information_key1"  
					value="" size="30"/> &nbsp;&nbsp;
					
					<input name="nutritional_information_value[]" type="text" class="textfield" id="nutritional_information_value1"  
					value="" size="30"/>
					
					<span style="dispaly:block;"> <a href="javascript:void(0);" style="color:#000000;" class="field_button">Add More Nutritional Information </a></span>
				
				  </div>
			   </div>
				
				</td>
			  </tr>
		  <?php } ?>
		  
		  
		  
          <tr align="center"> 
            <td height="26" colspan="2"><label for="label"> 
              <input type="hidden" name="id" value="<?=$_REQUEST['id']?>" />
              <input type="submit" name="Submit" value="  Save  " class="button" />
              &nbsp;&nbsp;&nbsp;&nbsp; 
              <input type="reset" name="Submit" value="Reset" class="button" />
              <input name="mode" type="hidden" id="mode" value="<?=$_REQUEST['mode']?>" />
              </label></td>
          </tr>
        </table>
        </fieldset>
      </form></td>
  </tr>
</table>

Youez - 2016 - github.com/yon3zu
LinuXploit