Adding javascript to Coppermine php pages Adding javascript to Coppermine php pages
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Adding javascript to Coppermine php pages

Started by iq938, May 11, 2005, 03:20:42 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

iq938

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:


<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: