PDA

View Full Version : Disable Right-Click in threads!


Replicators
12-22-2005, 02:20 AM
I would like to see a hack to disable right-clicking,but only in posts. I found a hack for phpbb that does it which i will give the code now...

<!-- Start add - No copy MOD -->

<script language="javascript"> <!--
var previous_key ;

function clickIE4(){
if (event.button==2){
alert('No Right Click Is Allowed');
return false;
}
}

function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert('No Right Click Is Allowed');
return false;
}
}
}

if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}
function handleKeyDown()
{
if (previous_key==17 )
{
switch (window.event.keyCode)
{
case 45 :
case 46:
case 67:
case 88:
alert('Copy Is Not Allowed');
event.keyCode=0;
previous_key=window.event.keyCode;
event.returnValue=false;
break;
}
} else if (previous_key==16)
{
switch (window.event.keyCode)
{
case 45 :
case 46:
alert('Copy Is Not Allowed'+window.event.keyCode);
event.keyCode=0;
previous_key=window.event.keyCode;
event.returnValue=false;
break;
}
}
previous_key=window.event.keyCode;
}
function handleKeyUp()
{
previous_key=0;
}

if ( 1 )
{
document.oncontextmenu=new Function("alert('No Right Click Is Allowed');return false")
document.onkeyup = handleKeyUp;
document.onkeydown = handleKeyDown;
}
//-->
</script>
<!-- End add - No copy MOD -->

Could someone put this into a hack for vb? Only for posts though,like in showthread.php.

Hellcat
12-22-2005, 03:31 AM
Hmm.... should work if go to AdminCP -> Style Manager -> Edit Templates.
Find and open the template "SHOWTHREAD" and paste the above code right at the beginning.

That should add this "mod" into every threadview.

Not tested, but should work.

newfun
12-22-2005, 03:34 AM
easy just them in header in common templates

TyleR
12-22-2005, 03:34 AM
it could actually be added to the header template, just by wrapping it in

<if condition="THIS_SCRIPT == 'showthread'">Place code here...</if>

Zia
12-22-2005, 02:10 PM
umm idea isn't bad at all...but how to disable right ckick on images including avtar,posted image ....

Suggestion pls...
Thanks

Lea Verou
12-24-2005, 01:07 AM
umm idea isn't bad at all...but how to disable right ckick on images including avtar,posted image ....

Suggestion pls...
Thanks

That's useless as they can always drag the image to a folder and have it or look at the source code for it's URL ;)
It only makes people mad at you :p

Andreas
12-24-2005, 01:11 AM
Right-click blockers never work and are just annoying.

Zia
12-24-2005, 03:17 PM
Thankx..

baronvonwalz
12-24-2005, 03:39 PM
The best way around it is:

CTRL + C

Replicators
12-25-2005, 02:37 AM
That's why i want a hack to be made to download a Attachment like a url instead. If that can be done it will be extremely hard for people to get the actual link to the file, but nobody is interested in making a hack like that i guess. Like a certain .url file in which customer's can simply edit and put their real links in there and upload as a attachment,when people download it,they don't download it but get redirected to the files instead. Of course my only concern would be people using Download Managers as their default downloading software,then they would be able to see the download links. I just want it to be as hard as possible is all for them.

Hellcat
12-25-2005, 09:39 PM
That's why i want a hack to be made to download a Attachment like a url instead. If that can be done it will be extremely hard for people to get the actual link to the file, but nobody is interested in making a hack like that i guess. Like a certain .url file in which customer's can simply edit and put their real links in there and upload as a attachment,when people download it,they don't download it but get redirected to the files instead. Of course my only concern would be people using Download Managers as their default downloading software,then they would be able to see the download links. I just want it to be as hard as possible is all for them.
Why do you want to hide the actual download URL?
You want to prevent remotelinking to your site? That could be done by some sort of anti-leech script :)

Replicators
12-26-2005, 03:51 AM
If your referring to editing the .htaccess to do that it wouldn't work if the files you want to prevent from being remotely linked off of are not on the same server the forums are on. If your referring to a vb hack then i am all ears!

But i think the use of attachment would be good,as they wouldn't be able to get the real link by saving the page and looking through the code to find the link. The download attachment as URL would work great i think.

Hellcat
12-26-2005, 05:12 PM
No, I'm not talking about the .htaccess, rather a real (PHP) script that acts like some kind of proxy for the download.

The download request is sent to the script (let it be "download.php" with an ID of the reqiested file, the script then checks if everything is in order and sends the contents of the requested file to the browser.

This way you have absolute control over your downloads (you also can do some traffic checking) and the real location of the files is never revealed, the actual files can even be outside of the public accessible folder of the webserver :D

Replicators
12-27-2005, 12:38 AM
but it would use up the webserver's bandwidth and the server your downloading from as well correct?

The reason i want it done with attachments instead of bb_codes is because of this (http://www.vbviet.org/forums/showthread.php?t=79)

Forumi Shqiptar
04-01-2006, 07:22 AM
how can i disable right click in certain forums any one has any ideas?