Jump to content
Fórum Script Brasil
  • 0

Erros bobos... =\


caion90

Question

<?     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/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

  • 0
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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...