0)
{
// set directory
$target = ("../files/" . $_SESSION['id'] . "/");
$target = $target . basename( $_FILES['userfile']['name']);
$fileName = $_FILES['userfile']['name'];
$tmpName = $_FILES['userfile']['tmp_name'];
$fileSize = $_FILES['userfile']['size'];
$fileType = $_FILES['userfile']['type'];
$user = $_SESSION['id'];
if(!get_magic_quotes_gpc())
{
$fileName = addslashes($fileName);
}
include ('../connect.php');
// Make the file a verification key
/////////////////////////////////////
/////////////////////////////////////
$length=55;
$strength=4;
$vowels = 'aeuy';
$consonants = 'bdghjmnpqrstvz';
if ($strength & 1) {
$consonants .= 'BDGHJLMNPQRSTVWXZ';
}
if ($strength & 2) {
$vowels .= "AEUY";
}
if ($strength & 4) {
$consonants .= '23456789';
}
if ($strength & 8) {
$consonants .= '@#$%';
}
$password = '';
$alt = time() % 2;
for ($i = 0; $i < $length; $i++) {
if ($alt == 1) {
$password .= $consonants[(rand() % strlen($consonants))];
$alt = 0;
} else {
$password .= $vowels[(rand() % strlen($vowels))];
$alt = 1;
}
}
/////////////////////////////////////
/////////////////////////////////////
///////////////////////////////////// end of verification key generation
// insert file info into Database
$query = "INSERT INTO files (name, size, type, target, user, hash, downloads) ".
"VALUES ('$fileName', '$fileSize', '$fileType', '$target','$user', '$password', '0')";
// run or die.
mysql_query($query) or die('Error, query failed' . mysql_error());
// move file to upload area.
if(move_uploaded_file($_FILES['userfile']['tmp_name'], $target))
{
//Tells you if its all ok.
echo "
The file ". basename( $_FILES['userfile']['name']). " has been uploaded.
";
}
else {
//Gives and error if its not.
echo "Sorry, there was a problem uploading your file.";
}
}
else
{
}
}
else
{
// error message if not logged in.
print "your not logged in.";
}
?>
Due to the "Beta" testing the upload progress bar is disabled. Please be patient while files upload. The page wil prompt you when the file is finished uploading.