{"id":268715,"date":"2017-12-20T14:43:57","date_gmt":"2017-12-20T14:43:57","guid":{"rendered":"https:\/\/ru.wordpress.org\/support\/topic\/%d0%ba%d0%b0%d0%ba-%d0%b8%d0%b7-js-%d0%b2%d1%8b%d0%b7%d0%b2%d0%b0%d1%82%d1%8c-php-%d1%81-%d1%84%d1%83%d0%bd%d0%ba%d1%86%d0%b8%d1%8f%d0%bc%d0%b8-wordpress\/"},"modified":"2017-12-20T14:43:57","modified_gmt":"2017-12-20T14:43:57","slug":"%d0%ba%d0%b0%d0%ba-%d0%b8%d0%b7-js-%d0%b2%d1%8b%d0%b7%d0%b2%d0%b0%d1%82%d1%8c-php-%d1%81-%d1%84%d1%83%d0%bd%d0%ba%d1%86%d0%b8%d1%8f%d0%bc%d0%b8-wordpress","status":"publish","type":"topic","link":"https:\/\/ru.wordpress.org\/support\/topic\/%d0%ba%d0%b0%d0%ba-%d0%b8%d0%b7-js-%d0%b2%d1%8b%d0%b7%d0%b2%d0%b0%d1%82%d1%8c-php-%d1%81-%d1%84%d1%83%d0%bd%d0%ba%d1%86%d0%b8%d1%8f%d0%bc%d0%b8-wordpress\/","title":{"rendered":"\u041a\u0430\u043a \u0438\u0437 js \u0432\u044b\u0437\u0432\u0430\u0442\u044c php \u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 wordpress"},"content":{"rendered":"<p>\u041f\u043e\u0434\u0441\u043a\u0430\u0436\u0438\u0442\u0435, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0437\u0430\u043a\u043e\u0434\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0438\u0434\u0435\u044e.<\/p>\n<p>\u041d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u043a\u043d\u043e\u043f\u043a\u0430, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e ajax \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0444\u0430\u0439\u043b php \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 wordpress.<\/p>\n<p>\u0432\u043e\u0442 \u043c\u043e\u0439 ajax.js<\/p>\n<pre><code>function ajaxPost (params) {\n\tvar request = new XMLHttpRequest ();\n\n\trequest.onreadystatechange = function(){\n\t\tif (request.readyState == 4 &amp;&amp; request.status == 200){\n\t\t\tdocument.querySelector(&#039;#reit&#039;).innerHTML = request.responseText;\n\t\t}\n\t}\n\n\trequest.open(&#039;POST&#039;,&#039;\/wp-content\/plugins\/myinnovatika\/includes\/ajax.php&#039;);\n\trequest.setRequestHeader(&#039;Content-Type&#039;,&#039;application\/x-www-form-urlencoded&#039;);\n\trequest.send(params);\n}<\/code><\/pre>\n<p>\u0410 \u0432\u043e\u0442 ajax.php<\/p>\n<pre><code>&lt;?php\nif ( is_user_logged_in() ) {\n\techo &#039;\u0412\u044b \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u043d\u0430 \u0441\u0430\u0439\u0442\u0435!&#039;;\n}\nelse {\n\techo &#039;\u0412\u044b \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c!&#039;;\n}<\/code><\/pre>\n<p>\u041d\u043e \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043d\u0430 \u043c\u0435\u0441\u0442\u0435 \u0432\u044b\u0432\u043e\u0434\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0448\u0438\u0431\u043a\u0430: <\/p>\n<blockquote><p>Fatal error: Call to undefined function is_user_logged_in() in \\wp-content\\plugins\\myinnovatika\\includes\\ajax.php on line 2<\/p><\/blockquote>\n<p>\u0442.\u0435. \u043a\u0430\u043a \u044f \u043f\u043e\u043d\u044f\u043b, \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e function is_user_logged_in()<br \/>\n\u041a\u0430\u043a \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c?<\/p>\n","protected":false},"template":"","class_list":["post-268715","topic","type-topic","status-publish","hentry","topic-tag-js","topic-tag-php"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ru.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/268715","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ru.wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/ru.wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/ru.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/268715\/revisions"}],"wp:attachment":[{"href":"https:\/\/ru.wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=268715"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}