caion90 Posted January 11, 2012 Report Share Posted January 11, 2012 <? if ($_GET['file'] == '') { echo 'Utilização: ViewFile.php?file=filename.ext'; } else { echo '<script type="text/javascript" src="http://caion90.hostei.com/sh/scripts/shCore.js"></script>'; echo '<script type="text/javascript" src="http://caion90.hostei.com/sh/scripts/shBrushPlain.js"></script>'; echo '<link type="text/css" rel="stylesheet" href="http://caion90.hostei.com/sh/styles/shThemeDefault.css"/>'; echo '<link type="text/css" rel="stylesheet" href="http://caion90.hostei.com/sh/styles/shCore.css"/>'; echo '<script type="text/javascript">'; echo 'SyntaxHighlighter.all();'; echo '</script>'; $FName = $_GET['file']; $FHandle = fopen($FName, 'r+'); $Buffer = @fread($FHandle, filesize($FName)); if (strpos($FName, '.php') === true) { echo '<script type="text/javascript" src="http://caion90.hostei.com/sh/scripts/shBrushPhp.js"></script>'; echo '<title> PHP Source at file '.$FName.'</title>'; echo '<pre class="brush: php;gutter:false;auto-links: true;;">'; echo $Buffer; echo '</pre>'; } if (strpos($FName, '.c') === true) { echo '<script type="text/javascript" src="http://caion90.hostei.com/sh/scripts/shBrushCpp.js"></script>'; echo '<title> C Source at file '.$FName.'</title>'; echo '<pre class="brush: cpp;gutter:false;auto-links: true;;">'; echo $Buffer; echo '</pre>'; } if (strpos($FName, '.pas') === true) { echo '<script type="text/javascript" src="http://caion90.hostei.com/sh/scripts/shBrushDelphi.js"></script>'; echo '<title> DELPHI Source at file '.$FName.'</title>'; echo '<pre class="brush: delphi;gutter:false;auto-links: true;;">'; echo $Buffer; echo '</pre>'; } if (strpos($FName, '.dpr') === true) { echo '<script type="text/javascript" src="http://caion90.hostei.com/sh/scripts/shBrushDelphi.js"></script>'; echo '<title> DELPHI Source at file '.$FName.'</title>'; echo '<pre class="brush: delphi;gutter:false;auto-links: true;;">'; echo $Buffer; echo '</pre>'; } } ?>como visto em http://pastebin.com/hNVdShxyo erro esta nas linhas 27,35,43 que são os STRPOS, não estão funcionando para detectar qual o tipo do arquivo que estou trabalhando... Quote Link to comment Share on other sites More sharing options...
0 Willian Gustavo Veiga Posted January 12, 2012 Report Share Posted January 12, 2012 E quais são os erros? Faça perguntas com o máximo de detalhes.Um abraço. Quote Link to comment Share on other sites More sharing options...
0 caion90 Posted January 12, 2012 Author Report Share Posted January 12, 2012 E quais são os erros? Faça perguntas com o máximo de detalhes.Um abraço.as funções STRPOS não validam quando eu envio um comando com '.c', '.php', ou '.pas' pro programa, e quando uso STRPOS(...)>0 ele sempre valida mesmo não tendo a string, n sei trabalhar com essa função Quote Link to comment Share on other sites More sharing options...
0 Willian Gustavo Veiga Posted January 12, 2012 Report Share Posted January 12, 2012 Veja estes exemplos. Leia sobre a função no manual.Perceba que strpos pode retornar o índice 0. Veja este exemplo, o echo nunca é executado.Um abraço. Quote Link to comment Share on other sites More sharing options...
Question
caion90
como visto em http://pastebin.com/hNVdShxy
o erro esta nas linhas 27,35,43 que são os STRPOS, não estão funcionando para detectar qual o tipo do arquivo que estou trabalhando...
Link to comment
Share on other sites
3 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.