<?php
function authenticate() 
        { 
        Header("WWW-Authenticate: Basic realm=\"SOUZAONLINE\""); 
        Header("HTTP/1.0 401 Unauthorized"); 
        echo ("<h1>ACCESS DENIED</h1>\n"); 
        exit; 
        } 
class sql_auth { 
function testuser($user,$password)  { 
          if (($user=="paige") && ($password=="pants"))  return true; 
          else return false; 
}} 
if(!isset($PHP_AUTH_USER)) authenticate(); 
else   {  $authent = new sql_auth; 
          if($authent->testuser(strtolower($PHP_AUTH_USER),$PHP_AUTH_PW)) 
             { 
// End first block Authenticate   (Second block in END of the this page! ) 

$file_dir = "Images/$_POST[dirname]";

foreach($_FILES as $file_name => $file_array)
{
 print "path: ".$file_array['tmp_name']."<br>\n";
 print "name: ".$file_array['name']."<br>\n";
 print "type: ".$file_array['type']."<br>\n";
 print "size: ".$file_array['size']."<br>\n";
 
 if(is_uploaded_file($file_array['tmp_name']))
 {
  move_uploaded_file($file_array['tmp_name'],"$file_dir/$file_array[name]") or die("Could not upload file");
  print "<script language=JavaScript>location.href='paigepics.php';</script>";
 }
}
?>
</body>
</html> 
<? 
// ************** Second block Authenticate  (UnComment it if you need)  *************** 
 } else authenticate();  } 
?> 