Показать сообщение отдельно

  #1  
Старый 15.12.2011, 00:17
jangle
Познающий
Регистрация: 19.11.2006
Сообщений: 32
С нами: 10249722

Репутация: 5
По умолчанию

есть запрос

Цитата:
Сообщение от None  
index.php?file=\..\..\..\..\..\..\..\..\etc\passwd
Выдает ответ

Цитата:
Сообщение от None  
Template Execution Halted! Error: /etc/passwd.html (Template file does not exist)
А вот сама фильтрация в файле index.php

PHP код:
[COLOR="#000000"][COLOR="#0000BB"]$file[/COLOR][COLOR="#007700"]=[/COLOR][COLOR="#0000BB"]str_replace[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#DD0000"]"http://"[/COLOR][COLOR="#007700"],[/COLOR][COLOR="#DD0000"]""[/COLOR][COLOR="#007700"],[/COLOR][COLOR="#0000BB"]$file[/COLOR][COLOR="#007700"]);

[/
COLOR][COLOR="#0000BB"]$file[/COLOR][COLOR="#007700"]=[/COLOR][COLOR="#0000BB"]str_replace[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#DD0000"]"ftp://"[/COLOR][COLOR="#007700"],[/COLOR][COLOR="#DD0000"]""[/COLOR][COLOR="#007700"],[/COLOR][COLOR="#0000BB"]$file[/COLOR][COLOR="#007700"]);

[/
COLOR][COLOR="#0000BB"]$file[/COLOR][COLOR="#007700"]=[/COLOR][COLOR="#0000BB"]str_replace[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#DD0000"]"://"[/COLOR][COLOR="#007700"],[/COLOR][COLOR="#DD0000"]""[/COLOR][COLOR="#007700"],[/COLOR][COLOR="#0000BB"]$file[/COLOR][COLOR="#007700"]);

[/
COLOR][COLOR="#0000BB"]$file[/COLOR][COLOR="#007700"]=[/COLOR][COLOR="#0000BB"]str_replace[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#0000BB"]chr[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#0000BB"]0[/COLOR][COLOR="#007700"]),[/COLOR][COLOR="#DD0000"]""[/COLOR][COLOR="#007700"],[/COLOR][COLOR="#0000BB"]$file[/COLOR][COLOR="#007700"]);

[/
COLOR][COLOR="#0000BB"]$file[/COLOR][COLOR="#007700"]=[/COLOR][COLOR="#0000BB"]str_replace[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#DD0000"]"../"[/COLOR][COLOR="#007700"],[/COLOR][COLOR="#DD0000"]""[/COLOR][COLOR="#007700"],[/COLOR][COLOR="#0000BB"]$file[/COLOR][COLOR="#007700"]);

[/
COLOR][COLOR="#0000BB"]$file[/COLOR][COLOR="#007700"]=[/COLOR][COLOR="#0000BB"]str_replace[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#DD0000"]"./"[/COLOR][COLOR="#007700"],[/COLOR][COLOR="#DD0000"]""[/COLOR][COLOR="#007700"],[/COLOR][COLOR="#0000BB"]$file[/COLOR][COLOR="#007700"]);

[/
COLOR][COLOR="#0000BB"]$file[/COLOR][COLOR="#007700"]=[/COLOR][COLOR="#0000BB"]str_replace[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#DD0000"]"%"[/COLOR][COLOR="#007700"],[/COLOR][COLOR="#DD0000"]""[/COLOR][COLOR="#007700"],[/COLOR][COLOR="#0000BB"]$file[/COLOR][COLOR="#007700"]);

if ([/COLOR][COLOR="#0000BB"]strpos[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#0000BB"]$file[/COLOR][COLOR="#007700"],[/COLOR][COLOR="#DD0000"]".html"[/COLOR][COLOR="#007700"]) ===[/COLOR][COLOR="#0000BB"]FALSE[/COLOR][COLOR="#007700"]) {

[/
COLOR][COLOR="#0000BB"]$file[/COLOR][COLOR="#007700"].=[/COLOR][COLOR="#DD0000"]".html"[/COLOR][COLOR="#007700"];

}

[/
COLOR][/COLOR
Кроме того при обработке file фильтруется

PHP код:
[COLOR="#000000"]$theValue = str_replace(";","",$theValue);

$theValue
= str_replace("[COLOR="#0000BB"][/COLOR]","",$theValue);

$theValue = htmlentities($theValue);

[/
COLOR
Это как то можно обойти и заинклудить файл?

Мои благодарности!!!
 
Ответить с цитированием