- $ip = get_ip_address($cfg);
- if (!jirafeau_challenge_upload_ip($cfg, $ip)) {
- echo 'Error 13';
- exit;
- }
-
- if (jirafeau_has_upload_password($cfg) &&
- (!isset($_POST['upload_password']) ||
- !jirafeau_challenge_upload_password($cfg, $_POST['upload_password']))) {
- echo 'Error 14';
- exit;
+ if (isset($_POST['upload_password'])){
+ if (!jirafeau_challenge_upload($cfg, get_ip_address($cfg), $_POST['upload_password'])) {
+ echo 'Error 14: Invalid password';
+ exit;
+ }
+ } else {
+ if (!jirafeau_challenge_upload($cfg, get_ip_address($cfg), null)) {
+ echo 'Error 13: No password nor allowed IP';
+ exit;
+ }