how to disable inspect element or ctrl+u

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
creat015
User
Posts: 79

how to disable inspect element or ctrl+u

Post by creat015 »

Hello Sir

i want to ask again about disable inspect element or ctrl+u

this my screenshoot sir :

goo dot gl slash 7E67rM (change dot to . and slash to /)

goo dot gl slash qrNhCU (change dot to . and slash to /)

sorry this forum can not insert external url

I think displaying code like this will make it easier for hackers to get into our system?
I want the phpmaker setting script to hide when in the inspect element or ctrl + u

or

is there any way of encrypting the created data, so that when user access our website when they right click inspect element or ctrl + u
not found out the name of the table, or phpmaker settings or other codes that can harm our website

please help

thank you before


kirondedshem
User
Posts: 642

Post by kirondedshem »

you can atleast diable right clicking on your site with below code in global startup script

$('body').contextmenu(function() {
return false;
});

BUT I dont think any web application can hide its content as long as its seen in a web browser unless you can somehow customise the web browser and tell it to diasble inspection on your site only, but still those right lie with the web browser itself and even if you manage to look a certain browser clients can just use any other one to do the inspection.


creat015
User
Posts: 79

Post by creat015 »

thank you sir for your reply

i try its work

but how to add prevent ctrl+u

i try to search in google told to add this code (onkeydown='return false')

i try like this sir :

$('body').contextmenu.onekydown(function() {
return false;
});

but error, right click active again sir

thank you


kirondedshem
User
Posts: 642

Post by kirondedshem »

Bottom line is even if you diable right clicking and Ctrl+U, there are still a bunch of ways I can access th content.

  1. I can press f12 and ill have access to the inspected site right away,
  2. I can save your site using browser save as option and access the saved files instead, I can print your site pages, I can download it for offline mode.
    2.if users install any other development frinedly tool like firebug(which eve adds itself as atoolbar), I can still see the inspaection, and there are many tools like this where some of them are very usefull to developers.
  3. If you diable right clicking, users wont be able to do things like (access menu to open link in new tab or new wndow incase they want to), they wont be able to do thingd liek copy link location etc etc.

The best you can do is to set some security levels on your server eg.
-dont allow direcory listsing(hence only your site can use any of the files it has).
-give permission to only specific folders hence even your site has only access to folder and files it need to read and write where neccessary.
-Inpection does not show php code so still users cant know what is happening in the background, which is whats most importnat.
-secure your db with not easy to crack apsswords, (coz db is where the actual data is) as well as limit access to only specific users and also limit what those users are allowed to do as well.

IMPORTANT HINT: you can try to mask your site links to not show .php, suh that users cant know right away that yur site is in php (same as how wordpress sites look), for this google how to enable url rewrite and add it to your htaccess file, hence user will be seeing "customerlist" instead of "customerlist.php", (although there are still some browser tools that can tell you the language beign used)

NOTE: rather than disbling inspection, google how to protect your php site from threats like penetration, sql injection and test against these and much more.


sangnandar
User
Posts: 980

Post by sangnandar »

Try this:
// Prevent mouse right-click.
document.oncontextmenu = function (e) {
e.preventDefault();
return false;
}
// Prevent keyboard key
$(document).keydown(function (e) {
if (e.keyCode == 123) { // Prevent F12
return false;
} else if (e.ctrlKey && e.shiftKey && e.keyCode == 73) { // Prevent Ctrl+Shift+I
return false;
} else if (e.ctrlKey && e.keyCode == 85) { // Prevent Ctrl+u
return false;
}
});

But as kirondedshem said, these things are not security measures. An experienced user can easily bypass this with an easy googling, while a noob user may get frustrated with a non-functioning mouse right-click.


Post Reply