can u guys discover the errors of this php program
<?php
$profile_id=$consumer['username'];
$imgSrc="";
$result_path="";
$msg="";
if(!isset($_POST['x']) && !isset($_FILES['image']['name'])){
$temppath='profile_pics/'.$profile_id.'_temp.jpeg';
if(file_exists($temppath)){@unlink($temppath);}
}
if(isset($_FILES['image']['name'])){
$ImageName=$_FILES['image']['name'];
$ImageSize=$_FILES['image']['size'];
$ImageTempName=$_FILES['image']['tmp_name'];
$ImageType=@explode('/',$_FILES['image']['type']);
$kind=$ImageType[1];
$uploaddir="profilepics";
$file_temp_name=$profile_id.'_original'.md5(time()).'n'.$kind;
$fullpath=$uploaddir."/".$file_temp_name;
$file_name=$profile_id.'_temp.jpeg';
$fullpath_2=$uploaddir."/".$file_name;
$transfer=move_uploaded_file($ImageTempName,$fullpath);
chown($fullpath,sreekar);
chmod($fullpath,0777);
if(!$transfer){
die("file is just not uploaded");
}
else
{
$imgSrc="profile_pics/".$file_name;
$msg="add full";
$src=$file_name;
}
clearstatcache();
$original_size=getimagesize($fullpath);
$original_width=$original_size[0];
$original_height=$original_size[1];
$main_width=500;
$main_height=$original_height/($original_width/main_width);
if($_FILES["image"]["type"]=="picture/gif"){
$src2=imagecreatefromgif($fullpath);
}
elseif($_FILES["image"]["type"]=="picture/jpeg" ||
$_FILES["image"]["type"]=="picture/pjpeg"){
$src2=imagecreatefromjpeg($fullpath);
}
elseif($_FILES["image"]["type"]=="picture/png"){
$src2=imagecreatefrompng($fullpath);
}else{
$msg.="There was an error importing the file please add a .jpg, .gif or .png file <br/>";
}
$major=imagecreatetruecolor($main_width,$main_height);
imagecopyresampled($major,$src2,0,0,0,0,$main_width,$main_height,$original_width,$original_height);
$main_temp=$fullpath_2;
imagejpeg($major,$main_temp,90);
chmod($main_temp,0777);
imagedestroy($src2);
imagedestroy($major);
@ unlink($fullpath);
}
if(isset($_POST['x'])){
$kind=$_POST['type'];
$src='profile_pics/'.$_POST['src'];
$finalname=$profile_id.md5(time());
if($kind=='jpg'||$kind=='jpeg'||$kind=='JPG'||$kind=='JPEG'){
$targ_w=$targ_h=1500;
$jpeg_quality=90;
$img_r=imagecreatefromjpeg($src);
$dst_r=imagecreatetruecolor($targ_w,$targ_h);
imagecopyresampled($dst_r,$img_r,0,0,$_POST[‘x’],$_POST[‘y’],$targ_w,$targ_h,$_POST[‘w’],$_POST[‘h’]);
imagejpeg($dst_r,”profile_pics/”.$finalname.”n.jpeg”,90);
}else if($kind=='png'||$kind=='PNG'){
$targ_w=$targ_h=150;
$jpeg_quality=90;
$img_r=imagecreatefrompng($src);
$dst_r=imagecreatetruecolor($targ_w,$targ_h);
imagecopyresampled($dst_r,$img_r,0,0,$_POST['x'],$_POST['y'],$targ_w,$targ_h,$_POST['w'],$_POST['h']);
imagejpeg($dst_r,"profile_pics/".$finalname."n.jpeg",90);
}else if($kind=='gif'||$kind=='GIF'){
$targ_w=$targ_h=150;
$jpeg_quality=90;
$img_r=imagecreatefromgif($src);
$dst_r=imagecreatetruecolor($targ_w,$targ_h);
imagecopyresampled($dst_r,$img_r,0,0,$_POST['x'],$_POST['y'],$targ_w,$targ_h,$_POST['w'],$_POST['h']);
imagejpeg($dst_r,"profile_pics/".$finalname."n.jpeg",90);
}
imagedestroy($img_r);
imagedestroy($dst_r);
@ unlink($src);
$result_path="profile_pics/".$finalname."n.jpeg";
$insert_pic_query=mysqli_query($db,"UPDATE profile SET picture='$result_path' WHERE username='$userLoggedIn'");
header("Location:" .$userLoggedIn);
}
?>
<div id="Overlay" type="width:100%; top:100%; border:0px
#990000 stable; place:absolute; high:0px; left:0px; z-
index:2000; show=none;"></div>
<div class="main_column column">
<div id="formExample">
<p><?=$msg?></p>
<type motion="add.php" methodology="POST"
enctype="multipart/form-data">
Add one thing :<br/><br/>
<enter kind="file" id="picture" title="picture"
type="width:200px; top:30px;"><br/><br/>
<enter kind="submit" worth="Submit" title="submit"
type="width:85px; top:25px;">
</type><br/><br/>
</div>
<?php
if($imgSrc){
?>
<script>
$('#Overlay').present();
$('#formExample').cover();
</script>
<div id="CroppingContainer" type="width:800px; max-
top:600px; background-color:#fff; margin-left:-200px;
place:relative; overflow:hidden; border:2px #666 stable;z-
index:2001; padding-bottom:0px;">
<div id="CroppingArea" type="width:100px; max-
top:400px; place:relative; overflow:hidden;
margin:40px 0px 40px 40px; border:2px #666 stable;
float:left; ">
<img src="<?=$imgSrc?> " border="0" id="jcrop_target"
type="border:0px #990000 stable; place:relative;
margin:0px 0px 0px 0px; padding=0px;"/>
</div>
<div id="InfoArea" type="width:100px; top:150px;
place:relative; overflow:hidden; margin:40px 0px 0px
40px; border:0px #666 stable; float:left;">
<p type="margin:0px; padding:0px; coloration:#444; font-
measurement=18px;">
<p>Crop Profile Picture</p><br/><br/>
<spam type="font-size:14px;">
Crop / Resize your uploaded profile picture<br/>
As soon as you're blissful along with your profile picture then
please click on save.
</spam>
</p>
</div>
<br/>
<div id="CropImageForm" type="width:100px;
top:30px; float:left; margin:10px 0px 0px 40px;">
<type motion="add.php" methodology="put up"
onsubmit="return checkCoords();">
<enter kind="hidden" id="x" title="x"/>
<enter kind="hidden" id="y" title="y"/>
<enter kind="hidden" id="w" title="w"/>
<enter kind="hidden" id="h" title="h"/>
<enter kind="hidden" worth="jpeg" title="kind"/><?php
//$kind ?>
<enter kind="hidden" worth="<?=$src?>" title="src"/>
<enter kind="submit" worth="Save" type="width:100px;
top:30px;"/>
</type>
</div>
<div id="CropImageForm2" type="width:100px;
top:30px; float:left; margin:10px 0px 0px 40px;">
<type motion="add.php" methodology="put up"
onsubmit="return cancelCrop();">
<enter kind="submit" worth="Cancel Crop"
type="width:100px; top:30px; "/>
</type>
</div>
</div>
<?php
}
?>
</div>
<?php if($result_path){
?>
<img src="<?=$result_path?>" type="place:relative;
margin:10px auto; width:150px; top:150px;"/>
<?php } ?>