forked from gitbot/uguu
testing
parent
8c2ebd4b8e
commit
cf1d2267e3
|
@ -1,6 +1,6 @@
|
|||
# What is Uguu?
|
||||
|
||||
Uguu is a simple lightweight temporary file uploading and sharing platform where files get deleted after X amount of time.
|
||||
Uguu is a simple lightweight file uploading and sharing platform, with the option for files to expire.
|
||||
|
||||
## Features
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
"max_upload_size": 128,
|
||||
"production": false,
|
||||
"siteName": "SITENAME",
|
||||
"siteUrl": "http://localhost",
|
||||
"siteUrl": "https://yoursite.com",
|
||||
"abuseContact": "abuse@example.com",
|
||||
"infoContact": "info@example.com",
|
||||
"ServerCountryLocation": "Sweden",
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
session_start();
|
||||
|
||||
//include the database which also includes the settings
|
||||
require_once('includes/database.inc.php');
|
||||
|
||||
function hash_pw($in){
|
||||
$options = [
|
||||
'cost' => 12,
|
||||
];
|
||||
return password_hash($in, PASSWORD_BCRYPT, $options);
|
||||
}
|
||||
|
||||
//Check if the login details are correct
|
||||
if($_POST['user'] == UGUU_ADMIN_USER && hash_pw($_POST['pass']) == UGUU_ADMIN_PASS){
|
||||
$_SESSION['valid'] = true;
|
||||
$_SESSION['timeout'] = time();
|
||||
}else{
|
||||
echo 'wrong bitch!';
|
||||
}
|
||||
|
||||
//function to delete file or delete it and blacklist
|
||||
function delete_file($in, $opt){
|
||||
//Check if admin is logged in
|
||||
if(isset($_SESSION['valid'])){
|
||||
//Check if blacklist or not
|
||||
if(isset($opt)){
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -25,16 +25,8 @@ define('UGUU_DB_USER', 'NULL');
|
|||
/* @param string UGUU_DB_PASS Database password */
|
||||
define('UGUU_DB_PASS', 'NULL');
|
||||
|
||||
/* @param string UGUU_ADMIN_NAME username */
|
||||
define('UGUU_ADMIN_USER', 'admin');
|
||||
/* @param string UGUU_ADMIN_PASS password as hash*/
|
||||
define('UGUU_ADMIN_PASS', '$2y$12$.NHW25QBD/XPSYkNe6tEtObwEXsJeiQIo3xWidU.21ECkFMK.SE8C%');
|
||||
|
||||
/** Log IP of uploads */
|
||||
define('UGUU_LOG_IP', 'false');
|
||||
|
||||
/** Anti-dupe files */
|
||||
define('UGUU_DUPE', 'false');
|
||||
define('LOG_IP', 'no');
|
||||
|
||||
/*
|
||||
* File system location where to store uploaded files
|
||||
|
|
|
@ -102,26 +102,6 @@ function uploadFile($file)
|
|||
throw new UploadException($file->error);
|
||||
}
|
||||
|
||||
// Check if a file with the same hash and size (a file which is the same)
|
||||
// does already exist in the database; if it does, return the proper link
|
||||
// and data. PHP deletes the temporary file just uploaded automatically.
|
||||
if(UGUU_DUPE == 'true'){
|
||||
$q = $db->prepare('SELECT filename, COUNT(*) AS count FROM files WHERE hash = (:hash) '.
|
||||
'AND size = (:size)');
|
||||
$q->bindValue(':hash', $file->getSha1(), PDO::PARAM_STR);
|
||||
$q->bindValue(':size', $file->size, PDO::PARAM_INT);
|
||||
$q->execute();
|
||||
$result = $q->fetch();
|
||||
if ($result['count'] > 0) {
|
||||
return [
|
||||
'hash' => $file->getSha1(),
|
||||
'name' => $file->name,
|
||||
'url' => POMF_URL.rawurlencode($result['filename']),
|
||||
'size' => $file->size,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
// Generate a name for the file
|
||||
$newname = generateName($file);
|
||||
|
||||
|
@ -150,7 +130,7 @@ function uploadFile($file)
|
|||
}
|
||||
|
||||
// Add it to the database
|
||||
if(UGUU_LOG_IP == 'true'){
|
||||
if(LOG_IP == 'yes'){
|
||||
$q = $db->prepare('INSERT INTO files (hash, originalname, filename, size, date, ip) VALUES (:hash, :orig, :name, :size, :date, :ip)');
|
||||
}else{
|
||||
$ip = '0';
|
||||
|
|
Binary file not shown.
|
@ -2,6 +2,6 @@
|
|||
<ul>
|
||||
<li><a href="/">{{siteName}}</a></li>
|
||||
<li><a href="tools.html">Tools</a></li>
|
||||
<li><a href="https://github.com/nokonoko/uguu">Github</a></li>
|
||||
<li><a href="https://github.com/nokonoko/uguu">GitHub</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
|
|
@ -37,4 +37,3 @@ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
|||
}
|
||||
|
||||
}
|
||||
Use
|
||||
|
|
Loading…
Reference in New Issue