<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>upload</title>
<meta http-equiv="expires" content="0">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<?php
session_start();
if(isset($_POST["Submit"])){
$DirPath = getcwd();
//To get the innermost dir 'apple'
$InnermostDir = basename(rtrim($DirPath, '/'));
$InnermostDir;
$newDir= $_POST["dirname"];
$newDir = str_replace(" ", "", $newDir);
if(isset($newDir) && ($newDir !== ""))
{
//if(is_dir($homedir.'/'.$newDir)){
// echo "Ihr Aktueller Pfad lautet".dirname($_SERVER['PHP_SELF']);
$checkdirec = mysql_query("SELECT dir_name,creatorID FROM directory WHERE dir_name='".mysql_real_escape_string($newDir)."' AND creatorID='".mysql_real_escape_string($userID)."'");
$daten_exist_direc = mysql_num_rows($checkdirec);
if ($daten_exist_direc>0) {
echo "<font color=\"#ff00\">This directory already exist</font>
<br />";
} else{
// mkdir($homedir."/".$newDir, 0755);
$inserdir = mysql_query("INSERT INTO directory SET dir_name='".$newDir."',creatorID='".$userID."',access_group='".$gID ."',creationDate='".date("Y-d-m")."', level='".$lvl."', Main_directory='".$mD."'")or die(mysql_error());
echo "Ihr Aktueller Pfad lautet". dirname($_SERVER['PHP_SELF']);
echo $mD;
echo "<br> <font color=\"#00ff00\">Ordner wurde erstellt</font>";
}
}
else{
echo "<font color=\"#ff00\">Please insert a directory name</font>";
}
}
?>
<form method="POST" action="<?php $PHP_SELF; ?>">
Neuer Ordner:<input type="text" name="dirname" />
<input type="submit" name="Submit" value="Erstellen" />
</form>
</body>
</html>