Disable Source View!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Disable Source View!

    Many a times there is a situation where an organization wants no one to right click, copy and paste the page, print or view source etc. To achieve this one should deactivate the mouse right button and the keyboard right click button.
    But the same thing can be achieved with the help of the menu bar. We have to deactivate Alt key to restrict the user from accessing menu items.

    After doing this there is one more possibility from where the user can directly take the stuff from the page. Just use Ctrl + A to select the whole page and directly Ctrl + C, Ctrl + V to copy and paste respectively. This option must also be disabled.

    One more issue to take care is browser compatibility. It should work in Microsoft Internet Explorer and in Netscape Navigator.

    Here's the code:

    PHP Code:

    var isnn,isie
    if(navigator.appName=='Microsoft Internet Explorer'//check the browser
    {  isie=true }

    if(
    navigator.appName=='Netscape')
    {  
    isnn=true }

    function 
    right(e//to trap right click button 
    {
        if (
    isnn && (e.which == || e.which == ))
            return 
    false;
        else if (
    isie && (event.button == || event.button == 3)) 
        {
            
    alert("Sorry, you do not have permission to right click on this page.");
            return 
    false;
        }
            return 
    true;
    }

    function 
    key(k)   
    {
        if(
    isie) {
            if(
    event.keyCode==17 || event.keyCode==18 || event.keyCode==93) {
                
    alert("Sorry, you do not have permission to press this key."
                return 
    false;
             } 
        }

        if(
    isnn){
            
    alert("Sorry, you do not have permission to press this key."
            return 
    false; }   
    }

    if (
    document.layerswindow.captureEvents(Event.KEYPRESS);  
    if (
    document.layerswindow.captureEvents(Event.MOUSEDOWN);
    if (
    document.layerswindow.captureEvents(Event.MOUSEUP);
    document.onkeydown=key;  
    document.onmousedown=right;
    document.onmouseup=right;
    window.document.layers=right;
    Put this code in a file called security.js and reference it between the <HEAD> and </HEADtags of any html or asp page using: <Script language="JavaScript" src="security.js"></script
    Its JavaScript!
    Cheers!

    #2
    nice code bro. . .
    I'll try this. . :D

    Comment


      #3
      Originally posted by tkreturns View Post
      Many a times there is a situation where an organization wants no one to right click, copy and paste the page, print or view source etc. To achieve this one should deactivate the mouse right button and the keyboard right click button.
      But the same thing can be achieved with the help of the menu bar. We have to deactivate Alt key to restrict the user from accessing menu items.

      After doing this there is one more possibility from where the user can directly take the stuff from the page. Just use Ctrl + A to select the whole page and directly Ctrl + C, Ctrl + V to copy and paste respectively. This option must also be disabled.

      One more issue to take care is browser compatibility. It should work in Microsoft Internet Explorer and in Netscape Navigator.

      Here's the code:

      PHP Code:

      var isnn,isie
      if(navigator.appName=='Microsoft Internet Explorer'//check the browser
      {  isie=true }

      if(
      navigator.appName=='Netscape')
      {  
      isnn=true }

      function 
      right(e//to trap right click button 
      {
          if (
      isnn && (e.which == || e.which == ))
              return 
      false;
          else if (
      isie && (event.button == || event.button == 3)) 
          {
              
      alert("Sorry, you do not have permission to right click on this page.");
              return 
      false;
          }
              return 
      true;
      }

      function 
      key(k)   
      {
          if(
      isie) {
              if(
      event.keyCode==17 || event.keyCode==18 || event.keyCode==93) {
                  
      alert("Sorry, you do not have permission to press this key."
                  return 
      false;
               } 
          }

          if(
      isnn){
              
      alert("Sorry, you do not have permission to press this key."
              return 
      false; }   
      }

      if (
      document.layerswindow.captureEvents(Event.KEYPRESS);  
      if (
      document.layerswindow.captureEvents(Event.MOUSEDOWN);
      if (
      document.layerswindow.captureEvents(Event.MOUSEUP);
      document.onkeydown=key;  
      document.onmousedown=right;
      document.onmouseup=right;
      window.document.layers=right;
      Put this code in a file called security.js and reference it between the <HEAD> and </HEADtags of any html or asp page using: <Script language="JavaScript" src="security.js"></script
      Its JavaScript!
      Cheers!
      Nice Code But How With Mozilla Firefox Bro??
      With This Addons https://addons.mozilla.org/en-US/fir.../righttoclick/

      Stops javascript annoyances such as forbidden right click, forbidden text selection or cascading dialog boxes.

      Latest update: Check bottom link 'Older/other versions' !

      Comment


        #4
        this will work for firefox and ie.


        PHP Code:
        <script language=”JavaScript”>
        <!

        var message=";
        ///////////////////////////////////
        function clickIE()

        {if (document.all)
        {(message);return false;}}

        function clickNS(e) {
        if
        (document.layers||(document.getElementById&&!document.all))
        {
        if (e.which==2||e.which==3) {(message);return false;}}}
        if (document.layers)
        {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
        else
        {document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

        document.oncontextmenu=new Function(”return false”)
        // –>
        </script> 
        Want something coded email me at sales@webnwaphost.com for a prices.




        Comment


          #5
          <?php
          function dimensi_Footer()
          {
          ?>
          <script type="text/javascript">
          disableSelection(document.body)
          </script>
          <?php
          }

          function dimensi_Disable_Right_Click($dimensi_Message)
          {?>

          <meta http-equiv="imagetoolbar" content="no">

          <script type="text/javascript" language="JavaScript">
          function disableText(e){
          return false
          }
          function reEnable(){
          return true
          }
          //For browser IE4+
          document.onselectstart = new Function ("return false")

          //For browser NS6
          if (window.sidebar){
          document.onmousdown = disableText
          document.onclick = reEnable
          }
          </script>



          <script language="JavaScript1.2">
          var msgpopup="<?php echo $dimensi_Message; ?>";
          function dimensi(){
          if(alertVis == "1") alert(message);
          if(closeWin == "1") self.close();
          return false;
          }
          function IE() {
          if (event.button == "2" || event.button == "3"){dimensi();}
          }
          function NS(e) {
          if (document.layers || (document.getElementById && !document.all)){
          if (e.which == "2" || e.which == "3"){ dimensi();}
          }
          }
          document.onmousedown=IE;document.onmouseup=NS;docu ment.oncontextmenu=new Function("alert(msgpopup);return false")

          </script>
          <?php }


          function dimensi_Disable_Selection()
          {
          ?>
          <script type="text/javascript">
          function disableSelection(target){
          if (typeof target.onselectstart!="undefined") //For IE
          target.onselectstart=function(){return false}
          else if (typeof target.style.MozUserSelect!="undefined") //For Firefox
          target.style.MozUserSelect="none"
          else //All other route (For Opera)
          target.onmousedown=function(){return false}
          target.style.cursor = "default"
          }

          </script>
          ?>
          Try This Also..m Use At my site..Just Modify This Code

          Comment


            #6
            ctr + u.....

            Comment


              #7
              hmm

              Originally posted by khan89 View Post
              ctr + u.....
              PHP Code:
              <script language="JavaScript">
              function 
              disableCtrlAltrKeyCombination(e)
              {
                      var 
              ctrlu='u';
                      var 
              altrs='s';
                      var 
              key;
                      var 
              isCtrl;
                      var 
              isAltr;

              //For Ctrl
              //For Internet Explorer

                      
              if(window.event)
                      {
                              
              key window.event.keyCode;
                              if(
              window.event.ctrlKey)
                                      
              isCtrl true;
                              else
                                      
              isCtrl false;
                      }
              //For Firefox
                      
              else
                      {
                              
              key e.which;     //firefox
                              
              if(e.ctrlKey)
                                      
              isCtrl true;
                              else
                                      
              isCtrl false;
                      }


              //For Alter
              //For Internet Explorer
                      
              if(window.event)
                      {
                              
              key window.event.keyCode;     //IE
                              
              if(window.event.altrKey)
                                      
              isAltr true;
                              else
                                      
              isAltr false;
                      }
              //For Firefox
                      
              else
                      {
                              
              key e.which;     //firefox
                              
              if(e.altrKey)
                                      
              isAltr true;
                              else
                                      
              isAltrfalse;
                      }


              //Check For CTRL+U
                      
              if(isCtrl)
                      {
                      if(
              ctrlu.toLowerCase() == String.fromCharCode(key).toLowerCase())
                      {
                                      
              alert(‘Key combination CTRL U has been disabled.);
                      }
                              return 
              false;
                      }


              //Check For ALTR+S
                      
              if(isCtrl)
                      {
                              if(
              altrs.toLowerCase() == String.fromCharCode(key).toLowerCase())
                      {
                                      
              alert(‘Key combination ALTR S has been disabled.);
                      }
                              return 
              false;
                      }
                      return 
              true;
              }
              </
              script>


              <
              input type="text" name="mytext" onKeyPress="return disableCtrlAltrKeyCombination(event);" onKeyDown="return disableCtrlAltrKeyCombination(event);" /> 
              here you go mate .

              Comment


                #8
                hmmm...
                i'd like to test something...
                so whoever use any of the above code..
                post link here so i can check
                if you can really disable source view
                It's better to keep your mouth shut and give the impression that you're stupid, than to open it and remove all doubt.
                ⓣⓗⓔ ⓠⓤⓘⓔⓣⓔⓡ ⓨⓞⓤ ⓑⓔ©ⓞⓜⓔ, ⓣⓗⓔ ⓜⓞⓡⓔ ⓨⓞⓤ ⓐⓡⓔ ⓐⓑⓛⓔ ⓣⓞ ⓗⓔⓐⓡ !
                ιη тнєσяу, тнє ρяα¢тι¢є ιѕ α яєѕυℓт σƒ тнє тнєσяу, вυт ιη ρяα¢тι¢є ιѕ тнє σρρσѕιтє.
                キノgんイノ刀g 4 ア乇ムc乇 ノ丂 レノズ乇 キucズノ刀g 4 √ノ尺gノ刀ノイリ!

                Comment


                  #9
                  They cant lmao

                  Use other sites there alot of scripts here they can use to see your scripts Mahahahahaha
                  Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
                  Visit: WapMasterz Coming Back Soon!
                  _______
                  SCRIPTS FOR SALE BY SUBZERO
                  Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
                  FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
                  _______
                  Info & Tips
                  php.net
                  w3schools.com

                  Comment


                    #10
                    No matter how hard you try; there is always the browser cache there is no way to stop that. Also Telnet, C/C++/c#/VB via Windows Sockets or I-Net Libs. Online source code viewers. This list could go on and on for days is there really a point with protecting it. JavaScript in Opera can just be turned of with a tick box for that specific site i guess it is true for other browsers.
                    Last edited by wap2k; 15.02.11, 22:54.

                    Comment


                      #11
                      You're talking too complex, just come down a little. A simple javascript disable will make the script useless. I've done that on a couple of sites.
                      Perfection comes at a cost



                      I accept liberty!

                      Comment


                        #12
                        ..oh im sory to tell you guyz..but all code posted did nothing..you can alwayz view the source..many wap site using the php source viewer..

                        Comment


                          #13
                          And it's as easy as hell.
                          We can't hide source-code and I hate this fact.
                          mysterio.al - programming is a functional art

                          Comment


                            #14
                            Encrypt Source

                            Extract encrypt.zip to your web server and Just put
                            include 'encrypt.php';
                            in the beginning of your web page script.
                            The HTML content will be automatically encrypted via Base64 algorithm so nobody can view it
                            Attached Files

                            Comment


                              #15
                              Originally posted by fyzan View Post
                              Extract encrypt.zip to your web server and Just put
                              include 'encrypt.php';
                              in the beginning of your web page script.
                              The HTML content will be automatically encrypted via Base64 algorithm so nobody can view it
                              base64 can be decrypted with one line of code. :-/

                              Comment

                              Working...
                              X