{"id":272147,"date":"2016-01-14T17:22:03","date_gmt":"2016-01-14T14:22:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=272147"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=272147","title":{"rendered":"\u0413\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439-\u0438\u043d\u0432\u0430\u0439\u0442\u043e\u0432"},"content":{"rendered":"<p>       \u042f \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439-\u0438\u043d\u0432\u0430\u0439\u0442\u043e\u0432 \u043f\u043e\u0447\u0442\u0438 \u0431\u0435\u0437 \u0431\u0434.<\/p>\n<p>  \u041a \u044d\u0442\u043e\u043c\u0443 \u0438\u0437\u043e\u0431\u0440\u0435\u0442\u0435\u043d\u0438\u044e \u043c\u0435\u043d\u044f \u043d\u0430\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0430 <a href=\"http:\/\/habrahabr.ru\/post\/121921\/\">\u044d\u0442\u0430<\/a> \u0441\u0442\u0430\u0442\u044c\u044f \u0438 \u043c\u043e\u044f \u043b\u044e\u0431\u043e\u0432\u044c \u043a \u0411\u0414.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/a00\/2e2\/19e\/a002e219ed364ba29bf67cdf7838b56e.png\"\/> <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/500\/572\/465\/50057246519a4b12ac922cc3a8535c57.png\"\/> <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/c4b\/020\/5c0\/c4b0205c0c954ee587c065751feec090.png\"\/> <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/895\/ef2\/55c\/895ef255c37848d2bc0b05db12aca439.png\"\/><br \/>  <a name=\"habracut\"><\/a><br \/>  \u0418\u0442\u0430\u043a, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u0440\u0430\u0437\u0443 \u043a \u043a\u043e\u0434\u0443!<\/p>\n<p>  <b>index.php<\/b> \u2014 \u0432\u0435\u0431-\u043c\u043e\u0440\u0434\u0430, \u0437\u0434\u0435\u0441\u044c \u2014 \u0444\u043e\u0440\u043c\u0430.<\/p>\n<pre><code class=\"html\">&lt;? header('Content-Type: text\/html; charset=utf-8'); ?&gt; &lt;fieldset&gt;    &lt;legend&gt;Get key&lt;\/legend&gt; \tTEXT: \t&lt;input type=&quot;text&quot; id=&quot;inp&quot; size=&quot;50&quot; onkeyup=&quot;document.getElementById('img').src='image.php?in='+this.value&quot;&gt; \t&lt;br&gt; \t&lt;br&gt; IMG: \t&lt;img src=&quot;image.php?in=&quot; id=&quot;img&quot; onclick=&quot;window.open(this.src)&quot; width=&quot;200&quot; height=&quot;200&quot;&gt; \t&lt;br&gt; \u041a\u043b\u0456\u043a\u043d\u0438 \u043f\u043e \u043a\u0430\u0440\u0442\u0438\u043d\u0446\u0456 \u0448\u043e\u0431 \u0441\u043a\u0430\u0447\u0430\u0442\u0438 \u0457\u0457. &lt;\/fieldset&gt; &lt;fieldset&gt;    &lt;legend&gt;Test key&lt;\/legend&gt; \t&lt;form method=&quot;post&quot; enctype=&quot;multipart\/form-data&quot; action=&quot;test.php&quot;&gt; \t\tTEXT: \t\t&lt;input type=&quot;text&quot; name=&quot;KOD&quot; value=&quot;&lt;?php if(isset($_POST['KOD'])){echo $_POST['KOD'];} ?&gt;&quot; size=&quot;50&quot;&gt; \t\t&lt;br&gt; FILE: \t\t&lt;input type=&quot;hidden&quot; name=&quot;UserID&quot; value=&quot;&lt;?php \t\t\t$ip = $_SERVER['REMOTE_ADDR']; \t\t\t$ua = $_SERVER['HTTP_USER_AGENT']; \t\t\t$d = getdate();  \t\t\t$UserID = sha1($ip.$ua.$d[&quot;mday&quot;].'Secret'); \t\t\t$UserID = base64_encode($UserID); \t\t\t$UserID = rtrim($UserID,&quot;=&quot;); \t\t\techo $UserID; ?&gt;&quot;&gt; \t\t&lt;input type=&quot;file&quot; name=&quot;uploadfile&quot;&gt; \t\t&lt;br&gt; \t\t&lt;button type=&quot;submit&quot;&gt;SUBMIT&lt;\/button&gt; \t&lt;\/form&gt; &lt;\/fieldset&gt; <\/code><\/pre>\n<p>  UserID \u2014 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440, \u0447\u0442\u043e\u0431\u044b \u0435\u0441\u043b\u0438 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043a\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u2014 \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0435\u0440\u0435\u043f\u043b\u0443\u0442\u0438\u043b\u0438\u0441\u044c.<\/p>\n<p>  <b>image.php<\/b> \u2014 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f.<\/p>\n<pre><code class=\"php\">&lt;? include('generator.php');\/\/\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 header('Content-Disposition: attachment; filename=&quot;image.png&quot;');\/\/\u0427\u0442\u043e\u0431\u044b \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0435 \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u043b\u043e\u0441\u044c \u0441\u0440\u0430\u0437\u0443  header (&quot;Content-type: image\/png&quot;);\/\/\u0422\u0438\u043f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f imagepng(gen($_GET['in']));\/\/\u041e\u0442\u0434\u0430\u0435\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 ?&gt; <\/code><\/pre>\n<p>  <b>test.php<\/b> \u2014 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439.<\/p>\n<pre><code class=\"php\">&lt;?php error_reporting(0); include('generator.php');  $UserID = rtrim(base64_encode(sha1($_POST['UserID'])), '=');\/\/\u041c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u043c ID \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u043b\u043e \u043d\u0435 \u0442\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u043e  if (copy($_FILES['uploadfile']['tmp_name'], '.\/files\/image1_'.$UserID.'.png')){\/\/\u0422\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c \u0444\u0430\u0439\u043b \timagepng(gen($_POST['KOD']), '.\/files\/image2_'.$UserID.'.png'); \tif (file_get_contents('.\/files\/image2_'.$UserID.'.png') == file_get_contents('.\/files\/image1_'.$UserID.'.png')){echo 'True';}else{echo 'False';} }else{\/\/\u0438\u043b\u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u043e\u0448\u044b\u0431\u043a\u0443. \techo &quot;ERROR &quot;.$_FILES['uploadfile']['error']; } ?&gt; <\/code><\/pre>\n<p>  <b>generator.php<\/b> \u2014 \u0441\u0430\u043c\u043e\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435 \u2014 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439.<\/p>\n<pre><code class=\"php\">&lt;?php function gen($input, $secret='0JAg0YLRiyDQu9GO0LHQvtC30L3QsNGC0LXQu9GM0L3Ri9C5KSDQlNCw0Lkg0LzQvdC1INC40L3QstCw0LnRgiDQvdCwINGF0LDQsdGALCDQsD8p'){\/\/\u0417\u0434\u0435\u0441\u044c \u0441\u0435\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u043a\u043b\u044e\u0447.  \t$hesh=sha1($input.$secret).sha1($input.sha1($input.$secret).$secret).sha1($input.sha1($input.$secret).sha1($input.sha1($input.$secret).$secret).$secret); \/\/\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \t$numbers = $hesh;\t\/\/\u0422\u0435\u043f\u0435\u0440 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0446\u044b\u0444\u0440\u044b \tfor($i=0;$i&lt;count(['a', 'b', 'c', 'd', 'e', 'f']);$i++){ \t\t$numbers = str_replace(['a', 'b', 'c', 'd', 'e', 'f', '0'][$i], ['2', '3', '4', '5', '6', '7', '8'][$i], $numbers);\/\/\u0417\u0430\u043c\u0435\u043d\u044f\u0435\u043c \u0431\u0443\u043a\u0432\u044b \u043d\u0430 \u0446\u044b\u0444\u0440\u044b\t\t \t}   \t$im = imagecreatetruecolor(200, 200);\/\/\u0414\u0435\u043b\u0430\u0435\u043c \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443 \t$color = imagecolorallocate($im, $numbers[0]*28, $numbers[1]*28, $numbers[2]*28); \timagefilledrectangle($im, 0, 0, 200, 200, $color);xn--%20-5cdzk3ajhfdhe2f7h \t \tfor($i=0; $i &lt; round((strlen($numbers)\/4), 0); $i++) {  \t\t$k = round((strlen($numbers)\/10), 0);\/\/\u041a\u043e\u0435\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044f. \u041e\u043f\u0440\u0435\u0434\u0438\u043b\u0438\u043b \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u043f\u0435\u0440\u0435\u0431\u043e\u0440\u0430  \t\t$x = $numbers[$i*4]*$k;\/\/X \t\t$y = $numbers[$i*4+1]*$k;\/\/Y   \t\t$w = 5 + $numbers[$i*4+2]*$k;\/\/\u0428\u0438\u0440\u0438\u043d\u0430 \t\t$h = 5 + $numbers[$i*4+3]*$k;\/\/\u0412\u044b\u0441\u043e\u0442\u0430  \t\t$color = imagecolorallocatealpha($im, $numbers[$i*4+1]*40, $numbers[$i*4+2]*40, $numbers[$i*4+3]*40, 70);\/\/\u0426\u0432\u0435\u0442 \u0444\u0438\u0433\u0443\u0440\u044b  \t\timagefilledrectangle($im, $x, $y, $x+$w, $y+$h, $color);\/\/\u0420\u0438\u0441\u0443\u0435\u043c \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \t} \treturn $im;\/\/\u041e\u0442\u0434\u0430\u0435\u043c \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443 \timagedestroy($im);  } <\/code><\/pre>\n<p>  \u041d\u0443, \u0432\u043e\u0442 \u0438 \u0432\u0441\u0435. \u0411\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u0447\u0442\u0438 \u043d\u0435 \u043d\u0443\u0436\u043d\u0430. \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435, \u0434\u043b\u044f \u0447\u0435\u0433\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u2014 \u0434\u043b\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430. \u041d\u043e \u043c\u043e\u0436\u043d\u043e \u043a\u0430\u043a-\u0442\u043e \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0438 \u0431\u0435\u0437 \u0431\u0430\u0437\u044b). \u0418\u043d\u0432\u0430\u0439\u0442 \u0434\u043b\u044f \u0441\u043b\u043e\u0432\u0430 \u00ab\u0418\u041d\u0412\u0410\u0419\u0422\u00bb \u0438 \u00ab\u0425\u0410\u0411\u0420\u00bb.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/114\/73f\/d4e\/11473fd4e0254b0286021cccf8bcc5c6.png\"\/> <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/cdb\/cfd\/189\/cdbcfd189db647bc9d1a555c2c7bd9ae.png\"\/><\/p>\n<p>  \u0414\u0435\u043c\u043e: <a href=\"http:\/\/app.blastorq.pp.ua\/ImgInvite\/\">http:\/\/app.blastorq.pp.ua\/ImgInvite\/<\/a><br \/>  GitHub: <a href=\"https:\/\/github.com\/da411d\/ImgInviteGenerator\">https:\/\/github.com\/da411d\/ImgInviteGenerator<\/a>       <\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/275117\/\"> http:\/\/habrahabr.ru\/post\/275117\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>       \u042f \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439-\u0438\u043d\u0432\u0430\u0439\u0442\u043e\u0432 \u043f\u043e\u0447\u0442\u0438 \u0431\u0435\u0437 \u0431\u0434.<\/p>\n<p>  \u041a \u044d\u0442\u043e\u043c\u0443 \u0438\u0437\u043e\u0431\u0440\u0435\u0442\u0435\u043d\u0438\u044e \u043c\u0435\u043d\u044f \u043d\u0430\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0430 <a href=\"http:\/\/habrahabr.ru\/post\/121921\/\">\u044d\u0442\u0430<\/a> \u0441\u0442\u0430\u0442\u044c\u044f \u0438 \u043c\u043e\u044f \u043b\u044e\u0431\u043e\u0432\u044c \u043a \u0411\u0414.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/a00\/2e2\/19e\/a002e219ed364ba29bf67cdf7838b56e.png\"\/> <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/500\/572\/465\/50057246519a4b12ac922cc3a8535c57.png\"\/> <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/c4b\/020\/5c0\/c4b0205c0c954ee587c065751feec090.png\"\/> <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/895\/ef2\/55c\/895ef255c37848d2bc0b05db12aca439.png\"\/>  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-272147","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/272147","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=272147"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/272147\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=272147"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=272147"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=272147"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}