Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Disabling "Right Click" On Pages  (Read 4550 times)

0 Members and 1 Guest are viewing this topic.

fmk

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 28
    • FMKz Test Bed
Disabling "Right Click" On Pages
« on: January 02, 2011, 11:44:31 pm »

Disabling "Right Click" Using Javascript in Theme's Template.html could be a good idea to prohibit users from viewing the page sources that actually includes the albums/myalbums path and image paths.

Although I am waiting for a good pluginhttp://forum.coppermine-gallery.net/index.php/topic,69397.0.html, but I tried using this in Theme's Template.html


Code: [Select]
<script language=JavaScript>
<!--

//Disable right mouse click Script

var message="Function Disabled!";

///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}

function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}

if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}

document.oncontextmenu=new Function("alert(message);return false")

// -->
</script>

my site http://igallery.khanz.net

Can Devs make a small plugin out of it?
Logged
FMK

Love doesn't stop by my door, I am always infatuated with new things.

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Disabling "Right Click" On Pages
« Reply #1 on: January 03, 2011, 12:07:52 pm »

Disabling the right click doesn't increase the security. You always can access the page source with the browser menu and/or a keyboard shortcut. Disabling JavaScript disables your script, too.

Can Devs make a small plugin out of it?
You can do that yourself. Just have a look at some already existing plugins that just add some JavaScript (e.g. the Keyboard Navigation plugin).
Logged

fmk

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 28
    • FMKz Test Bed
Re: Disabling "Right Click" On Pages
« Reply #2 on: January 04, 2011, 01:16:02 am »

You were right Andre, that script blocked my user login for some reason. Login was looping back to Index.php showing Welcome Guest on the top and user remained unlogged-in even after entering the username/password. That was happening on system that didn't have cookies for my site. But I was able to login after a few hours on my PC, so I am now quit sure what was the exact issue but I have removed the script. As far plugin creating is concerned, I don't know coding.
Logged
FMK

Love doesn't stop by my door, I am always infatuated with new things.

flappjaxxx

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: Disabling "Right Click" On Pages
« Reply #3 on: February 11, 2011, 01:51:01 am »

I use this script for mine with no issues:
in template.html between <body> &  {CUSTOM_HEADER}
Logged
Pages: [1]   Go Up
 

Page created in 0.039 seconds with 19 queries.