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


session_start();
 $r1=rand(1000,5000000);
//echo '<br/>';
 $r2=rand(9000,70000);
 echo $flag=$_POST['flag'];

$session=$_POST['session'];
$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()."_".$r1.".".$pathinfo;
	  //echo$newimgname;
  }
  else
  {
	  $newimgname="";
  }
  
  $pathinfo=pathinfo($signature,PATHINFO_EXTENSION);
  //echo"$pathinfo";
  if($pathinfo!=""|| $pathinfo!=null)
  {
	  $newsignature=time()."_".$r2.".".$pathinfo;
	  //echo$newimgname;
  }
  else
  {
	  $newsignature="";
  }
  echo $newimgname;
  echo $newsignature;
$location="code/img/";
$location1="code/img/";
$size=$size/1024;
	$up="update registration2 set picture='$newimgname',signature='$newsignature' where application='$flag' and session='$session'";
	if(mysqli_query($conn,$up))
	{
		move_uploaded_file($tempname,$location.$newimgname);
					move_uploaded_file($tempname_sign,$location1.$newsignature);
					echo"<script>alert('Change Succesfully ');window.location.href='login_success_student.php?flag=$flag&& flag2=$session';</script>";
    	
					
	}
	else
		{
		echo 'not change';
		}
	
?>