Jump to content
xisto Community
alex1985

Protect Pages HOW?

Recommended Posts

I create certain pages for my web-site, and I would like to protect them that no one can hack or see their source codes. So, if everybody knows how to do it, please post a reply over here. List of the best ways, I can do it.Thanks.

Share this post


Link to post
Share on other sites

Any one who has access to the web server will have access to your files you store there. Once downloaded or viewed without being parsed by PHP the source code is viewable so there is no way to encrypt your source doe from that.

Share this post


Link to post
Share on other sites

Any server-side scripting (such as PHP) will never be seen by visitors to your site as long as PHP is running on the server. The HTML output, however, is obviously visible, and there is very little you can do to protect that. All the code must be able to be understood by the browser, and therefore there will be an easy way for a visitor to see the plain HTML source code.As long as your PHP is well written (clean any user input, sanitise database inputs, etc.) then you should have nothing to worry about.

Share this post


Link to post
Share on other sites

All right! But some web-sites has pages like "dsjdsb" or some another symbols at the end of web address. That's looks good. Because, I link my pages like in HTML. For instance, if you wanna go to the home page, you click on the link "Back", and when you actually pressed it, the user can see the file: "index.php". In other words, I wanna avoid this problem, and that's why I am asking for some protection of the pages. Just list the choices what can be done about it.

Share this post


Link to post
Share on other sites

Because, I link my pages like in HTML. For instance, if you wanna go to the home page, you click on the link "Back", and when you actually pressed it, the user can see the file: "index.php". In other words, I wanna avoid this problem, and that's why I am asking for some protection of the pages. Just list the choices what can be done about it.

Hmm? You mean you don't want them to see what kind of server-side script you're running? You might want to look into mod_rewrite for the Apache server. With this, you can make your URLs appear like if the browser is accessing an HTML file, when really it's accessing a PHP or ASP or JSP, etc, script. Either that or give your HTML pages the ability to process PHP scripts.

Share this post


Link to post
Share on other sites

Try searching for "mod _rewrite" for a tutorial:

search:mod_rewrite

search:mod_rewrite tutorial

 

Also try these links for some help:

http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html

http://forums.xisto.com/no_longer_exists/

Have you read these links/tutorials yet?

Share this post


Link to post
Share on other sites

you can do it with javascript. Just create code for no right clicks.but on the topic of php,use $_SERVER[HTTP_ADDRESS](i am not sure if its this) to verify the ip adress. If its yours, then allow editing..etc, if its not, only allow displaying.

Share this post


Link to post
Share on other sites

you can do it with javascript. Just create code for no right clicks.but on the topic of php,
use $_SERVER[HTTP_ADDRESS](i am not sure if its this) to verify the ip adress. If its yours, then allow editing..etc, if its not, only allow displaying.


Can you rewrite it in more details? I did not get it! Sorry, I am beginner.

Share this post


Link to post
Share on other sites

you can do it with javascript. Just create code for no right clicks.but on the topic of php,
use $_SERVER[HTTP_ADDRESS](i am not sure if its this) to verify the ip adress. If its yours, then allow editing..etc, if its not, only allow displaying.


Thats a terrible solution. Not only do you make people not want to go to your website, but you don't protect anything. If you are talking about protecting your html code, that is impossible. When you load a website in your browser the server is actually sending that html code to the browser and the browser can read it. Just because there is some annoying script that blocks right clicks doesn't mean your computer still doesn't see it. Even if there was a way to use javascript to block the view source option under the view menu, you could technically still see it, you're only blocking the computer "noobs" if you will from seeing it. The source is still sent and if you are somewhat decent in programming you can still get it. NOW the reason you don't see php code in the source is because it is NEVER sent to the browser. It is compiled at the server and the OUTPUT is sent to the browser.

Now alex, I never have any idea what you want in your posts because they are never clear, and they are usually stupid and pointless questions, but I will try to explain this to you the best that I can. When you say some pages have "dsjdsb" at the end I assume you're talking about the get variable that is passed to them? It could also be an anchor but that doesn't change anything anyway. PHP has a very easy way of getting these variables with the $_GET array. It automatically fills this array for you, where the index is the variable name passed in the url and the value is, well, the value. Now there is no point in hiding the index.php that shows up, because it doesn't even look bad. I don't go to a website and say "OH THE WEBSITE URL HAS INDEX.PHP IN IT!!! OH MY GOD I BETTER GET OUT OF HERE". No I say "WOW THIS FREAKING WEBSITE HAS SOME KIND OF LAME JAVASCRIPT THAT PREVENTS ME FROM RIGHT CLICKING!!!! OH MY GOT I BETTER GET OUT OF HERE". So yes If you read the mod rewrite tutorials you may be able to do it. I'm not entirely sure but I think some browsers add the index.html or whatever when you navigate to a directory and don't put in the end slash. Example, point the browser to yoursite.com/images/ not yoursite.com/images

Share this post


Link to post
Share on other sites

you can do it with javascript. Just create code for no right clicks.but on the topic of php,
use $_SERVER[HTTP_ADDRESS](i am not sure if its this) to verify the ip adress. If its yours, then allow editing..etc, if its not, only allow displaying.


Who knows the exact code for it?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.