copyright notice in footer using php

Posted on 2011-10-09
Last Modified: 2012-05-12
i m looking for a way to protect my software.
recently we have created a software using php and smarty.
all the pages are having files footer.tpl
what we want is one should not be able to remove our copyright notice.
we dont want to encrypt the .tpl files
all pages uses a settings.php page.
what i want is a function or some way, where if someone removes or alter our copy right notice for ex. Powered by abc solution, site should redirect to xyz.php page.
we are also using ioncube to protect, but if we encrypt footer.tpl clients wont be able to change layout of footer
also each .php page is having
left and right tpl and
customers can remove copyright notice by creating a new footer.tpl and doing some manipulation.
so looking for a function or way, where in it checks whether each page is having the text "Powered By abc solutions" if not found page will redirect.
and the funtion will be in settings.php page which is encrypted by ioncube.
And all pages uses settings.php

So need a function ... can someone help me
Hope i m able to explan.
Question by:global_expert_advice
    LVL 12

    Expert Comment

    Make the copyright string a variable. (You may want to encrypt or obfuscate it.)
    Pass that variable to your software on initialization.
    If it doesn't match, redirect to the xyz page.

    OR make the copyright an image and take the checksum of the image. Before execution, fiind the image on the page using the DOM and if the checksum of the identified object doesn't match redirect to the xyz page.
    LVL 7

    Expert Comment

    i would say have a function in settings page that adds the copyright to the page on page creation.
    meaning putting a copyright notice on footer.tpl when page is served.
    don't use smarty myself but possible during caching
    LVL 1

    Author Comment

    amick can u tell me how to get the value using php dom, i tried some examples by googling but not getting workout..

    in my tpl  i m planning to have
    <div id="copyright">Powered By XYZ Solutions</div>

    After this i want to get the value of id copyright in my .php file
    once i get i will match it if its same, if not will redirect.
    Also if customer removes this div id...
    value will be null and again redirect.

    but i want the right coding for dom... help me
    i m using something like this in my .php page

                $doc = new DOMDocument( );
          echo "$doc->getElementById('copyright')->tagName";

    also i tried...


    $doc = new DomDocument;

    // We need to validate our document before refering to the id
    $doc->validateOnParse = true;
    $doc->Load('book.xml'); // this line i dont understand as i want value from div id

    echo "The element whose id is books is: " . $doc->getElementById('books')->tagName . "\n";

    LVL 107

    Expert Comment

    by:Ray Paseur
    An md5() string can be helpful here.  Example:

    You can take the md5() value of an image file, too.

    <?php // RAY_temp_global_expert_advice.php
    echo "<pre>";
    $copyright = 'Copyright &copy 2011.  All rights reserved';
    $md5       = md5($copyright);
    echo $copyright;
    echo PHP_EOL;
    echo $md5;
    echo PHP_EOL;
    $copyright = 'Copyright &copy 2011.  Few rights reserved';
    $newmd5    = md5($copyright);
    echo $copyright;
    echo PHP_EOL;
    echo $newmd5;
    echo PHP_EOL;
    if (md5($copyright) != $md5) echo 'HORRORS!';

    Open in new window

    LVL 13

    Accepted Solution

    You can check the content of the interpreted .tpl file capturing the generated code
    using "Output Buffering"  before it is displayed :

    //// code before footer.tpl
    //start capture the HTML output for footer
    //check $footer for copyright notice:
    $pageok=(strpos($footer,"Powered By abc solutions")!==false);
    if ($pageok){
      echo $pageok;
      echo "<SCRIPT> document.location='anotherpage.php'; </SCRIPT>";
    //// code after footer.tpl

    Open in new window

    LVL 12

    Expert Comment

    global expert advice: You're on the right track, but you need to load the html into $dom.

    Review this example from for dom manipulation:
    LVL 1

    Author Comment

    thanks for all the wonderful suggestions and ideas, i will try my luck with few settings and see if it works out.
    The only problem  comes is in .tpl file which is open

    so even if i put any variable there like {$copyright} taken from php page... what if the customer removes this variable from tpl page  by doing this customer can remove the copyright notice tag and he can manually put any copyright notice,

    @ray has given good explanation of matching md5 but its in php...
    however i will try all suggestions first...

    just any idea like if i placed the {$copyright} smarty variable and if someone removes it or alters it site gets coding in php can be done....
    LVL 1

    Author Comment

    @fraigor your code and guidance is working...
    but when i try to put url link inside its not caching i m using like this..

    in footer.tpl
    i m putting
    Site Designed &amp; Developed By <a href=\"\" target=\"_blank\">ABC Company</a>

    and the for validation i using ur code like this

    $pageok=(strpos($footer,"Site Designed &amp; Developed By <a href=\"\" target=\"_blank\">ABC Company</a>")!==false);
    if ($pageok){
      echo $pageok;
      echo "<SCRIPT> document.location='anotherpage.php'; </SCRIPT>";

    Plain text i dont have any issue
    so any idea how to put url too
    LVL 1

    Author Comment

    ok url issue is solve.. in footer.tpl i removed backslash

    Site Designed &amp; Developed By <a href="" target="_blank">ABC Company</a>

    so things are solved...

    Also as i m using a unqie .php file for all the pages which reads this validation and all are encoded with ioncube...

    i also tested if someone alters or modify the powered by tag, or removes it completed from footer.tpl site shuts,

    and if anyone removes or delete the footer.tpl site gives error

    so any way like to see if footer.tpl file exists first if its deleted, will shut site.

    Any loop holes or any type of hack one can do in this to bypass the powered by note...
    let me know..


    LVL 1

    Author Closing Comment

    easy, short and good

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
    Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
    In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
    The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now