Absolute
Крокодил ;)
- Регистрация
- 9 Авг 2009
- Сообщения
- 581
- Реакции
- 456
Тысячу бы раз нажал кнопку "Спасибо"!PHP:<?php session_start(); function ConnectLicense($product) { $hash = "za0SiyfZWd93kdTbTGvN"; $domain = "www.phpshop.ru"; $server=str_replace("www.","",getenv('SERVER_NAME')); @$fp = @fsockopen($domain, 80, $errno, $errstr); $Respon=null; if (!$fp) { return exit("Ошибка соединения с сервером PHPShop"); } else { fputs($fp, "GET /getlicense.php?server=$server&product=".urlencode($product)."&hash=$hash HTTP/1.0\r\n"); fputs($fp, "Host: $domain\r\n"); fputs($fp, "Connection: close\r\n\r\n"); while (!feof($fp)) { $Respon.=fgets($fp, 1000); } $text=explode("<?generator?>",$Respon); $data=trim($text[1]); fclose($fp); if(strlen($data) < 100) { header("Location: http://www.phpshop.ru/docs/error.html?SERVER_NAME=".$_SERVER["SERVER_NAME"]."&trial=off"); exit("Ошибка проверки лицензии для SERVER_NAME=".$_SERVER["SERVER_NAME"].", HardwareLocked=".$_SERVER["SERVER_ADDR"]); } else { @chmod("/license/", 0777); @$fp = fopen("license/trial.lic", "w+"); if ($fp) { fputs($fp, $data); fclose($fp); @chmod("/license/", 0755); } else exit("Внимание!<br>Ошибка записи ключа...<br>Задайте права доступа CMOD=777 для папки /license/ и повторите попытку."); } } } function ParseTemplate($TemplateName) { global $SysValue; $file = newGetFile($SysValue['dir']['templates'].chr(47).$_SESSION['skin'].chr(47).$TemplateName); $string = newParser($file); $path_parts = pathinfo($_SERVER['PHP_SELF']); if(getenv("COMSPEC")) $dirSlesh="\\"; else $dirSlesh="/"; $root= $path_parts['dirname']."/"; if($path_parts['dirname']!=$dirSlesh) { $replaces = array( "/images\//i" => $SysValue['dir']['templates'].chr(47).$_SESSION['skin']."/images/", "/\/favicon.ico/i" => $root."favicon.ico", "/java\//i" => $root."java/", "/css\//i" => $root."css/", "/phpshop\//i" => $root."phpshop/", "/\/order\//i" => $root."order/", "/\/done\//i" => $root."done/", "/\/print\//i" => $root."print/", "/\/links\//i" => $root."links/", "/\/files\//i" => $root."files/", "/\/opros\//i" => $root."opros/", "/\/page\//i" => $root."page/", "/\/news\//i" => $root."news/", "/\/gbook\//i" => $root."gbook/", "/\/users\//i" => $root."users/", "/\/clients\//i" => $root."clients/", "/\/price\//i" => $root."price/", "/\/pricemail\//i" => $root."pricemail/", "/\/shop\/CID/i" => $root."shop/CID", "/\/shop\/UID/i" => $root."shop/UID", "/\/search\//i" => $root."search/", "/\"\/\"/i" => $root, "/\/notice\//i" => $root."notice/", "/\/map\//i" => $root."map/", "/\/success\//i" => $root."success/", "/\/fail\//i" => $root."fail/", "/\/rss\//i" => $root."rss/", "/\/newtip\//i" => $root."newtip/", "/\/spec\//i" => $root."spec/", ); } else { $replaces = array( "/images\//i" => $SysValue['dir']['templates'].chr(47).$_SESSION['skin']."/images/", "/java\//i" => "/java/", "/css\//i" => "/css/", "/phpshop\//i" => "/phpshop/", ); } $string = preg_replace(array_keys($replaces), array_values($replaces), $string); echo $string; } function ParseTemplateReturn($TemplateName,$mod=false) { global $SysValue,$LoadItems; if($mod) $file = newGetFile($TemplateName); else $file = newGetFile($SysValue['dir']['templates'].chr(47).$_SESSION['skin'].chr(47).$TemplateName); $dis = newParser($file); return $dis; } function ConstantS($string) { return @preg_replace_callback("/@([[:alnum:]]+)@/","ConstantR",$string); } function evalstr($str) { ob_start(); if(eval(stripslashes($str[2]))!== NULL) { echo ('<center style="color:red"><br><br><b>PHPShop Template Code: В шаблоне обнаружена ошибка выполнения php</b><br>'); echo ('Код содержащий ошибки:'); echo ('<pre>'); echo ($str[2]); echo ('</pre></center>'); return ob_get_clean(); } return ob_get_clean(); } function newParser($string) { global $SysValue; $newstring = @preg_replace_callback("/(@php)(.*)(php@)/sU", "evalstr", $string); $newstring = @preg_replace("/@([a-zA-Z0-9_]+)@/e", '$SysValue["other"]["\1"]', $newstring); return $newstring; } function Parser($string) { return newParser($string); } function ConstantR($array) { global $SysValue; if(!empty($SysValue['other'][$array[1]])) $string=$SysValue['other'][$array[1]]; else $string=null; return $string; } function newGetFile($path) { $file = @file_get_contents($path); if (!$file) return false; return $file; } class PhpshopCrypt { var $LicenseParse; var $CodeString; var $DecodeString; var $LicenseFlag; var $trial=true; function PhpshopCrypt($dir) { define("ProductName","PHPSHOP 3.5 EE"); $this->ParseIni($dir); $this->PhpshopCode(); $this->PhpshopVersion(); $this->PhpshopChek(); $this->PhpshopServer(); $this->PhpshopDomen(); $this->PhpshopExpires(); $this->ErrorLicense(); } function MyCode($Code) { $CodeString=null; for($i=0;$i<strlen($Code);$i++) { if(ord($Code[$i])>=100) $CodeString.= chr(ord($Code[$i])-5); else $CodeString.= chr(ord($Code[$i])+5); } return $CodeString; } function ParseIni($dir) { $LicenseValue=@parse_ini_file($dir,1); while (list($key, $val) = @each($LicenseValue['License'])) $LicenseParse[$key]=$val; $this->LicenseParse=$LicenseParse; } function ProductName($name){ if($this->trial) return $name; else return str_replace('2.1','3.5',$name); } function PhpshopVersion(){ if(ProductName != $this->ProductName($this->LicenseParse['ProductName']) and $this->LicenseParse['SupportExpires'] < time()) exit('Для использования этого файла требуется продлить техническую поддержку и получить новую лицензию для версии Enterprise 3.5'); } function PhpshopCode() { $LicenseParse=$this->LicenseParse; unset($LicenseParse['VerificationCode']); $Code=base64_encode(serialize($LicenseParse)); $this->CodeString=$this->MyCode($Code); } function PhpshopChek() { if(($this->LicenseParse['VerificationCode'] != $this->CodeString) or (ProductName != $this->ProductName($this->LicenseParse['ProductName']))) $this->LicenseFlag = 1; } function PhpshopServer() { if($this->LicenseParse['HardwareLocked'] != "No") { if(($this->LicenseParse['HardwareLocked'] != $_SERVER["SERVER_ADDR"])) { $this->LicenseFlag = 1; } } } function PhpshopDomen() { if($this->LicenseParse['DomenLocked'] != "No") if($this->LicenseParse['DomenLocked'] != getenv('SERVER_NAME')) if ("www.".$this->LicenseParse['DomenLocked'] != getenv('SERVER_NAME')) $this->LicenseFlag = 1; } function ErrorLicense() { if($this->LicenseFlag == 1) { header("Location: http://www.phpshop.ru/docs/error.html?SERVER_NAME=".getenv('SERVER_NAME').""); exit("Ошибка проверки лицензии для SERVER_NAME=".getenv('SERVER_NAME').", HardwareLocked=".$_SERVER["SERVER_ADDR"]); } } function PhpshopExpires() { if($this->LicenseParse['Expires'] != "Never") if($this->LicenseParse['Expires'] <= date("U")) $this->LicenseFlag = 1; } function PhpshopCopyright() { return $this->LicenseParse['CopyrightEnabled']; } } $time=explode(' ', microtime()); $start_time=$time[1]+$time[0]; $_classPath='../phpshop/'; include("./phpshop/class/base.class.php"); $PHPShopBase = new PHPShopBase("./phpshop/inc/config.ini"); if($SysValue['my']['gzip'] == "true") include($SysValue['file']['gzip']); include($SysValue['class']['obj']); include($SysValue['class']['category']); include($SysValue['class']['system']); include($SysValue['class']['nav']); include($SysValue['class']['security']); include($SysValue['class']['core']); include($SysValue['class']['elements']); include($SysValue['class']['date']); include($SysValue['class']['debug']); include($SysValue['class']['valuta']); $PHPShopSystem = new PHPShopSystem(); $PHPShopNav = new PHPShopNav(); $PHPShopValuta = PHPShopValuta::getAll(); $PHPShopDebug = new PHPShopDebug(); if($PHPShopSystem->getValue('spec_num')) { if(isset($_REQUEST['skin'])) { if (file_exists("phpshop/templates/".$_REQUEST['skin']."/index.html")) { $skin=$_REQUEST['skin']; if(PHPShopSecurity::true_login($_REQUEST['skin'])) $_SESSION['skin']=$_REQUEST['skin']; } } elseif(empty($_SESSION['skin'])) { $skin=$PHPShopSystem->getValue('skin'); $_SESSION['skin']=$skin; } } else { $skin=$PHPShopSystem->getValue('skin'); $_SESSION['skin']=$skin; } if($_SERVER["SERVER_ADDR"] == "127.0.0.1" and getenv("COMSPEC")) { $RegTo['ProductName'] = "PHPSHOP 3.5 EE"; $RegTo['RegisteredTo'] = "Trial NoName"; $RegTo['CopyrightEnabled'] = "Yes"; $RegTo['DomenLocked'] = "No"; $RegTo['CopyrightColor'] = "#595959"; $RegTo['SupportExpires'] = "0"; } else { $GetFile = GetFile(); if($GetFile != null) { $PhpshopCrypt = new PhpshopCrypt($GetFile); $RegTo = $PhpshopCrypt->LicenseParse; } else { $ConnectLicense = ConnectLicense("PHPSHOP 3.5 EE"); } } $SysValue['other']['pageReg']= $RegTo['RegisteredTo']; $SysValue['other']['pageDomen']= $RegTo['DomenLocked']; $SysValue['other']['pageProduct']= $SysValue['license']['product_name']; function GetFile() { global $SysValue; $dir=$SysValue['dir']['root'].$SysValue['license']['dir']; if (@$dh = @opendir($dir)) { while (($file = readdir($dh)) !== false) { $fstat = explode(".",$file); if($fstat[1] == "lic") return $SysValue['dir']['root'].$SysValue['license']['dir'].chr(47).$file; } closedir($dh); } return null; } function GetFileInstall() { global $SysValue; $filename = "./install/"; if (is_dir($filename)) PHPShopBase::errorConnect(105,'Завершение установки','Удалите папку install'); } if(!getenv("COMSPEC")) GetFileInstall(); include($SysValue['file']['engine']); include($SysValue['file']['cache']); include($SysValue['file']['elements']); include($SysValue['file']['autoload']); if(!empty($SysValue['nav']['path'])) { $core_file="./phpshop/core/".$PHPShopNav->getPath().".core.php"; $old_core_file="pages/".$PHPShopNav->getPath().".php"; if(is_file($old_core_file) and strlen(file_get_contents($old_core_file))>10){ include_once("pages/".Open($SysValue['nav']['path'])); } elseif(is_file($core_file)) { include_once($core_file); $classname = 'PHPShop'.ucfirst($SysValue['nav']['path']); if(class_exists($classname)) { $PHPShopCore = new $classname (); $PHPShopCore->loadActions(); }else echo PHPShopCore::setError($classname,"не определен класс phpshop/core/$classname.core.php"); } elseif(!$PHPShopModules->doLoadPath($SysValue['nav']['path'])) include("pages/error.php"); } $time=explode(' ', microtime()); $seconds=($time[1]+$time[0]-$start_time); $seconds=substr($seconds,0,6); if (function_exists('memory_get_usage')) { $mem = memory_get_usage(); $_MEM=round($mem/1024,2)." Kb"; }else $_MEM=null; if($SysValue['my']['debug'] == "true") $PHPShopDebug->compile(); if($_SERVER["SERVER_ADDR"] == "127.0.0.1" and getenv("COMSPEC")) $PhpshopCopyright=$RegTo['CopyrightEnabled']; elseif($PhpshopCrypt) $PhpshopCopyright=$PhpshopCrypt->PhpshopCopyright(); if($PhpshopCopyright == "Yes") { echo ' <!-- Copyright PHPShop --> <div style="clear: both; width:100%"> <div align="center" style="display:block;padding:5px;color:'.$RegTo['CopyrightColor'].';font-size:11px"> <a href="http://www.phpshop.ru" title="Создание интернет-магазина" style="color:'.$RegTo['CopyrightColor'].';font-size:11px" target="_blank">Создание Интернет-магазина</a> '.$RegTo['RegisteredTo'].' - PHPShop. Все права защищены © 2003-'.date("Y").'. </div> </div> <!-- БД '.$SysValue['sql']['num'].' запроса ~ '.$seconds.' '.$_MEM.', Сборка '.$SysValue['upload']['version'].' -->'; } include_once($SysValue['file']['footer']); if($SysValue['my']['gzip'] == "true") GzDocOut($SysValue['my']['gzip_level'],$SysValue['my']['gzip_debug']); ?>
А как получилось? ...если конечно не секрет фирмы