Viewing PHP source -- security, preventing hacking
I'm working at getting into php and done some fun stuff already. I love how easy to use the language is and how many possibilities there are... any text based language that can create images, send emails and handle forms is pretty cool.
if you're curious, I'm working on my forum/filmmaking website, thebrb.com.
Anyway,
as I've been working on this, I've been trying to hack my own stuff for security risks, and I think I found a way that might work (to hack).
Since php can usually include secret info, like passwords or database connection info, it seems that the source code is crucial to not be accessible.
As I'm sure you know, the server interprets the php code and sends pure html back to the browser on viewing a page, so the source is secure. The same goes with right-click-save-as on a link to a php file.
But what about using php to hack into php source.
You could use php to grab the file, using maybe file() or filegetcontents(), then movefile() (that's not the right command, I can't remember right now) to save it to your own server, and there you go.
That would give you direct access to the source.
I haven't tried it yet, but plan to try to hack some of my own stuff tomorrow using that to see if it works.
Do you guys know:
1. if there are more security measures setup to prevent this.
2. of any other ways to hack/get the source code, and how to prevent this.
I mean... you can save a quicktime movie to your harddrive. .php is just a file as well... there must be some way to get around the protection and view the code...
Thanks.