[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 524
  • Last Modified:

copyright notice in footer using php

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.
1 Solution
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.
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
global_expert_adviceAuthor Commented:
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";

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Ray PaseurCommented:
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

F IgorCommented:
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

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

Review this example from TechPad.co.uk for dom manipulation:
global_expert_adviceAuthor Commented:
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 shuts...rest coding in php can be done....
global_expert_adviceAuthor Commented:
@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=\"http://www.domain.com\" 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=\"http://www.domain.com\" 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
global_expert_adviceAuthor Commented:
ok url issue is solve.. in footer.tpl i removed backslash

Site Designed &amp; Developed By <a href="http://www.domain.com" 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..


global_expert_adviceAuthor Commented:
easy, short and good

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now