How to stop Ctrl V or right click?

Discussion in 'HTML & Website Design' started by swapshop, May 18, 2007.

Thread Status:
Not open for further replies.
  1. #1
    Could any tell us how to stop our users from being able to paste into out page using Tinymce?

    We get a lot of spam from some types of users that wreck a good site by going thru the internet looking for free auction and classifieds sites. They simply copy and paste the same crap to every site.

    We need to make the use type in their adverts and take away the ability to paste please?

    Any ideas?
     
    swapshop, May 18, 2007 IP
  2. sauravhsingh

    sauravhsingh Banned

    Messages:
    60
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    ya you can stop by javascript. if you need code of javascript pls pm me i will send you.
     
    sauravhsingh, May 18, 2007 IP
  3. 8everything

    8everything Peon

    Messages:
    16,350
    Likes Received:
    903
    Best Answers:
    0
    Trophy Points:
    0
    #3
    CTRL V is to paste right? You want to block the CTRL C. Best to block selecting the text with javascript AND the right click/copy
     
    8everything, May 18, 2007 IP
  4. deques

    deques Peon

    Messages:
    206
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #4
    it wouldnt completely stop everyone. javascript can be turned off and some javascript methods can be bypassed

    i dont have any solutions for it. just google how to block right click with javascript
     
    deques, May 18, 2007 IP
  5. swapshop

    swapshop Peon

    Messages:
    656
    Likes Received:
    34
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Yes know about right click which is currently implemented on the page

    The page is a form to post adverts

    Runing a cute down version of tinymce wysiwug html editor

    This gives us additional functionality like spell checkers and a wee bit of eye candy for the adverts.

    Issues is right click is disabled in the form/page but tinymce ingores it.

    Right click doesnt stop ctrl+v so I need to create some code like a javascript function to stop the key combination being used but so far I have a day on it and no real success.

    With Tinymce I use

    $string = strip_tags($tring,'<html><head><td><p><font><strong></strong><em></em></font></p></td></head></html>');

    to remove some tags etc but I need to start stopping the ctrl+v asap.

    Anyone have some code they coudl start us on?

    I guess the next thing is a different Wusiwug editor any good ones that others can recommend?
     
    swapshop, May 19, 2007 IP
  6. swapshop

    swapshop Peon

    Messages:
    656
    Likes Received:
    34
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Yes know about right click which is currently implemented on the page

    The page is a form to post adverts

    Runing a cute down version of tinymce wysiwug html editor

    This gives us additional functionality like spell checkers and a wee bit of eye candy for the adverts.

    Issues is right click is disabled in the form/page but tinymce ingores it.

    Right click doesnt stop ctrl+v so I need to create some code like a javascript function to stop the key combination being used but so far I have a day on it and no real success.

    With Tinymce I use

    $string = strip_tags($tring,'<html><head><td><p><font><strong></strong><em></em></font></p></td></head></html>');

    to remove some tags etc but I need to start stopping the ctrl+v asap.

    This is some code to force plain text but hw do we clear the clipboard?
    handleEvent : function(e) {
    var inst = tinyMCE.selectedInstance;
    var focusElm = inst.getFocusElement();


    switch (e.type) {


    case "keydown":

    if (e.ctrlKey) { var ctrl = 1; }
    if (e.keyCode == 86) { var v = 1; }

    if (ctrl && v) {
    if (tinyMCE.isIE) {
    alert(window.clipboardData.getData("Text"));
    //or do whatever you want with the data
    }
    return tinyMCE.cancelEvent(e);
    // need to cancel the event for FF and after you're done with whatever you want to do with the data to be pasted
    }
    return true;
    break;


    }


    Anyone have some code they coudl start us on?

    I guess the next thing is a different Wusiwug editor any good ones that others can recommend?
     
    swapshop, May 19, 2007 IP
  7. Bram Wenting

    Bram Wenting Active Member

    Messages:
    392
    Likes Received:
    52
    Best Answers:
    0
    Trophy Points:
    68
    #7
    if you don't want other people to 'steal' information of your website, simply don't place it online...
     
    Bram Wenting, May 19, 2007 IP
  8. NITRO23456

    NITRO23456 Well-Known Member

    Messages:
    516
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    110
    #8
    This is the full script for disabling right click:

    
    <SCRIPT LANGUAGE="JavaScript1.1">
    <!-- Begin
    function right(e) {
    if (navigator.appName == 'Netscape' && 
    (e.which == 3 || e.which == 2))
    return false;
    else if (navigator.appName == 'Microsoft Internet Explorer' && 
    (event.button == 2 || event.button == 3)) {
    alert("Sorry, you do not have permission to right click.");
    return false;
    }
    return true;
    }
    
    document.onmousedown=right;
    document.onmouseup=right;
    if (document.layers) window.captureEvents(Event.MOUSEDOWN);
    if (document.layers) window.captureEvents(Event.MOUSEUP);
    window.onmousedown=right;
    window.onmouseup=right;
    //  End -->
    </script>
    Code (markup):
    Simply place it between your head tags and thats it. Please leave me reps!

    Or to disable copy/paste:

    
    <script  language=javascript> 
    
    if(window.location.protocol.indexOf("file")!=-1){ 
    location="about&#058;blank"; 
    
    } 
    </script> 
    <script  language=javascript> 
    if(document.domain.toLowerCase().replace("www.","")!="yourdomain.com". toLowerCase().replace("www.","")){ 
    alert("Invalid  Domain"); 
    location="about&#058;blank"; 
    
    } 
    </script> 
    <script  language=javascript> 
    if(document.all){ 
    _fc='<'+'div  style="position:absolute;left:-1000px;top:-1000px;width:60px;height:35 px;z-index:1">'  +  '<'+'input  type="button"  name="_xqq"  value=""  onClick=_ccd()  style="visibility:hidden"><'+'/div>'; 
    document.write(_fc); 
    function  _ccd(){ 
    clipboardData.clearData() 
    } 
    ; 
    function  _cce(){ 
    _xqq.click(); 
    setTimeout("_cce()",300) 
    } 
    ; 
    setTimeout("_cce()",1000); 
    
    } 
    </script> 
    <script  language=javascript> 
    function  _ng(){ 
    if  (document.all)  for  (i  =  0; 
    i<  document.images.length; 
    i++){ 
    z  =  document.images(i); 
    z.galleryImg  =  'no' 
    } 
    
    } 
    _ng(); 
    </script> 
    <script  language=javascript> 
    function  _np1(){ 
    for(wi=0; 
    wi<document.all.length; 
    wi++){ 
    if(document.all[wi].style.visibility!="hidden"){ 
    document.all[wi].style.visibility="hidden"; 
    document.all[wi].id="gwp" 
    } 
    
    } 
    
    } 
    ; 
    function  _np2(){ 
    for  (wi=0; 
    wi<document.all.length; 
    wi++){ 
    if(document.all[wi].id=="gwp")document.all[wi].style.visibility="" 
    } 
    
    } 
    ; 
    window.onbeforeprint=_np1; 
    window.onafterprint=_np2; 
    </script> 
    <script  language=javascript> 
    function  _ni(){ 
    if(document.all){ 
    document.onselectstart=function  (){ 
    return  false 
    } 
    ; 
    document.ondragstart=function  (){ 
    return  false 
    } 
    ; 
    setTimeout("_ni",  3000); 
    
    } 
    
    } 
    ; 
    _ni(); 
    function  _nn(){ 
    if(document.layers||window.sidebar){ 
    var  t=  document.getSelection(); 
    if(t  !=""){ 
    if(!window.find){ 
    alert("Function  Disabled."); 
    location="about&#058;blank"; 
    
    } 
    else{ 
    if(t  !="  "){ 
    window.find("  ") 
    } 
    ; 
    
    } 
    
    } 
    ; 
    setTimeout("_nn()",20) 
    } 
    
    } 
    _nn(); 
    </script> 
    <script  language=javascript> 
    function  _nrcie(){ 
    return  false 
    } 
    function  _nrcns(e){ 
    if(e.which==2||e.which==3)return  false 
    } 
    if(document.layers){ 
    document.captureEvents(Event.MOUSEDOWN); 
    document.onmousedown=_nrcns 
    } 
    document.oncontextmenu=_nrcie; 
    </script> 
    <script  language=javascript> 
    function  _nsb(){ 
    window.status="Page  protected  by  yourdomain.com"; 
    setTimeout("_nsb()",10) 
    } 
    _nsb(); 
    </script>  ?> 
    Code (markup):
    Please leave me reps!
     
    NITRO23456, May 19, 2007 IP
  9. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #9
    To my knowledge, there is no way to stop a paste operation into any widget that accepts input. It's a part of the way things work.

    Disabling paste, if you could, would be very user-unfriendly. There are a number of people who compose in their editors, and then paste to the form. They would likely consider your site broken, and go elsewhere.

    To prevent spammer posts is not possible. Your best bet is probably to slow them down with some type of "captcha" widget. If you moderate closely, you'll may be able to block the spammer account before he gets too far.

    cheers,

    gary
     
    kk5st, May 19, 2007 IP
  10. nicheguy1

    nicheguy1 Peon

    Messages:
    31
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Encrypts html pages so you can't right click or see the source code! http://www.online-resource1.com/htmle/htmlencryptor2.html
     
    nicheguy1, May 19, 2007 IP
  11. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #11
    First, did you not read the problem statement? Go back and do so.

    Second, that program is a waste of effort and money. For example, I could right click without barrier, and I can read/copy/do anything I wish with the source; both the javascript, and the generated html. eg.
    
    <tbody>
              <tr>
                <td>
                <p align="left"><font face="Arial">Keep others from viewing
    your source code, prevent printing, offline viewing, caching, disable
    right clicking, text selection, and hide your links, you can even
    choose what you want it to say in the status bar. <strong>Make your
    site only accessible from a referer.</strong> </font></p>
    
                <p align="left"><font face="Arial">Protect your
    PayPal&nbsp; and Clickbank Codes Too! </font></p>
                <p align="left"><strong><font face="Arial" size="5">This is
    a&nbsp;Top HTML Encryptor! <br>
                </font></strong></p>
                </td>
              </tr>
            </tbody>
    Code (markup):
    gary
     
    kk5st, May 19, 2007 IP
  12. WebGeek182

    WebGeek182 Active Member

    Messages:
    510
    Likes Received:
    28
    Best Answers:
    0
    Trophy Points:
    95
    #12
    There's no point in trying to stop this with code. There's always a way around it.
     
    WebGeek182, May 20, 2007 IP
  13. swapshop

    swapshop Peon

    Messages:
    656
    Likes Received:
    34
    Best Answers:
    0
    Trophy Points:
    0
    #13
    Really just want to stop some users from ctrl v into tinymce.

    In our case since we are free classifieds it makes only valid users post.

    There are so many that just go thu the web posting crap.

    Take the point of user experience but we want to do this to stop spammers.

    I think some people here have misread the issue.

    I dont care if people take src or content its just to stop spammers
     
    swapshop, May 20, 2007 IP
  14. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #14
    Please see Post #9 above.

    And, yes, you're right. Most of the responders did completely misread your post.

    cheers,

    gary
     
    kk5st, May 21, 2007 IP
  15. pangea

    pangea Guest

    Messages:
    557
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #15
    I agree with Gary - there is no way (to my knowledge) to COMPLETELY block the whole pasting into a text box thingy.

    Copying from a page is easy (just put it into a flash file or something like that), but pasting is a little harder - impossible to be exact!

    I would maybe put a limit on the number of characters so long pasted articles get cut.
     
    pangea, May 21, 2007 IP
  16. swapshop

    swapshop Peon

    Messages:
    656
    Likes Received:
    34
    Best Answers:
    0
    Trophy Points:
    0
    #16
    I think with tinymce you cant stop the copy and paste but some one mentioned to put a limit on pasting

    What or how can I restrict the amount of characters per line?

    Let stay I have

    Sell: Nextel I55 Housing, Nextel I700 Housing, Nextel I700 Housing,nextel I60 Assembly Housing, Nextel I95 Housing, Nextel I730 Assembly Housing, Nextel I90 Housing.

    Can I force it to a limit on charcters to be like
    Sell: Nextel I55 Housing, Nextel I700 Housing,
    Nextel I700 Housing,nextel I60 Assembly Housing,
    I730 Assembly Housing, Nextel I90 Housing.

    This would at least tidy the look of the page when these guys post 100 or more characters?
     
    swapshop, May 21, 2007 IP
  17. german_dude

    german_dude Banned

    Messages:
    395
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    0
    #17
    i think u can insert a copyscape banner or use a html encryptor for it
     
    german_dude, May 21, 2007 IP
  18. swapshop

    swapshop Peon

    Messages:
    656
    Likes Received:
    34
    Best Answers:
    0
    Trophy Points:
    0
    #18
    Dont get the last post?
     
    swapshop, May 22, 2007 IP
  19. josh_coffman

    josh_coffman Peon

    Messages:
    175
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #19
    if someone disables right click you can usually get around it by:

    holding down left click first, then right clicking.
     
    josh_coffman, May 24, 2007 IP
  20. nicheguy1

    nicheguy1 Peon

    Messages:
    31
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #20
    My original post>


    No need to be so jumpy.

    The software seems to work just fine with Internet Explorer. I hadn't tried it with other browsers. But since most people use IE it has helped me protect my articles! I will try the script posted here and see if it works with other browsers though.
     
    nicheguy1, May 25, 2007 IP
Thread Status:
Not open for further replies.