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 2086 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:20:42 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
Pages: [1]   Go Up
 

Page created in 0.017 seconds with 19 queries.