Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Disable Right-Click

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Disable Right-Click

Postby BandanaChaudhury » Mon Oct 15, 2012 10:21 am

I want to know the code for, disabling right click on my web pages so that no one see my source code.
Please, just help me out.
BandanaChaudhury
New php-forum User
New php-forum User
 
Posts: 22
Joined: Fri Jun 22, 2012 9:14 am

Re: Disable Right-Click

Postby seandisanti » Mon Oct 15, 2012 11:14 am

your php code won't ever be displayed to the user as long as it's in a file with a .php extension. Even disabling right click doesn't protect your html/javascript source though, as users can save the file and edit that way, or hit their selection button beside their right control key and get the same list. If you still want to block right click, use javascript to set an even to the right click event, maybe an error message that says "stop it". Or you can right click redirect to a page that adds the ip of those that visit it to a blocked list. kind of a one strike and you're out thing. it's all doable but not really necessary if you keep your sensitive code in the PHP and not in html or javascript.
seandisanti
php-forum Fan User
php-forum Fan User
 
Posts: 838
Joined: Mon Oct 01, 2012 12:32 pm


Return to PHP coding => General

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron