forum.coppermine-gallery.net
Support => cpg1.3.x Support => Older/other versions => cpg1.3 Themes/Skins/Templates => Topic started by: iq938 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:
<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: