{"id":342,"date":"2018-08-19T19:38:17","date_gmt":"2018-08-19T19:38:17","guid":{"rendered":"https:\/\/html5-chat.com\/blog\/?p=342"},"modified":"2018-08-19T19:48:32","modified_gmt":"2018-08-19T19:48:32","slug":"html5-chat-and-phpsocial-integration","status":"publish","type":"post","link":"https:\/\/html5-chat.com\/blog\/html5-chat-and-phpsocial-integration\/","title":{"rendered":"html5 chat and phpsocial integration"},"content":{"rendered":"<p><a href=\"https:\/\/phpsocial.com\/\" target=\"_blank\" rel=\"noopener\">PHP social<\/a> is a cool social &#8220;facebook&#8221; like script.\u00a0 It is not free but has a moderated price of 49$.<\/p>\n<p>We suppose we want to get a chat page in full screen, auto loggedon and called &#8220;chat&#8221;.<\/p>\n<p><em>(You need to be registered and loggedon on netswing.fr to test it)<\/em><\/p>\n<p>ex:\u00a0<a href=\"https:\/\/www.netswing.fr\/chat\">https:\/\/www.netswing.fr\/chat<\/a><\/p>\n<h3>How can we integrate HTML5-chat into php social ?<\/h3>\n<p><strong>Step1<\/strong>\u00a0: edit .htaccess and add this line<\/p>\n<pre>RewriteRule ^chat\/?$        index.php?a=chat          [NC]<\/pre>\n<p><strong>Step2<\/strong> : edit config.php and add<\/p>\n<pre>'chat'        =&gt; 'chat',<\/pre>\n<p><strong>Step3<\/strong>: download this script: <a href=\"https:\/\/html5-chat.com\/blog\/wp-content\/uploads\/2018\/08\/chat.zip\">chat<\/a>\u00a0, unzip it and edit it and change the 2 lines: <strong>webmasterid<\/strong> and password<\/p>\n<pre>$webmasterid = xxx;\r\n$password = 'xxxx';<\/pre>\n<p><strong>Step4<\/strong>: FTP upload chat.php to <strong>\/sources\u00a0<\/strong>folder<\/p>\n<p><strong>Step5:\u00a0<\/strong>Test that your chat works fine on\u00a0<a href=\"https:\/\/www.netswing.fr\/chat\">https:\/\/www.netswing.fr\/chat<\/a><\/p>\n<p>&nbsp;<\/p>\n<p><em>Here is the source of chat.php\u00a0<\/em><\/p>\n<p><?prettify linenums=true?><\/p>\n<pre class=\"prettyprint\">\r\n\r\n&lt;?php\r\nfunction PageMain() {\r\n\/*\r\n* Change these 2 parameters and put your webmasterid and your chat password here\r\n*\/\r\n$webmasterid = 'xxxxx'; \/\/ your webmasterid number\r\n$password = 'yyyyy'; \/\/ your chat password\r\n\/\/\r\n\r\nglobal $TMPL, $LNG, $CONF, $db, $user, $settings, $plugins;\r\nif(!isset($user) || !isset($user['idu']) ) {\r\nheader(\"Location: \".$CONF['url'].\"\/index.php?a=welcome\");\r\n}\r\n\r\n$json = json_encode(array('id'=&gt;$user['idu'], 'username'=&gt;$user['username'], 'image'=&gt;$CONF['url'].permalink('\/thumb.php?t=a&amp;w=112&amp;h=112&amp;src='.$user['image']),\r\n'gender'=&gt;($user['gender'] == 1) ? 'male' : 'female', 'role'=&gt;'user', 'profile'=&gt;$CONF['url']. '\/profile\/'.$user['username'], 'password'=&gt;$password));\r\n$encoded = file_get_contents(\"https:\/\/jwt.html5-chat.com\/protect\/\".base64_encode($json));\r\nob_start();?&gt;\r\n&lt;script src=\"https:\/\/jwt.html5-chat.com\/script\/&lt;?=$webmasterid?&gt;\/&lt;?=$encoded?&gt;\"&gt;&lt;\/script&gt;\r\n&lt;?php\r\n$script = ob_get_clean();\r\necho $script;\r\nexit;\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>PHP social is a cool social &#8220;facebook&#8221; like script.\u00a0 It is not free but has a moderated price of 49$. We suppose we want to get a chat page in full screen, auto loggedon and called &#8220;chat&#8221;. (You need to be registered and loggedon on netswing.fr to test it) ex:\u00a0https:\/\/www.netswing.fr\/chat How can we integrate HTML5-chat [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":346,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22,1],"tags":[24],"class_list":["post-342","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cms","category-uncategorized","tag-cms"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/html5-chat.com\/blog\/wp-json\/wp\/v2\/posts\/342","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/html5-chat.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/html5-chat.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/html5-chat.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/html5-chat.com\/blog\/wp-json\/wp\/v2\/comments?post=342"}],"version-history":[{"count":7,"href":"https:\/\/html5-chat.com\/blog\/wp-json\/wp\/v2\/posts\/342\/revisions"}],"predecessor-version":[{"id":360,"href":"https:\/\/html5-chat.com\/blog\/wp-json\/wp\/v2\/posts\/342\/revisions\/360"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/html5-chat.com\/blog\/wp-json\/wp\/v2\/media\/346"}],"wp:attachment":[{"href":"https:\/\/html5-chat.com\/blog\/wp-json\/wp\/v2\/media?parent=342"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/html5-chat.com\/blog\/wp-json\/wp\/v2\/categories?post=342"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/html5-chat.com\/blog\/wp-json\/wp\/v2\/tags?post=342"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}