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: Adding javascript to coppermine php pages  (Read 2972 times)

0 Members and 1 Guest are viewing this topic.

iq938

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Adding javascript to coppermine php pages
« on: May 11, 2005, 03:22:47 pm »

Hi i am a total newbie to php.
I have a photo gallery called coppermine, I wanted to add some security to the displayimage.php page. Wherever i add the code in the page it doesn't accept the javascript.
i am trying to add no right click script etc. Would it be best to do this as a separate .js file and call it in the php, but i am not sure how to write it.
Basically i want to stop people taking the images.
Code i want to add:

Code: [Select]
<meta http-equiv="pragma" content="no-cache">
<META HTTP-EQUIV="imagetoolbar" CONTENT="no">
<script language="JavaScript1.2">
if (window.Event)
  document.captureEvents(Event.MOUSEUP);

function nocontextmenu() {
  event.cancelBubble = true, event.returnValue = false;

  return false;
}

function norightclick(e) {
  if (window.Event) {
    if (e.which == 2 || e.which == 3) return false;
  }
  else if (event.button == 2 || event.button == 3) {
    event.cancelBubble = true, event.returnValue = false;
    return false;
  }
}

if (document.layers)
  document.captureEvents(Event.MOUSEDOWN);

document.oncontextmenu = nocontextmenu;
document.onmousedown = norightclick;
document.onmouseup = norightclick;
//--></script>


<script language="javascript">
function noLeftClick() {
if (event.button==1) {
alert('Alert')
}
}
document.onmousedown=noLeftClick
</script>


<script language="javascript">

window.setTimeout(clearboard,1000);


function clearboard()
{
  if(document.all)
{
  window.clipboardData.setData('Text','you_are_kool');
window.setTimeout(clearboard,'1000');
}
}
</script>

<script language="JavaScript1.2">

//No Text Select
//For script visit http://www.youdonkey.com

function disableselect(e){
return false
}

function reEnable(){
return true
}

//if IE4+
document.onselectstart=new Function ("return false")

//if NS6
if (window.sidebar){
document.onmousedown=disableselect
document.onclick=reEnable
}
</script>

I am trying to add this to the php page which displays the main image when thumbnails are clicked which is called displayimage.php:

Logged

OmegaGOD

  • Supporter
  • Coppermine frequent poster
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 346
  • I approve.
Re: Adding javascript to coppermine php pages
« Reply #1 on: May 12, 2005, 12:45:16 am »

There is a mod for "no-right-click" available. http://forum.coppermine-gallery.net/index.php?topic=2450
Logged
Please do not PM me with support questions. Please read the manual and then if posting questions please place them in the proper sub-boards.

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Adding javascript to coppermine php pages
« Reply #2 on: May 12, 2005, 09:07:50 am »

I wouldn't call adding a JavaScript gimmick "adding security" ;D
Logged
Pages: [1]   Go Up
 

Page created in 0.02 seconds with 19 queries.