Jump to content

[SOLVED] prevent the user from copying a specific paragraph


Recommended Posts

Not sure what you are asking (either you don't want them to copy a paragraph displayed on the page or you have some verification code that you don't want copied).

 

But, the solution is the same, which is there is nothing you can do. Yes, there are "right-click" hacks that attempt to prevent a user from usign features such as "view-source", but they do not work in that they are easily circumvented.

 

If it is text displayed on the page you are trying to "protect" the best option, IMHO, is to make the text an image and use a watermark. It doesn't prevent anyone from using that image, but they won't be able to do so without people seeing your watermark and knowing it wasn't theirs. But, since it's text they could simply rekey that text into a text editor.

 

And, again, if we are talking about the code, there is really nothign you can do except obfuscate the code, which only makes it more difficult for someone to assemble into a readable format. Besides, have you not benefited from other's code? Why are you being stingy?

it's not like that, i'm beginner at programming and i made myself this verification code:

 

<?php $Confirm = mt_rand(); ?>
<tr>
<td valign="top" width="100" >Verification :</td>
<td valign="top"  ><input type="text" name="verification" size="10" value="" />
  <label for="verification">  <<  <?php echo $Confirm; ?></label>
</td>
</tr>

 

I only want to prevent them to not copy and paste the code directly but to type, and that's the best i could do :)

 

i know spams are smarter than my code but i wanted to do something though..

;)

like Maj said you could use Jquery no right click hacks but those only work on the page you still could go to  edit=>view source and rip the code easily but as he stated even with the no right click just makes it harder to rip the source code unless your smart enough to go edi=>view source :P

No Right Click

<script language="JavaScript"> <!--
// No rightclick script v.2.5
// (c) 1998 barts1000
// barts1000@aol.com
// Don't delete this header!

var message="Sorry, that function is disabled.\n\nContents & Graphics Copyright ©your name\nOur work is not Public Domain, and should NOT be taken from this site."; // Message for the alert box

// Don't edit below!

function click(e) {
if (document.all) {
if (event.button == 2) {
alert(message);
return false;
}
}
if (document.layers) {
if (e.which == 3) {
alert(message);
return false;
}
}
}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown=click;
// --> </script>

 

 

also you could use the following site to encrypt your html code but that like Maj said only goes so far ;)

 

Encrypt HTML Using JS:

http://www.designerwiz.com/mf.htm?http&&&www.designerwiz.com/generator/encryptHTML.htm

@darkfreaks:

 

I think the OP is echoing a random number to the screen and then expecting the user to enter that random number into the field as a verification that the user is a human and not a spambot. So, he is not trying to prevent the user from seeing source code, just want to enforce the user to type the random number in rather than copy and paste. By the way, who is "Maj"  ???  ;D

 

@yami007 :

 

You could probably do something where an onkeydown has to be registered on the field, but I don't beleive spambots would even have JS enabled. I'd suggest making the field disabled by default and then enabling it onclick(). Of course anyone without JS enabled will be out of luck.

well thanks for the help mjdamato and darkfreaks however i ddnt want the no right click function it is bad anyway :D

and u know what?

i resolved it with flash :)

 

i used flashvars to display the random key in flash and so i prevented the user from copying and pasting ;)

 

or what do u think about my thought? is it secured ?

 

thanks again..^^

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.