Intergration with youdate.website

Youdate.website is a small CRM for dating written with Yii framework

Here is a quick way to integrate html5-chat with youdate





<?php
require(__DIR__ . '/application/bootstrap.php');
require(__DIR__ . '/application/vendor/autoload.php');
require(__DIR__ . '/application/environment.php');
require(__DIR__ . '/application/vendor/yiisoft/yii2/Yii.php');
require(__DIR__ . '/application/controllers/PhotoController.php');
$config = require(__DIR__ . '/application/config/web.php');
$application = new yii\web\Application($config);
$user = Yii::$app->user;
if (!$user) {
   exit();
}
$username = Yii::$app->user->identity->profile->name;
$photo_id = Yii::$app->user->identity->profile->photo_id;
$sex = Yii::$app->user->identity->profile->sex;
$role = Yii::$app->user->identity->profile->status;
$photo = (new \yii\db\Query())
->select(['id', 'source'])
->from('photo')
->where(['id' => $photo_id])
->one();
$image = ($photo) ? "http://yoursitehere.com/content/photos/{$photo['source']}" : '';
$webmasterid = XXXXXXX;
$gender = 'male';
switch ($sex) {
   case 2:
      $gender = 'female';
      break;
   case 11:
      $gender = 'couple';
      break;
   case 12:
      $gender = 'trans';
      break;
}
$myuser = [
   'username' => $username,
   'gender' => $gender,
   'role' => 'user',
   'image' => base64_encode($image),
   'password' => 'YourHTML5ChatPassword',
];
$json = json_encode($myuser);
$encoded = file_get_contents("https://jwt.html5-chat.com/protect/" . base64_encode($json));
?>
<!doctype html>
<html lang="en">
<head>
   <meta charset="UTF-8">
   <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
   <meta http-equiv="X-UA-Compatible" content="ie=edge">
   <title>Webcam chat</title>
   <style>
      body, html, #chatContainer {
         width: 100%;
         height: 100%;
      }
   </style>
</head>
<body>
<div id="chatContainer">
   <script src="https://html5-chat.com/script/<?= $webmasterid ?>/<?= $encoded ?>"></script>
</div>
</body>
</html>

One thought to “Intergration with youdate.website”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.