How to hide the source code on web pages in php?

hi gurusubramani, Use the following javascript code in your index.php page and it will used to disable the mouse right click option.

    <script language=JavaScript>
        var message="Function Disabled!";
        function clickButton()
        {
            if (document.layers||document.getElementById&&!document.all)
            {
                alert("Permission Restricted");
                return false;
            }
        }
        if (document.layers)
        {     
            document.onmousedown=clickMF;
        }
        else  
        {
            document.oncontextmenu=new Function("return false")
        }
    </script>
  function clickButton()
    {
        if (document.layers||document.getElementById&&!document.all)
        {
            alert("Permission Restricted");
                return false;
        }
    }
    if (document.layers)
    {     
        document.onmousedown=clickMF;

    }
    else  
        {
        document.oncontextmenu=new Function("return false")

        }

try this code......mr.subramani

Even if you disable right click they can still access it through f12 button

Thank you Rajalakshmi and Palani. Your code is very useful to us.

if you want to hide data you can hide it within flash, html/javascript is always available to view - the right click disabling just annoys me, to put it politely. Means i have to go to the menu instead of right clicking - such an effort.

Will prevent less technical people though

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.