1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Can you download a .php file from the internet?

Discussion in 'PHP' started by AfroRadioHead, Dec 2, 2009.

  1. #1
    For example, my site is showing its "Index Of" page, and I want to download my index.php to look at its code. I know I can just go through the ftp or whatever, I'm just wondering if theres a way I can view the code from the "Index Of" of my site.

    When I do download it it says the file is 0bytes in size
     
    AfroRadioHead, Dec 2, 2009 IP
  2. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Nope, php gets executed on the server before being sent to your browser, and you will get the output of the file, not the original code (I assume that PHP is installed and operational on your server)

    Can I ask why you would want to do this anyway? FTP is just as easy, plus allows you to save data back
     
    JAY6390, Dec 2, 2009 IP
  3. kingsoflegend

    kingsoflegend Well-Known Member

    Messages:
    202
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    108
    #3
    Add this to the .htaccess file and delete the existing handler for php files. Basically you're telling the web server to treat .php files as text files, letting visitors see their content.

    AddHandler text/plain .php
    Code (markup):
     
    kingsoflegend, Dec 2, 2009 IP
  4. AfroRadioHead

    AfroRadioHead Peon

    Messages:
    32
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I was just wondering, there was no particular reason it just came across my mind when viewing my "Index Of" page.
     
    AfroRadioHead, Dec 2, 2009 IP
  5. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #5
    well there are some php scripts too which u can use to fulfil this purpose
     
    Bohra, Dec 2, 2009 IP
  6. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Ah I see, well this is why server side languages are used, because unless you have ftp access (or access other than http) then your sourcecode is secure and cannot be copied
     
    JAY6390, Dec 3, 2009 IP
  7. Dondon2d

    Dondon2d Peon

    Messages:
    3,193
    Likes Received:
    146
    Best Answers:
    0
    Trophy Points:
    0
    #7
    If that was possible, everyone would have their own Facebook! :D
     
    Dondon2d, Dec 3, 2009 IP
  8. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #8
    I'd rather have my own bank login with all the passwords to their databases etc lol
     
    JAY6390, Dec 3, 2009 IP