Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: hosting tips (php knowledge)

  1. #1
    Join Date
    Oct 2005
    Posts
    255
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default hosting tips (php knowledge)

    this is for php-ers...

    I have just recently released version1 on my beta hosting that I made, which only allows html files..

    But I want to allow php files and here is the question..

    how would be some things i could take at risk..

    I do not allow <script> tags as a threat..

    hard question and I don't know how to ask it..

    Code:
    <?php
    
       $savecontent = str_replace("<script>", "...", $savecontent);
       $savecontent = str_replace("</script>", "...", $savecontent);
    
    ?>
    I currently use that above to take away script tags.
    I don't want to be hacked or anything, I am going to put phpinfo(); in there,
    but what else can I put in there or what should I do..

    any opinions or comments let me hear them please...
    Hey new design new look, goto xudas for personal webdsign help.. (:

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Allowing PHP files is stupid.

    unlink('../index.php');

    ...as the least of your concerns.

    Javascript (ie script tags), is no real threat, except in abuse to your server; PHP, though, allows direct access.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Oct 2005
    Posts
    255
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    ok i guess i won't allow php files... what does unlink do... delete the file?
    Hey new design new look, goto xudas for personal webdsign help.. (:

  4. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Yep.

    But that's just the simplest example I could think of.

    With about 8 lines of code, a very basic function for deleting every file on the server could be written... enjoy.
    Not to mention grabbing any database password files and changing any existing PHP code.

    In short, hand out your FTP password, or don't allow PHP scripts-- the former would be a less painful death for your server.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  5. #5
    Join Date
    Oct 2005
    Posts
    255
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Thankyou.. wow i can't believe they have functions like that in php.....
    Hey new design new look, goto xudas for personal webdsign help.. (:

  6. #6
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    That's the whole point of PHP-- it allows full control of the server.

    The function I mentioned I don't believe exists in PHP by default, but it's not hard to write. Just loop through everything and delete. Done!
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  7. #7
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    The function I mentioned I don't believe exists in PHP by default, but it's not hard to write. Just loop through everything and delete. Done!
    Code:
    shell_exec('rm -rf ~');
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  8. #8
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    Only for Linux servers.
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

  9. #9
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Fine:
    Code:
    shell_exec('deltree \');
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  10. #10
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    Quote Originally Posted by Command Prompt
    'deltree' is not recognized as an internal or external command,
    operable program or batch file.
    Errr, it's this:

    Code:
    exec('rmdir  /S /Q Full\Path\to\File');
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •