demer Posted June 2, 2007 Report Share Posted June 2, 2007 Возникла проблема, немогу разобраться, некогда писал модификацию на IPB 1.3: http://www.ibresource.ru/db/575/ Сейчас выяснилось, что есть уязвимость, незнаю как исправить, долгие поиски решений ни привели к результату, скрипт следующий: function filesize_url($url){ return ($data = @file_get_contents($url)) ? strlen($data) : false; } preg_match_all("/http:\/\/+[-a-zA-Z0-9._\/]+[.]+(gif|jpg|png)/", $HTTP_POST_VARS['Post'], $matches); for ($i=0; $i<count($matches[0]); $i++) { $summ = $summ + filesize_url($matches[0][$i]); } if ( $summ > 10 ) { $std->Error( array( 'LEVEL' => 1, 'MSG' => 'sig_too_big_img' ) ); } Если в переменной $url, или иначе говоря в массиве ссылок на картинки $matches[0][$i] у одного из значений есть пробелы, или в hex: %20, то скрипт игнорирует этот адрес и не суммирует с остальными значениями... Как поправить? Или может есть альтернатива? Link to comment Share on other sites More sharing options...
mmap Posted June 3, 2007 Report Share Posted June 3, 2007 Попробуй $cnt = preg_match_all("/http:\/\/[a-zA-Z0-9._\/\-\%]+\.(gif|jpg|png)/", $HTTP_POST_VARS['Post'], $matches);for ($i = 0; $i < $cnt; $i++) $summ += filesize($matches[0][$i]);if ($summ > 10) $std->Error( array( 'LEVEL' => 1, 'MSG' => 'sig_too_big_img' ) ); Link to comment Share on other sites More sharing options...
demer Posted June 3, 2007 Author Report Share Posted June 3, 2007 (edited) Увы, не работает, вообще перестал проверять, вне зависимости от того, есть ли в ссылке пробел или нет. Вообщем не работает. Edited June 3, 2007 by demer Link to comment Share on other sites More sharing options...
demer Posted June 3, 2007 Author Report Share Posted June 3, 2007 Спасибо kolya7k, проблема решена. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now