Jump to content

youdate.website Intergration


chat5html

99 views

 Share

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

Here is a quick way to integrate html5-videochat 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']}" : '';

$ACCOUNT_ID = XXXXXXX;
$TOKEN = XXXXXXX;

$gender = 1;
switch ($sex) {
   case 2:
      $gender = 2;
      break;
   case 11:
      $gender = 2;
      break;
   case 12:
      $gender = 1;
      break;
}

    $json_d_user = json_encode(array(
          'password'=> $TOKEN,
          'id_account'=> $ACCOUNT_ID,
          'username'=> $username,
          'gender'=> $gender,
          'role'=> 'user',
          'birthyear'=> '',
          'profile_link'=> "",
          'immage_user'=> $image,
          'room_id'=> ''
   ));
   $encoded___ = file_get_contents("https://html5-videochat.com/applications/chat_webcam_personale/crypt.php/?code_crypt=".base64_encode($json_d_user));

?>
<!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">
   <iframe src="https://www.html5-videochat.com/index.php?/chat/<?= $encoded___ ?>"   width="100%" height="100%"   allowfullscreen="" allow="geolocation; microphone; camera; allowfullscreen; autoplay;" ></iframe>';
</div>
</body>
</html>

Edit;

Quote

$ACCOUNT_ID = XXXXXXX;
$TOKEN = XXXXXXX;

 

 Share

0 Comments


Recommended Comments

There are no comments to display.

×
×
  • Create New...