{"id":180001,"date":"2013-05-17T10:15:02","date_gmt":"2013-05-17T06:15:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=180001"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=180001","title":{"rendered":"<span class=\"post_title\">\u0412\u044b\u0432\u043e\u0434 \u043f\u043e\u0441\u0442\u043e\u0432 \u0432\u043e\u0440\u0434\u043f\u0440\u0435\u0441\u0441 \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u043c\u0438 \u0441\u0430\u0439\u0442\u0430<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t<img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/52c\/129\/5e9\/52c1295e9ae26deda7397a597fe2e116.jpg\"\/><\/p>\n<h4>\u0417\u0430\u0434\u0430\u0447\u0430:<\/h4>\n<p>  \u041d\u0435\u0434\u0430\u0432\u043d\u043e \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0439 \u0434\u043b\u044f \u0441\u0435\u0431\u044f \u0437\u0430\u0434\u0430\u0447\u0435\u0439: \u041d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b \u0432\u044b\u0432\u043e\u0434\u0438\u043b \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0441\u0442\u043e\u0432 \u0441 \u043c\u043e\u0435\u0433\u043e \u0441\u0430\u0439\u0442\u0430 \u0432 \u0432\u0438\u0434\u0435 \u043c\u0438\u043d\u0438\u0430\u0442\u044e\u0440. \u041a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0449\u0435, \u043e\u0434\u043d\u0430\u043a\u043e \u0441\u0443\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0438 \u0438\u043c\u0435\u043d\u043d\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u0441\u043a\u0440\u0438\u043f\u0442 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u043c \u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c \u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043d\u0430 \u043b\u044e\u0431\u043e\u043c \u0441\u0430\u0439\u0442\u0435 \u0441 \u043b\u044e\u0431\u043e\u0433\u043e \u0434\u0432\u0438\u0436\u043a\u0430. <\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u043c\u043e\u0451\u043c \u0441\u0430\u0439\u0442\u0435 <a href=\"http:\/\/game.tobefun.org\/\">game.tobefun.org<\/a> \u043e\u0442\u043a\u0440\u044b\u0432 \u043b\u044e\u0431\u0443\u044e \u0438\u0433\u0440\u0443.<\/p>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435 \u044f \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043b \u044d\u0442\u043e\u0442 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 (\u043e\u043d\u043e \u0437\u0430\u0434\u0430\u0451\u0442\u0441\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0432\u0430\u0448\u0435\u0433\u043e \u043e\u043a\u043d\u0430) \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u043c\u0438\u043d\u0438\u0430\u0442\u044e\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441\u0441\u044b\u043b\u043a\u0430\u043c\u0438 \u043d\u0430 \u0437\u0430\u043f\u0438\u0441\u0438 \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u043d\u0438 \u0437\u0430\u0434\u0430\u043d\u044b. <br \/>  <a name=\"habracut\"><\/a><\/p>\n<h4>\u0428\u0430\u0433 1 \u2014 html \u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442<\/h4>\n<p>  \u041e\u0431\u0449\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 html-\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 \u0442\u0430\u043a\u043e\u0432\u0430:  <\/p>\n<pre><code class=\"html\">&lt;!DOCTYPE html&gt;  &lt;html&gt;  &lt;head&gt; &lt;meta charset=&quot;utf-8&quot; \/&gt; &lt;script src=&quot;http:\/\/code.jquery.com\/jquery-2.0.0.js&quot;&gt;&lt;\/script&gt;  &lt;!-- \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0444\u0430\u0439\u043b \u0441\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430\u043c\u0438 --&gt; &lt;script src=&quot;http:\/\/game.tobefun.org\/play\/more.js&quot;&gt;&lt;\/script&gt; &lt;\/head&gt;  &lt;body&gt;  &lt;div class=&quot;more&quot;&gt; \t&lt;span class=&quot;more_game&quot; lang=&quot;ru&quot;&gt;&lt;\/span&gt; &lt;\/div&gt;  &lt;\/body&gt; &lt;\/html&gt; <\/code><\/pre>\n<p>  <\/p>\n<h4>\u0428\u0430\u0433 2 \u2014 JavaScript \u0438 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 Ajax \u0437\u0430\u043f\u0440\u043e\u0441\u0430<\/h4>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u0440\u0430\u0431\u043e\u0447\u0435\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043e\u043a\u043d\u0430 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043a\u043e\u0434:<\/p>\n<pre><code class=\"javascript\"> var width = $(window).width();  var height = $(window).height(); <\/code><\/pre>\n<p>  \u0417\u0430\u0442\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u043c POST  <\/p>\n<pre><code class=\"javascript\"> var width = $(window).width();  var height = $(window).height();  $.post( \t\t&quot;more.php&quot;,\t\t\t\/\/ php-\u0424\u0430\u0439\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \t{ \t\twidth: logo_width, \t\theight: height \t}, \tonAjaxSuccess\t\t\t\/\/ \u0424\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u0430 \u043f\u0440\u0438 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0439 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0435 \t); \t \tfunction onAjaxSuccess(data) \t{ \t\t\t\/\/ \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u0438\u0445 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d \u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u0435 \u0441 id=&quot;more_game&quot;. \t\t\t$(&quot;#more_game&quot;).html(data); \t\t\t\/\/ \u0414\u043b\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0435\u0441\u0430\u0439\u0437\u0438\u043d\u0433\u0430 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0432\u044b\u0441\u043e\u0442\u044b \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \t\t\t$('#more_game').css('height', height); \t} <\/code><\/pre>\n<h4>\u0428\u0430\u0433 3 \u2014 PHP \u2014 \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a <\/h4>\n<p>  <\/p>\n<pre><code class=\"php\">&lt;?php \/* \u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0435\u043a\u0440\u0430\u043d\u0430  $_POST['height'] - \u041e\u0431\u0449\u0430\u044f \u0432\u044b\u0441\u043e\u0442\u0430 64 - \u0432\u044b\u0441\u043e\u0442\u0430 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f *\/ $img_kil = floor($_POST['height']\/64);   \/* \u0415\u0441\u043b\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0445\u043e\u0442\u044f \u0431\u044b \u043e\u0431\u043d\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 ... *\/ if ($img_kil &gt;= 1) { \/\/ &lt;- \u0421\u0410\u041c\u042b\u0419 \u041f\u0415\u0420\u0412\u042b\u0419 IF  \/* \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u043a \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u0430\u0439\u0442\u0430, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0445\u043e\u0442\u0438\u043c \u0432\u044b\u0442\u044f\u043d\u0443\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438 *\/ $db = new PDO('mysql:host='.DB_HOST.';dbname='.DB_NAME, DB_USER, DB_PASSWORD);  \/\/ \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u043a \u0421\u0435\u0440\u0432\u0435\u0440\u0443  \/*\u0422\u0430\u043a \u043a\u0430\u043a \u0443 \u043c\u0435\u043d\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432\u044b\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u0442\u0440\u0438 \u043a\u043e\u043b\u043e\u043d\u043a\u0438, \u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0441\u0442\u0440\u043e\u043a \u0440\u0430\u0432\u043d\u043e $img_kil \u0422\u043e \u043e\u0431\u0449\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u043f\u043e\u0441\u0442\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u0432\u0442\u0440\u043e\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 *\/ $k=$img_kil*3; <\/code><\/pre>\n<h5>\u0428\u0430\u0433 3.1 \u2014 SQL \u0437\u0430\u043f\u0440\u043e\u0441 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u0441\u044b\u043b\u043e\u043a \u043d\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f <\/h5>\n<p>  \u041e\u043d \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u0442\u044c \u0438\u0437 \u0442\u0440\u0451\u0445 \u0447\u0430\u0441\u0442\u0435\u0439:<\/p>\n<p>  1. \u0417\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0432\u044b\u0431\u043e\u0440\u043a\u0443 ID&#8217;s \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439  <\/p>\n<pre><code class=\"sql\">SELECT `ID` FROM\t`wp_posts`  WHERE\t`post_type` = 'post' AND\t`post_status` = 'publish' <\/code><\/pre>\n<p>  2. \u0417\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0432\u044b\u0431\u043e\u0440\u043a\u0443 ID&#8217;s \u0444\u043e\u0442\u043e, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u044b \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u0430\u0442\u044e\u0440\u0430  <\/p>\n<pre><code class=\"sql\">SELECT `meta_value`  FROM `wp_postmeta`  WHERE `meta_key` = '_thumbnail_id' AND `post_id`  \tIN () <\/code><\/pre>\n<p>  3. \u0417\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0432\u044b\u0431\u043e\u0440\u043a\u0443 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u0444\u043e\u0442\u043e.  <\/p>\n<pre><code class=\"sql\">SELECT `post_id`, `meta_value` FROM `wp_postmeta`  WHERE `post_id`  \tIN () ND `meta_key` = '_wp_attachment_metadata' <\/code><\/pre>\n<p>  \u041e\u0431\u0449\u0438\u0439 \u0437\u0430\u043f\u0440\u043e\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0434\u0430\u0432\u0430\u0439 $k \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:  <\/p>\n<pre><code class=\"php\">$sql=' \tSELECT `post_id`, `meta_value` \tFROM `wp_postmeta`  \tWHERE `post_id`  \tIN ( \t\tSELECT `meta_value`  \t\tFROM `wp_postmeta`  \t\tWHERE `meta_key` = \\'_thumbnail_id\\' \t\tAND `post_id`  \t\t\tIN ( \t\t\t\tSELECT `ID` \t\t\t\tFROM\t`wp_posts`  \t\t\t\tWHERE\t`post_type` = \\'post\\' \t\t\t\tAND\t`post_status` = \\'publish\\' \t\t\t) \t) \tAND `meta_key` = \\'_wp_attachment_metadata\\' \tORDER BY RAND() \tLIMIT '.$k; <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u0435\u0433\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c  <\/p>\n<pre><code class=\"php\">$stmt = $db-&gt;query($sql); \/\/\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 fetch mode $stmt-&gt;setFetchMode(PDO::FETCH_ASSOC); while($row = $stmt-&gt;fetch()) { \t \t$img_mass = unserialize($row['meta_value']);  \/* \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f $img_mass \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 \u0442\u0430\u043a\u043e\u0433\u043e \u0432\u0438\u0434\u0430 Array (     [width] =&gt; 1000     [height] =&gt; 651     [file] =&gt; 2013\/01\/\u041d\u0438\u043d\u0434\u0437\u044f-\u0447\u0435\u0440\u0435\u043f\u0430\u0448\u043a\u0438.jpg     [sizes] =&gt; Array         (             [thumbnail] =&gt; Array                 (                     [file] =&gt; \u041d\u0438\u043d\u0434\u0437\u044f-\u0447\u0435\u0440\u0435\u043f\u0430\u0448\u043a\u0438-538x350.jpg                     [width] =&gt; 538                     [height] =&gt; 350                     [mime-type] =&gt; image\/jpeg                 )              [medium] =&gt; Array                 (                     [file] =&gt; \u041d\u0438\u043d\u0434\u0437\u044f-\u0447\u0435\u0440\u0435\u043f\u0430\u0448\u043a\u0438-300x195.jpg                     [width] =&gt; 300                     [height] =&gt; 195                     [mime-type] =&gt; image\/jpeg                 )              [yarpp-thumbnail] =&gt; Array                 (                     [file] =&gt; \u041d\u0438\u043d\u0434\u0437\u044f-\u0447\u0435\u0440\u0435\u043f\u0430\u0448\u043a\u0438-120x120.jpg                     [width] =&gt; 120                     [height] =&gt; 120                     [mime-type] =&gt; image\/jpeg                 )          )      [image_meta] =&gt; Array         (             [aperture] =&gt; 0             [credit] =&gt;              [camera] =&gt;               =&gt;              [created_timestamp] =&gt; 0             [copyright] =&gt;              [focal_length] =&gt; 0             [iso] =&gt; 0             [shutter_speed] =&gt; 0             [title] =&gt;          )  ) *\/  \tlist($year, $mount, $name) = explode(&quot;\/&quot;, $img_mass['file']);  \t\/* $img_mass['file']='\u0420\u0430\u0437\u0432\u0438\u0432\u0430\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443 2013\/01\/\u041d\u0438\u043d\u0434\u0437\u044f-\u0447\u0435\u0440\u0435\u043f\u0430\u0448\u043a\u0438.jpg' \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0444\u0430\u0439\u043b \t$year = '2013' \t$mount = '01' \t$name = '\u041d\u0438\u043d\u0434\u0437\u044f-\u0447\u0435\u0440\u0435\u043f\u0430\u0448\u043a\u0438.jpg'*\/ \t\t \t$img_dir = $year.'\/'.$mount.'\/'.$img_mass['sizes']['yarpp-thumbnail']['file']; \t\/* \u0424\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u043f\u0443\u0442\u044c \u043a \u0444\u0430\u0439\u043b\u0443 \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u043d\u0430\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u0430 (\u0432 \u043c\u043e\u0451\u043c \u0441\u043b\u0443\u0447\u0430\u0435 'yarpp-thumbnail')*\/ \t \t$base [] = array ( 'post_id' =&gt; $row['post_id'], 'img_dir' =&gt; $img_dir); \t\/* \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435*\/ } <\/code><\/pre>\n<h5>\u0428\u0430\u0433 3.2 \u2014 SQL \u0437\u0430\u043f\u0440\u043e\u0441 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u0441\u044b\u043b\u043e\u043a \u043d\u0430 \u0437\u0430\u043f\u0438\u0441\u0438 <\/h5>\n<p>  <\/p>\n<pre><code class=\"php\">$k_post = sizeof($base); \/\/ \u041f\u043e\u0434\u0441\u0447\u0438\u0442\u0430\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439  for ($i=0; $i&lt;$k_post; $i++) {  \t\/* \u0424\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0441\u043e\u043e\u0434\u0442\u0432\u0435\u0434\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044e *\/ \t$sql='\t \t\tSELECT `post_title`, `post_name`  \t\tFROM `wp_posts`  \t\tWHERE `ID`  \t\t\tIN ( \t\t\t\tSELECT `post_id` \t\t\t\tFROM\t`wp_postmeta`  \t\t\t\tWHERE  `meta_value` = '.$base[$i]['post_id'].'\t \t\t\t)'; \t \t\/* \u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0435\u0433\u043e *\/\t \t$stmt = $db-&gt;query($sql); \t$stmt-&gt;setFetchMode(PDO::FETCH_ASSOC);  \t\/*\u0412\u044b\u0432\u043e\u0434\u0438\u043c \u0441\u0441\u044b\u043b\u043a\u0443*\/ \twhile($row = $stmt-&gt;fetch()) { \t\techo '&lt;a href=&quot;http:\/\/game.tobefun.org\/'.$row['post_name'].'.html&quot; title=&quot;'.$row['post_title'].'&quot;&gt;&lt;img width=&quot;120&quot; height=&quot;120&quot; src=&quot;http:\/\/game.tobefun.org\/wp-content\/uploads\/'.$base[$i]['img_dir'].'&quot;&gt;&lt;\/a&gt;'; \t}  } $db = null; \/\/\u0417\u0430\u043a\u0440\u044b\u0442\u0438\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f  } \/\/ &lt;- \u0417\u0410\u041a\u0420\u042b\u0412\u0410\u0415\u041c \u0421\u0410\u041c\u042b\u0419 \u041f\u0415\u0420\u0412\u042b\u0419 IF  ?&gt; <\/code><\/pre>\n<div class=\"clear\"><\/div>\n<\/p><\/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\/180001\/\"> http:\/\/habrahabr.ru\/post\/180001\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t<img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/52c\/129\/5e9\/52c1295e9ae26deda7397a597fe2e116.jpg\"\/><\/p>\n<h4>\u0417\u0430\u0434\u0430\u0447\u0430:<\/h4>\n<p>  \u041d\u0435\u0434\u0430\u0432\u043d\u043e \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0439 \u0434\u043b\u044f \u0441\u0435\u0431\u044f \u0437\u0430\u0434\u0430\u0447\u0435\u0439: \u041d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b \u0432\u044b\u0432\u043e\u0434\u0438\u043b \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0441\u0442\u043e\u0432 \u0441 \u043c\u043e\u0435\u0433\u043e \u0441\u0430\u0439\u0442\u0430 \u0432 \u0432\u0438\u0434\u0435 \u043c\u0438\u043d\u0438\u0430\u0442\u044e\u0440. \u041a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0449\u0435, \u043e\u0434\u043d\u0430\u043a\u043e \u0441\u0443\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0438 \u0438\u043c\u0435\u043d\u043d\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u0441\u043a\u0440\u0438\u043f\u0442 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u043c \u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c \u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043d\u0430 \u043b\u044e\u0431\u043e\u043c \u0441\u0430\u0439\u0442\u0435 \u0441 \u043b\u044e\u0431\u043e\u0433\u043e \u0434\u0432\u0438\u0436\u043a\u0430. <\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u043c\u043e\u0451\u043c \u0441\u0430\u0439\u0442\u0435 <a href=\"http:\/\/game.tobefun.org\/\">game.tobefun.org<\/a> \u043e\u0442\u043a\u0440\u044b\u0432 \u043b\u044e\u0431\u0443\u044e \u0438\u0433\u0440\u0443.<\/p>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435 \u044f \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043b \u044d\u0442\u043e\u0442 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 (\u043e\u043d\u043e \u0437\u0430\u0434\u0430\u0451\u0442\u0441\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0432\u0430\u0448\u0435\u0433\u043e \u043e\u043a\u043d\u0430) \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u043c\u0438\u043d\u0438\u0430\u0442\u044e\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441\u0441\u044b\u043b\u043a\u0430\u043c\u0438 \u043d\u0430 \u0437\u0430\u043f\u0438\u0441\u0438 \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u043d\u0438 \u0437\u0430\u0434\u0430\u043d\u044b.   <\/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-180001","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/180001","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=180001"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/180001\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=180001"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=180001"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=180001"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}