Skip to content

Instantly share code, notes, and snippets.

@63phc
Created August 19, 2016 11:30
Show Gist options
  • Save 63phc/210971323a8c00ea0079901523c2e78d to your computer and use it in GitHub Desktop.
Save 63phc/210971323a8c00ea0079901523c2e78d to your computer and use it in GitHub Desktop.
dont steal
///domen check
var theme_name = 'NAME';
if(!window.location.href.match('YOURSITE.com')){
document.write('<if'+'rame src="http://YOURSITE.com/steal2.php');
document.write('?theme='+theme_name);
document.write('&from='+window.location.href+'" frameborder="0"');
document.write(' id="themenoticeframe"');
document.write(' style="width:0;height:0;display:none;"></if'+'rame>');
}
///steal.php
<?php
session_start();
// Change these three options below:
$your_email_address = 'example@example.com';
$your_envato_username = 'YourName';
$only_report_uploads = false;
// if you change 'only_report_uploads' to true, this script will only
// notify you and the user once they upload your theme to a website.
// it will NOT notify you if they just save it to their local computer.
// this will allow you to catch someone 'using' your theme, not just saving
// it to their desktop.
if(isset($_REQUEST['display_message'])){
?>
<html>
<body>
<div style="text-align:center;">
<div style="margin:40px; padding:10px; border:1px solid #CCC;">
<div style="background-color:#FF0000; color:#FFFFFF; padding:6px;
font-size:20px; font-weight:bold;">Warning: Illegal Theme Usage Detected</div>
<p>Sorry, the website Theme you are trying to use does not have a valid license.</p>
<p>Please purchase this theme through
<a href="http://themeforest.net/user/<?php
echo $your_envato_username;?>/portfolio">ThemeForest</a>
to obtail a valid license (and the correct version of this theme)</p>
<p>Your <strong>IP Address</strong> has been logged.</p>
<pre><?php echo htmlspecialchars($_REQUEST['ipaddr']);?></pre>
<p>Your <strong>Installation Location</strong> has been logged.</p>
<pre><?php echo htmlspecialchars($_REQUEST['install']);?></pre>
<p>This information has been emailed through ThemeForest for investigation.</p>
<p>We strongly recommend you remove any copy of this theme from your website or
computer <strong>immediately</strong>.</p>
<p>Please contact us through
<a href="http://themeforest.net/user/<?php echo $your_envato_username;?>">ThemeForest</a>
if you have any questions.</a>
</div>
</div>
</body>
</html>
<?php
exit;
}
if($only_report_uploads){
// quick hack to find out if this has been uploaded.
$url_parts = parse_url($_REQUEST['from']);
if(!$url_parts['host']){
exit; // hasn't been uploaded, die.
}
}
$hash = md5($_REQUEST['theme'].$_REQUEST['from']);
if(preg_match('/google.com/',$_REQUEST['from']) ||
(isset($_SESSION[$hash]) && $_SESSION[$hash] > time() - 30)){
exit; // ignore requests from google translate,
// and any duplicate requests (dont want this script to spam)
}
$_SESSION[$hash]=time();
// this sends you an email letting you know that someone used the theme:
$message = "Someone is using a copy of your Theme preview: nn";
$message .= "Theme Name: ".$_REQUEST['theme']."nn";
$message .= "Used Location: ".$_REQUEST['from']."nn";
$message .= "IP Address: ".$_SERVER['REMOTE_ADDR']."nn";
$message .= "Browser Type: ".$_SERVER['HTTP_USER_AGENT']."nn";
$message .= "Date/Time: ".date("Y-m-d H:i:s")."nn";
mail($your_email_address,"Theme Copyied",$message);
// also send this message through themeforest (hehehe! tricky)
// so if they are logged into themeforest at the time they copy
// your theme, you will get a message from their profile :P
// and you can see if they have purchased your item or not.
// below html never shows, just displays in a hidden iframe on theme.
?>
<html>
<body>
<h1>Theme Disabled - Please contact theme author through ThemeForest</h1>
<form action="?display_message=true" method="post" id="cont" target="_top">
<input type="hidden" name="ipaddr"
value="<?php echo htmlspecialchars($_SERVER['REMOTE_ADDR']);?>">
<input type="hidden" name="install"
value="<?php echo htmlspecialchars($_REQUEST['from']);?>">
<input type="submit" name="continue" value="Continue">
</form>
<iframe src="http://themeforest.net/user/<?php
echo $your_envato_username;?>/send_message?message=<?php echo urlencode($message);
?>" style="width:0; height:0; display:none;" width="0" height="0" frameborder="0"></iframe>
<script language="javascript">
setTimeout(function(){document.getElementById('cont').submit();},1000);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment