• CSS Protection With PHP  Idea

    CSS Protection With PHP | Web Design Tutorial
    CSS which is short for Cascading Style Sheets is a collection of code used to enhance the look of the website, css set an object should be what, what color, how the shape, size how big, and so forth. CSS Usually used in html, php, asp, and others.
    Image Credit by Telegraph.co.uk
    Making CSS is quite easy-difficult. And one day I've missed my CSS, where someone easily copy and paste the css code with View Page Source feature in the browser, I look for how to protect css on google. Finally I found it: D. Okay we started to study it here.
    My example use css below:
    .class {key: value; }
    Its filename style.css
    We rename the file to ending in .php (example: style.css becomes style.php)
    Next we replace the above code into the following code
    <? Php
    Session_start ();
    Header ("Content-type: text / css");
    If ($ _ SESSION ['NameSession']! = "Key") {die ("CSS PROTECTED"); }
    $ _SESSION ['NameSession'] = "AnotherKey";
    Contents of css here
    CSS It is protected with the help of php session, where if the session is not found or does not match the css code will not be displayed, but the browser will only display the words "CSS PROTECTED", until here this code is okay, but not yet used.
    :: How to use
    If you want to use the following code. (Put in index.php / other), here we protect the contents of style.php which is the css code by using session in php.
    <? Php
    Session_start ();
    $ _SESSION ['NameSession'] = "Key";
    Fill index / header or other
    :) Please try.
    For demo please see here.
    To use his CSS is quite easy. But do not use the href link, but use @import as follows.
    <Style type = "text / css"> @ import url (http: //blablabla/style.css); </ style>
    Disguises style.php to style.css
    And a little more. Trick removes the .php extension and replaces it with .css so our code can be protected using .htaccess (mod_rewrite). How to?
    Here's how:
    RewriteEngine on
    RewriteRule style.css style.php
    How ? You can ? Try first. Please Comment when there is a problem, or have not understood.
    The following CSS files are in protek:
    There is no perfect system, even this trick does not fully protect our css files, for example with the help of firebug css code can still be seen, this is because the browser has downloaded the first css script and save it to our computer to be processed by the browser. But this trick is useless, although we can not completely make this safe, at least with this is enough to make it difficult for people to copy-paste the code casually, especially those who do not understand tools like firebug.

    http://unovegas.com |  href="http://idngoal.com%22%3Etaruhan/" target="_blank">http://idngoal.com

Reply to axaxaxaxaxsingsing’s Idea

Please wait..