exit;
}
+session_start();
+
/* Upload file */
if (isset($_FILES['file']) && is_writable(VAR_FILES)
&& is_writable(VAR_LINKS)) {
- if (isset($_POST['upload_password'])) {
- if (!jirafeau_challenge_upload($cfg, get_ip_address($cfg), $_POST['upload_password'])) {
+ if (!jirafeau_user_session_logged()) {
+ if (isset($_POST['upload_password']) &&
+ !jirafeau_challenge_upload($cfg, get_ip_address($cfg), $_POST['upload_password'])) {
echo 'Error 3: Invalid password';
exit;
- }
- } else {
- if (!jirafeau_challenge_upload($cfg, get_ip_address($cfg), null)) {
+ } elseif (!jirafeau_challenge_upload($cfg, get_ip_address($cfg), null)) {
echo 'Error 2: No password nor allowed IP';
exit;
}
}
+
$key = '';
if (isset($_POST['key'])) {
$key = $_POST['key'];
} else {
$ip = "";
}
-
+
$res = jirafeau_upload(
$_FILES['file'],
isset($_POST['one_time_download']),
one_time='1'
fi
-if [ -n "$UPLOAD_PASSWD" ]; then
- upload_password="$JIRAFEAU_UPLOAD_PASSWORD"
+if [ -n "$JIRAFEAU_UPLOAD_PASSWD" ]; then
+ upload_password="$JIRAFEAU_UPLOAD_PASSWD"
fi
if [ -z "$curl" ]; then
}
/* Initialize an asynchronous upload. */
elseif (isset($_GET['init_async'])) {
- if (isset($_POST['upload_password'])) {
+ if (jirafeau_user_session_logged()) {}
+ elseif (isset($_POST['upload_password'])) {
if (!jirafeau_challenge_upload($cfg, get_ip_address($cfg), $_POST['upload_password'])) {
echo 'Error 20: Invalid password';
exit;
} else {
$ip = "";
}
-
+
echo jirafeau_async_init(
$_POST['filename'],
$type,