	<?php
	include("link/databaseconnection.php");


session_start();

 $id=$_POST['id'];
  $session=$_POST['session'];
 $ran=rand(100,50000);
 $ran1=rand(100000,5000000);
 $imgname=$_FILES['picture']['name'];
$signature=$_FILES['signature']['name'];
//echo"$imgname";
$size=$_FILES['picture']['size'];
$size_signature=$_FILES['signature']['size'];
//echo"$size";
$type=$_FILES['picture']['type'];
$type_signature=$_FILES['signature']['type'];
//echo"$type";
$tempname=$_FILES['picture']['tmp_name'];
$tempname_sign=$_FILES['signature']['tmp_name'];
//echo"$tempname";
$pathinfo=pathinfo($imgname,PATHINFO_EXTENSION);
  //echo"$pathinfo";
  if($pathinfo!=""|| $pathinfo!=null)
  {
	  $newimgname=time()."_".$ran.".".$pathinfo;
	  //echo$newimgname;
  }
  else
  {
	  $newimgname="";
  }
  
  $pathinfo=pathinfo($signature,PATHINFO_EXTENSION);
  //echo"$pathinfo";
  if($pathinfo!=""|| $pathinfo!=null)
  {
	  $newsignature=time()."_".$ran1.".".$pathinfo;
	  //echo$newimgname;
  }
  else
  {
	  $newsignature="";
  }

$location="code/img/";
$location1="code/img/";
if($imgname!="")
	{
		$ins="update registration2 set picture='$newimgname' where id='$id'";
					
				if(mysqli_query($conn,$ins))
				{
					move_uploaded_file($tempname,$location.$newimgname);
					
				
					//----
				//	header('../student_print.php?flag=$application');
																//--student_fees-----
														
					 header("Location:https://www.sgngovtcollegemau.org/change_photo.php?flag=$id&&flag2=$session");
					
				}
				else
				{
					echo"not Update";
				}
	}
	if($newsignature!="")
	{
		$ins1="update registration2 set signature='$newsignature' where id='$id'";
					
				if(mysqli_query($conn,$ins1))
				{
					
					move_uploaded_file($tempname_sign,$location1.$newsignature);
					
				
					//----
			header("Location:https://www.sgngovtcollegemau.org/change_photo.php?flag=$id&&flag2=$session");
					
				}
				else
				{
					echo"not Update";
				}
	}
?>