<? include("header.php");

//session_start();
error_reporting(0);

$id=$_REQUEST['id'];

include "checksession.php";

include ("include/db-connect.php");

if(isset($_REQUEST['submit']))
 {
$id=$_REQUEST['id'];

//---------------------photo edit coding start------------------------------	
 $picture_png=$_FILES['picture_png']['name'];  
$supported_image = array(
    'gif',
    'jpg',
    'jpeg',
    'png'
);
$src_file_name = $picture_png;
$ext = strtolower(pathinfo($src_file_name, PATHINFO_EXTENSION)); // Using strtolower to overcome case sensitive
if (in_array($ext, $supported_image)) 
{

       $viewid="select * from ".$PICTURE." where `id`='$id'";
       $resultid=mysql_query($viewid);
	   $rowid= mysql_fetch_row($resultid);
	   
	        
			   
	       $id1=$rowid[0]; 
		 
		   $photo_1=$rowid[2]; 
	
	 
	   
	        $filename=$id1.$picture_png; 
 
			  
  $uploaddir='images/';
  $uploadfile=$uploaddir.$filename;
 

move_uploaded_file($_FILES['picture_png']['tmp_name'],$uploadfile);
	
 if($picture_png==NULL)
		  {
		  
   $imag_photo=$photo_1;
}
else
{

   $imag_photo=$uploadfile; 
 	
	}
	   
//---------------------photo edit coding end------------------------------		 
	
 $upd_qur="UPDATE ".$PICTURE." SET image='$imag_photo' WHERE id='$id'";

    $exce=mysql_query($upd_qur);
	?>
    <script>
	window.location='edit_logo.php?edit=success&&id=<?php echo $id;?>';
	</script>
    <?php
	
	} 
else
 {
  ?>
    <script>
	window.location='edit_logo.php?edit=no&&id=<?php echo $id;?>';
	</script>
 <? 
}


}
 
 ?>
 <link rel="stylesheet" type="text/css" href="acco/css/style.css" />
<?php 
 $sel="select * from ".$PICTURE." where id=$id";
 $run=mysql_query($sel);
 $array=mysql_fetch_array($run);
 $name=$array['image_name']; 
 ?>
  
<div id="content">
  <div class="breadcrumb">
       <!-- <a href="http://amarasudhan.com/admin/index.php?route=common/home&amp;token=b735cc089ec2d51abb9a8e1901f501fb">Home</a>-->
      </div>
              <div class="box">
    <div class="heading">
      <h1><img src="view/image/home.png" alt="" /> Dashboard > <? echo $array['menu'] ?>  Logo</h1>
    </div>
    <div class="content">
      <div class="overview" style="width:30%; margin-left:400px;">
        <div class="dashboard-heading"><? echo $array['menu'] ?> Logo</div>
        <div class="dashboard-content">
          <form action="" method="post" enctype="multipart/form-data" id="question" >
 
  
  <input  type="hidden"  name="id" value="<?php echo $id;?>">
      
		<div class="add_row" style="margin-top:20px">
        <div id="wrapper">
		<div class="wrap_box">
        
         <div style="float:left;width:100px;"><?php echo $name; ?>&nbsp;<font color="#FF0000">*</font>	</div> 
		 <div><input  type="file"  name="picture_png" size="55" > </div>
         <div style="margin-top:10px; margin-left:90px;"><img src="<?php echo $array['image']; ?>" height="100" width="250"></div>
                            
                   
                            
                       <div class="add_row" style="margin-left:110px;">
                      <p><span class="maintextbox"> <input type="submit" name="submit" id="button" value="Submit" ><br><br>
                      <a href="logo.php">Back</a> </span></p>
                      </div></div><!-- End option--></div><!-- End add_row-->
                      </div>      
                         
                      
   </form>
        </div>
      </div>
      
      
    </div>
  </div>
</div>
<!--[if IE]>
<script type="text/javascript" src="view/javascript/jquery/flot/excanvas.js"></script>
<![endif]--> 
<script type="text/javascript" src="view/javascript/jquery/flot/jquery.flot.js"></script> 
<script type="text/javascript"><!--
function getSalesChart(range) {
	$.ajax({
		type: 'get',
		url: 'index.php?route=common/home/chart&token=b735cc089ec2d51abb9a8e1901f501fb&range=' + range,
		dataType: 'json',
		async: false,
		success: function(json) {
			var option = {	
				shadowSize: 0,
				lines: { 
					show: true,
					fill: true,
					lineWidth: 1
				},
				grid: {
					backgroundColor: '#FFFFFF'
				},	
				xaxis: {
            		ticks: json.xaxis
				}
			}

			$.plot($('#report'), [json.order, json.customer], option);
		}
	});
}

getSalesChart($('#range').val());
//--></script> 
</div>
<?  include("footer.php"); ?>