hide php code?
Moderator: General Moderators
-
madspoihur
- Forum Newbie
- Posts: 6
- Joined: Wed Oct 07, 2009 10:24 am
hide php code?
I wrote a website in PHP and when you option+click a link on my page you can download the entire php script, which includes sensitive information like passwords etc. Is there a way to prevent this?
Re: hide php code?
You can easily google a disable right click function. But if you use it, expect massive limitations from your userbase. Personally I right click a lot on website links to open in a new tab when they're set to open in a new window. 
Alternatively, you can put sensitive code in a seperate file and call it when needed
Alternatively, you can put sensitive code in a seperate file and call it when needed
- andyhoneycutt
- Forum Contributor
- Posts: 468
- Joined: Wed Aug 27, 2008 10:02 am
- Location: Idaho Falls
Re: hide php code?
If your source is actually being downloaded, and not the interpreted code, when someone right-clicks, save as... Then disabling right-click is not a solution at all. I could simply wget your source, or generate links to your source and save those.
Sounds like you are having trouble with apache. Make sure it's setup to run your PHP. First, are your PHP scripts actually running when you visit them? Second, if they are running, are you sure that the right-click, save as... doesn't just download the generated html source?
Sounds like you are having trouble with apache. Make sure it's setup to run your PHP. First, are your PHP scripts actually running when you visit them? Second, if they are running, are you sure that the right-click, save as... doesn't just download the generated html source?
-
Phoenixheart
- Forum Contributor
- Posts: 123
- Joined: Tue Nov 16, 2004 7:46 am
- Contact:
Re: hide php code?
Indeed. PHP code is server-side, and it should be interpreted by the webserver before returning to the browser. If it is not, then your webserver has problems. Disabling right-click doesn't help in this case.