Activity Stream
48,167 MEMBERS
62622 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Results 1 to 7 of 7
  1.     
    #1
    Member

    Default need help with php code

    need a bit help with php.

    i have a script that gets info from file and displays it on site, however when file contains php script, then site will run it, and thats bad bcos security

    php code to get file:
    <?php include("./files/".$_GET["ID"].".file"); ?>

    is there any way to disable php from running and displaying only file content, so it would ignore php tags in content. however it should allow html tags

    cheers
    itmees Reviewed by itmees on . need help with php code need a bit help with php. i have a script that gets info from file and displays it on site, however when file contains php script, then site will run it, and thats bad bcos security php code to get file: <?php include("./files/".$_GET.".file"); ?> is there any way to disable php from running and displaying only file content, so it would ignore php tags in content. however it should allow html tags cheers :) Rating: 5

  2.   Sponsored Links

  3.     
    #2
    Member
    Website's:
    imdber.org justpaste.me
    file_get_contents? cURL?

    The particular use of include() is to include php files so would be able to run them as part of your code.

  4.     
    #3
    Member
    darn i should have taken that php course

    edit: gonna contact script creator, he probably has ideas

  5.     
    #4
    Member
    Website's:
    imdber.org justpaste.me
    ^HTML can't be "parsed" in inputs.

  6.     
    #5
    Member
    This site is using a hacked database of W junction
    Last edited by Gavo; 4th Jan 2015 at 02:23 PM.

  7.     
    #6
    Banned
    Website's:
    vaporhostn.com
    Quote Originally Posted by Gavo View Post
    You want to display a php file without it being parsed?

    You can use htaccess to turn off php parsing in a directory
    http://www.electrictoolbox.com/disab...ache-htaccess/
    Hes looking to still include the page which means he will need php to still parse..'

    You will need to use a combination of file_read_contents and have it read only.. If you allow it to write people can write shell files.

  8.     
    #7
    Respected Developer
    if you wants to display html from a file and not execte php code from that file then you can use fopen, here is a small example.

    PHP Code: 
        $file =  "location/file.php";
        
    $f fopen($file"r");
            while ( 
    $line fgets($f1000) ) {
            print 
    $line;
            } 
    and if you wants to display php with colors highlighting code u can use highlight_file function which will display php code without executing it and remember it will not parse html code.
    Bots Development | Web Development | Wordpress Customization | PSD Conversion

    Life has many twists and turns in it, you have to take what you are given and use it for the best.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 3rd Apr 2012, 09:50 AM
  2. PHP Code Help
    By .nItIsH. in forum Technical Help Desk Support
    Replies: 2
    Last Post: 25th Jan 2012, 03:29 PM
  3. Replies: 1
    Last Post: 27th Aug 2011, 01:45 PM
  4. {LF} a code
    By DeathNote in forum Web Application/Script Support
    Replies: 2
    Last Post: 23rd Oct 2010, 04:18 AM
  5. [vBulletin BB Code] Moderated Message: (Like W-BB's Staff BB Code!)
    By Ghost Dog 13 in forum Webmaster Resources
    Replies: 13
    Last Post: 26th Sep 2009, 06:19 PM

Tags for this Thread

BE SOCIAL