Ignore:
Timestamp:
10/03/2009 02:40:27 PM (3 years ago)
Author:
Acinonyx
Message:

[awmn] Fix unvalidated input of photos id which allows deletion of files from unprivileged users

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/awmn/includes/pages/mynodes/mynodes.php

    r212 r213  
    562562                        foreach( (array) $_POST['id'] as $key => $value) { 
    563563                                $db->del("photos", '', "id = '".intval($value)."' AND node_id = ".intval(get('node'))); 
    564                                 $uploaddir = $vars['folders']['photos']; 
    565                                 $filename = 'photo-'.$value.".*"; 
    566                                 delfile(ROOT_PATH.$uploaddir.$filename); 
    567                                 $filename = 'photo-'.$value."-*.*"; 
    568                                 delfile(ROOT_PATH.$uploaddir.$filename); 
     564                                if ($db->affected_rows > 0 ) { 
     565                                        $uploaddir = $vars['folders']['photos']; 
     566                                        $filename = 'photo-'.$value.".*"; 
     567                                        delfile(ROOT_PATH.$uploaddir.$filename); 
     568                                        $filename = 'photo-'.$value."-*.*"; 
     569                                        delfile(ROOT_PATH.$uploaddir.$filename); 
     570                                } 
    569571                        } 
    570572                } 
Note: See TracChangeset for help on using the changeset viewer.