X-Git-Url: https://git.p6c8.net/jirafeau_project.git/blobdiff_plain/8dc8b4bc884065eecec6ef0e544bf47734e69372..ab330a749db8c75b9a38a77536358be60a3e5163:/lib/functions.php diff --git a/lib/functions.php b/lib/functions.php index b10207c..d4c1b20 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -173,10 +173,15 @@ function jirafeau_upload($file, $one_time_download, $key, $time, $cfg, $ip) { for ($i = 0; $i < 8; $i++) $delete_link_code .= dechex(rand(0,16)); + /* md5 password or empty */ + $password = ''; + if (!empty($key)) + $password = md5($key); + /* create link file */ $link_tmp_name = VAR_LINKS . $md5 . rand(0, 10000) . '.tmp'; $handle = fopen($link_tmp_name, 'w'); - fwrite($handle, $name . NL . $mime_type . NL . $size . NL . $key . NL . $time . NL . $md5 . NL . ($one_time_download ? 'O' : 'R') . NL . date('U') . NL . $ip . NL . $delete_link_code . NL); + fwrite($handle, $name . NL . $mime_type . NL . $size . NL . $password . NL . $time . NL . $md5 . NL . ($one_time_download ? 'O' : 'R') . NL . date('U') . NL . $ip . NL . $delete_link_code . NL); fclose($handle); $md5_link = md5_file($link_tmp_name); if(!rename($link_tmp_name, VAR_LINKS . $md5_link)) {