#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    0
    Rep Power
    0
    Hi! Is there any possible way to view an "on-line" php file? That is of course how you can view the code in a php file?
  2. #2
  3. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Location
    Sydney, Australia
    Posts
    5
    Rep Power
    0
    Someone asked 10/15 posts back:
    http://www.devshed.com/Talk/Forums/F...ML/003379.html
    In short the answer is no.

    G

  4. #3
  5. No Profile Picture
    Robert_J_Sherman
    Guest
    Devshed Newbie (0 - 499 posts)
    Well, it kinda depends..

    If you mean, can someone straying onto your website, choose the browsers "view source" option, and see your PHP source code? Then the answer is "No".

    However, "if" you want your visitors to be able to see your source code, then you have to do a little extra work.

    If you've been to PHP.NET, you'll notice that they have a "source" option on their site, which allows you to simply click the button, and see their source code.

    This can be accomplished, at your discretion, by simply placing your "PHP" source in a file that is "not parsed" by the server, like a .htm or .html file, or whatever file extension, that the server does not pass through the PHP interpreter.

    Then your PHP source code will be treated like standard document text, and displayed for the world to see.

    So, as you can see the answer is simply Yes, and No.

    A document being passed through the PHP interpretor is not viewable, while that which
    is not passed to the interpretor can be viewed.

    You decide.



    ------------------
    SnR Graphics,
    Low Cost Hosting and Web Development.
  6. #4
  7. Wiking
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Sep 2000
    Location
    Sweden
    Posts
    3,608
    Rep Power
    26
    What about file-leeching then? I suppose that I'll get the parsed document anyway, right?

    / NoXcuz
  8. #5
  9. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Location
    Brussels, Belgium
    Posts
    14,642
    Rep Power
    4492
    Just FYI Robert_J_Sherman,

    If you want to show the source code of a php file, the best way to do it is use the php function show_source(filename). This outputs the pretty color/highlighted file you see on php.net...

    And, for thejonas,

    Basically no one can see your php code unless:
    1. Your server is set up incorrectly and it passes the PHP as plain text. Solution: Set up server correctly, which is basically set it up according to the instructions, nothing special.
    2. You provide them a link to view your source.
    3. Someone hacks onto your server and gets permissions to read your files.

    Those are the only ways I can think of...If there were a way to view the PHP code, then PHP would be worthless. There would be no security. That's why it's no big deal to list your passwords in a php file, because it's never sent to the browser. Your php never leaves the server.

    HTH

    ---John Holmes...

Similar Threads

  1. Replies: 2
    Last Post: August 18th, 2004, 10:45 PM
  2. Replies: 4
    Last Post: January 28th, 2004, 08:29 AM
  3. PHP with UnixODBC
    By coder4hire in forum PHP Development
    Replies: 2
    Last Post: January 20th, 2004, 01:14 PM
  4. Passing string from PHP to Javascript
    By ka8oad in forum JavaScript Development
    Replies: 4
    Last Post: January 17th, 2004, 03:12 PM
  5. UnixODBC + PHP + Apache + Empress
    By coder4hire in forum Database Management
    Replies: 0
    Last Post: January 15th, 2004, 01:41 PM

IMN logo majestic logo threadwatch logo seochat tools logo