<?php 
$reffer=$_SERVER['HTTP_REFERER']; 
$weburl=$_SERVER['SERVER_NAME'];
if($reffer)
{ 
  $yes = 0; 
  if(eregi($weburl,$reffer))
  { 
    $yes=1; 
  }
  if ($yes==1)
  {
    header("Location: upload/".$_GET['file']); 
  }
  else
  { 
    header("Location: index.php"); 
  }
}
else
{ 
  header("Location: index.php"); 
} 

?>