<?
    highlight_file
(__FILE__); exit;
?>
<html>
<head>
<title>Untitled Document</title>
<meta name="robots" content="noindex">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<?php
    $errTxt 
"";
    
$user "username";
    
$pass "password";
    
$dirname "../uploads/custum";
    
$ftp_host "192.168.0.219";

    if (isset(
$Submit)) {
        if (!
file_exists("$dirname/$foldername")) {
            
// Connect
            
$ftp fsockopen($ftp_host21$errno$errstr30);

            if (!
$ftp) {
                echo 
"$errno: $errstr<br />\n";
            } else {
                
// Authenticate
                
fputs($ftp"user $user\r\n");
                
fgets($ftp1024);
                
                if (!
ereg("^331"fgets($ftp1024))) {
                    echo 
"User Failed<br />";
                } else {
                    
fputs($ftp"pass $pass\r\n");
                    if (!
ereg("^230"fgets($ftp1024))) {
                        echo 
"Password Failed<br />";
                    } else {
                        
// Change dir
                        
fputs($ftp"cwd $dirname\r\n");
                        if (!
ereg("^250"fgets($ftp1024))) {
                            echo 
"CWD failed<br />";
                        } else {
                            
// Make dir
                            
fputs($ftp"mkd $foldername\r\n");
                            if (!
ereg("^257"fgets($ftp1024))) {
                                echo 
"MKD Failed<br />";
                            }
                        }
                    }
                }
               
// Close
               
fputs($ftp"quit\r\n");
               
fclose($ftp);
            }

            if (!
file_exists("$dirname/$foldername")) {
                
$errTxt .= "An unidentified error was encountered while<br />" .
                           
"trying to create the folder <b>'uploads/custum/$foldername'</b>.";
            } else {
                
$errTxt .= "<font-color='green'>The folder <b>'uploads/custum/$foldername'</b>" .
                           
"was sucessfully created.</font>";
            }
    } else {
        
$errTxt .= "The folder <b>'$dirname/$foldername'</b> already esists.";
    }
}
?>
<form name="form1" method="post" action="<?php echo $PHP_SELF ?>">
  <table width="321" border="0" align="center" cellpadding="5" cellspacing="0" bgcolor="#CCCCCC">
    <tr bgcolor="#FFFFFF" class="mainheading">
      <td><p>Add a New Custum Folder <span class="content"><br>
      </span></p></td>
    </tr>
    <tr class="content">
      <td align="right"><div align="center">Enter the name of the  folder you wish to add:</div></td>
    </tr>
    <tr class="content">
      <td align="right"><div align="center">
        <input name="foldername" type="text" class="content" id="foldername" value="<?php echo $foldername ?>" size="50">
      </div></td>
    </tr>
    <tr class="content">
      <td><div align="center">
        <input name="Submit" type="submit" class="content" value="Add Folder">
      </div></td>
    </tr>
    <tr class="content">
      <td><div align="center"><span class="contentBoldRed"><?php echo $errTxt ?></span></div></td>
    </tr>
    <tr class="content">
      <td bgcolor="#FFFFFF"><div align="center"><a href="browse.php">Return to Folder Contents </a></div></td>
    </tr>
  </table>

</form>
</body>
</html>