public function individualRoom($roomId)
 {
     $smarty = new RoomGeneratorSmarty();
     $room = Room::getRoomById($roomId);
     $apiObj = new OpenTokSDK(API_Config::API_KEY, API_Config::API_SECRET);
     $token = $apiObj->generate_token($room->getSessionId());
     $smarty->assign('title', 'OpenTok Room Generator - PHP');
     $smarty->assign('sessionId', $room->getSessionId());
     $smarty->assign('token', $token);
     $smarty->assign('roomId', $room->getRoomId());
     $smarty->display($_SERVER['DOCUMENT_ROOT'] . '/php_generator/app/view/rooms/individual_room.tpl');
 }
示例#2
0
 public static function addRoom($name, $public)
 {
     //generate a session ID
     $apiObj = new OpenTokSDK(API_Config::API_KEY, API_Config::API_SECRET);
     $session = $apiObj->create_session($_SERVER["REMOTE_ADDR"]);
     $sessionId = $session->getSessionId();
     //add room
     $dbObj = mysql_connect(Database::database_host, Database::database_user, Database::database_password);
     mysql_select_db(Database::database_name, $dbObj);
     $query = "INSERT INTO " . self::TABLE_NAME . "(name, session_id, public) VALUES('" . mysql_real_escape_string($name) . "', '{$sessionId}', '" . mysql_real_escape_string($public) . "')";
     mysql_query($query, $dbObj);
     $query = "SELECT room_id FROM " . self::TABLE_NAME . " WHERE session_id = '{$sessionId}'";
     $result = mysql_query($query, $dbObj);
     $row = mysql_fetch_array($result);
     mysql_close($dbObj);
     return $row['room_id'];
 }
示例#3
0
require_once './Opentok-PHP-SDK/API_Config.php';
require_once './Opentok-PHP-SDK/OpenTokSDK.php';
if (!isset($publisher)) {
    $publisher = 'Guest';
}
if (!isset($moderator)) {
    $moderator = 'Host';
}
if (!isset($myapiKey)) {
    $myapiKey = API_Config::API_KEY;
}
if (!isset($myapiSecret)) {
    $myapiSecret = API_Config::API_SECRET;
}
// Creating an OpenTok Object
$apiObj = new OpenTokSDK($myapiKey, $myapiSecret);
// Creating Simple Session object, passing IP address to determine closest production server
// Passing IP address to determine closest production server
//        e.g.   $session = $apiObj->createSession( $_SERVER["REMOTE_ADDR"] );
$session = $apiObj->createSession();
// Creating example for Simple Session object to enable p2p connections
//$session = $apiObj->createSession( $_SERVER["REMOTE_ADDR"], array(SessionPropertyConstants::P2P_PREFERENCE=> "enabled") );
// Getting sessionId from SessionsRoleConstants::MODERATOR
// Option 1: Call getSessionId()
$sessionId = $session->getSessionId();
$arr = array();
$arr['apiKey'] = $myapiKey;
$arr['sessionId'] = $sessionId;
$arr['token_moderator'] = $apiObj->generateToken($sessionId, RoleConstants::MODERATOR, $dt, moderator);
$arr['token_guest'] = $apiObj->generateToken($sessionId, RoleConstants::PUBLISHER, $dt, publisher);
echo json_encode($arr);
}
if ($action == 'busycall') {
    if (!empty($chatroommode)) {
        sendChatroomMessage($to, 'CC^CONTROL_AVCHAT_BUSY_CALL', 0);
    } else {
        sendMessage($to, 'CC^CONTROL_PLUGIN_AVCHAT_BUSYCALL_' . $grp, 1);
    }
}
if ($videoPluginType != '5') {
    if ($videoPluginType == '3') {
        include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'sdk' . DIRECTORY_SEPARATOR . 'API_Config.php';
        include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'sdk' . DIRECTORY_SEPARATOR . 'OpenTokSDK.php';
        $apiKey = '348501';
        $apiSecret = '1022308838584cb6eba1fd9548a64dc1f8439774';
        $apiServer = 'https://api.opentok.com';
        $apiObj = new OpenTokSDK($apiKey, $apiSecret);
    }
    if ($action == 'request') {
        $avchat_token = '';
        if (empty($grp)) {
            $grp = $userid < $to ? md5($userid) . md5($to) : md5($to) . md5($userid);
            $grp = md5($_SERVER['HTTP_HOST'] . $grp);
            if ($videoPluginType == '3') {
                $location = time();
                if (!empty($_SERVER['REMOTE_ADDR'])) {
                    $location = $_SERVER['REMOTE_ADDR'];
                }
                $session = $apiObj->create_session($location);
                $grp = $session->getSessionId();
                $avchat_token = $apiObj->generate_token($grp);
            }
    $url = API_Config::API_SERVER . "/token/validate";
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_HEADER, 1);
    curl_setopt($ch, CURLOPT_VERBOSE, TRUE);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/x-www-form-urlencoded'));
    curl_setopt($ch, CURLOPT_HTTPHEADER, array("X-TB-TOKEN-ATUH: {$token}"));
    $result = curl_exec($ch);
    echo $result;
    //echo curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);
}
assert_options(ASSERT_CALLBACK, 'my_assert_handler');
set_exception_handler('exception_handler');
require_once '../OpenTokSDK.php';
$a = new OpenTokSDK(API_Config::API_KEY, API_Config::API_SECRET);
$token = $a->generate_token();
assert('$token');
$token = $a->generate_token("mysession");
assert('$token');
$token = $a->generate_token("mysession", RoleConstants::SUBSCRIBER);
assert('$token');
$token = $a->generate_token("mysession", RoleConstants::PUBLISHER);
assert('$token');
$token = $a->generate_token("mysession", RoleConstants::MODERATOR);
assert('$token');
try {
    $token = $a->generate_token("mysession", "randomString");
    assert(false);
} catch (Exception $e) {
    assert('$e');
}
$basedata = null;
if (!empty($_REQUEST['basedata'])) {
    $basedata = $_REQUEST['basedata'];
}
if (!checkcURL() && $videoPluginType == '2') {
    echo "<div style='background:white;'>Please contact your site administrator to configure this plugin.</div>";
    exit;
}
if ($videoPluginType == '2') {
    include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'sdk' . DIRECTORY_SEPARATOR . 'API_Config.php';
    include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'sdk' . DIRECTORY_SEPARATOR . 'OpenTokSDK.php';
    $apiKey = '348501';
    $apiSecret = '1022308838584cb6eba1fd9548a64dc1f8439774';
    $apiServer = 'https://api.opentok.com/hl';
    $apiObj = new OpenTokSDK($apiKey, $apiSecret);
    if (empty($_SESSION['avchat_token'])) {
        $_SESSION['avchat_token'] = $apiObj->generate_token();
    }
}
if ($_REQUEST['action'] == 'request') {
    if ($videoPluginType == '2') {
        $location = time();
        $session = $apiObj->create_session($location);
        $grp = $session->getSessionId();
    } else {
        $grp = time();
    }
    sendMessage($_REQUEST['to'], $broadcast_language[2] . " <a href='javascript:void(0);' onclick=\"javascript:jqcc.ccbroadcast.accept('" . $userid . "','" . $grp . "');\">" . $broadcast_language[3] . "</a> " . $broadcast_language[4], 1);
    sendMessage($_REQUEST['to'], $broadcast_language[5], 2);
    if (!empty($_REQUEST['callback'])) {
<?php

/*!
* OpenTok PHP Library
* http://www.tokbox.com/
*
* Copyright 2010, TokBox, Inc.
*
*/
require_once 'SDK/API_Config.php';
require_once 'SDK/OpenTokSDK.php';
$apiObj = new OpenTokSDK(API_Config::API_KEY, API_Config::API_SECRET);
$session = $apiObj->create_session($_SERVER["REMOTE_ADDR"]);
echo $session->getSessionId();
echo "<br/>";
echo $apiObj->generate_token();
示例#8
0
<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
require_once 'Platform/opentok/API_Config.php';
require_once 'Platform/opentok/OpenTokSDK.php';
$apiObj = new OpenTokSDK(API_Config::API_KEY, API_Config::API_SECRET);
$session = $apiObj->create_session($_SERVER["REMOTE_ADDR"]);
$sessionId = $session->getSessionId();
?>
<script>
    $(function() {
        $("#eventDate").datepicker();
        $("#eventDate").datepicker("option","dateFormat","yy-mm-dd");
    });
</script>
<section class="main-content">           
    <h4>Create your new Lesson ! Be the Expert Hobbyist!</h4>  
    <form name="create" id="createLesson" method="POST" action="<?php 
echo base_url();
?>
index.php/lesson/saveLesson">
        <div>
            <p>In Lesson Category:            
                <select id="lessonTypeId" name="lessonTypeId">

                    <?php 
foreach ($lessonTypes->data as $lessontype) {
    ?>
 public function createChatSession()
 {
     try {
         $this->app->beginTransaction();
         // create chat session record
         $chat_session = new GcrChatSession();
         gcr::loadSdk('opentok');
         $api = new OpenTokSDK(API_Config::API_KEY, API_Config::API_SECRET);
         $session = $api->create_session($_SERVER["REMOTE_ADDR"]);
         $chat_session->setRoomId($session->getSessionId());
         $chat_session->setEschoolId($this->app->getShortName());
         $chat_session->setTimeCreated(time());
         $chat_session->save();
         // create chat session users record
         $chat_session->createUserSession($this);
         $this->app->commitTransaction();
     } catch (Doctrine_Exception $e) {
         $this->app->rollbackTransaction();
         global $CFG;
         $CFG->current_app->gcError($e->getMessage(), 'gcdatabaseerror');
     }
     return $chat_session;
 }
示例#10
0
文件: session.php 项目: richzeng/wing
<?php 
require_once 'API_Config.php';
require_once 'OpenTokSDK.php';
require_once 'SessionPropertyConstants.php';
$apiObj = new OpenTokSDK(API_Config::API_KEY, API_Config::API_SECRET);
$session = $apiObj->create_session($_SERVER["REMOTE_ADDR"], array(SessionPropertyConstants::P2P_PREFERENCE => "enabled"));
echo $session->getSessionId();
?>
<script src="http://staging.tokbox.com/v0.91/js/TBmin.js"></script>

<iframe width="640" height="480" style="border:none" src=
"http://api.dabbleboard.com/api/iframe?dev_id=sumukh1&user_id=cs61&user_key=cs61&drawing_user_id=cs61&drawing_id=0&drawing_key=cs61&width=640&height=480"
></iframe>

<br>
</iframe>
示例#11
0
        $update_query = mysql_query($update_pass);
        if ($update_query) {
            echo "success";
        } else {
            echo "error";
        }
    } else {
        echo "exists";
    }
}
/* apply as expert */
if (isset($_GET['set']) && $_GET['set'] == base64_encode("apply_expert")) {
    require_once 'SDK/OpenTokSDK.php';
    require_once 'SDK/OpenTokArchive.php';
    require_once 'SDK/OpenTokSession.php';
    $apiObj = new OpenTokSDK($tokboxApi, $tokboxApiSecret);
    $session = $apiObj->createSession();
    $sessionId = $session->getSessionId();
    $update_user = "******" . $sessionId . "' WHERE id='" . trim(base64_decode($_GET['sid'])) . "' ";
    $update_query = mysql_query($update_user);
    if ($update_query) {
        ?>
		<script>
		window.location.href="<?php 
        echo $root;
        ?>
expert_info.php";
		</script>
	<?php 
    }
}
示例#12
0
                    ?>
user_sessions.php?tab=schedule">Return to dashboard</a></p>	
                </div>
            </div><!-- Session Message -->
             </div><!-- ALL SCREEN OUTER -->
        
    </div>
			<?php 
                } else {
                    if ($fetch['time_requested'] == '1' || strtotime($date) >= strtotime($fetch['session_datetime']) && strtotime($date) <= strtotime($fetch['session_datetime'] . "+" . $fetch['duration'] . " MINUTES ")) {
                        $field = " tokbox_id ";
                        $table = " users ";
                        $condition = " AND id = '" . $fetch['exp_applied_id'] . "' ";
                        $user_dt = getDetail($field, $table, $condition);
                        $sessionId = $user_dt[0]['tokbox_id'];
                        $apiObj = new OpenTokSDK($tokboxApi, $tokboxApiSecret);
                        $tokenId = $apiObj->generate_token($sessionId, RoleConstants::PUBLISHER, null, $_SESSION['LoginUserId']);
                        ?>
			<div class="SmallVideoCont">
                <div id="smallvideo"></div><!-- Small Video -->
            </div>
			<div id="exp_id"><?php 
                        echo $fetch['exp_applied_id'];
                        ?>
</div>
				<script type="text/javascript">
var root = "<?php 
                        echo $root;
                        ?>
";	
var type="user";
示例#13
0
\t\t\t\t\tvar pageHost = ((document.location.protocol == "https:") ? "https://" :\t"http://"); 
\t\t\t\t\tdocument.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='" 
\t\t\t\t\t\t\t\t\t+ pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" ); 
\t\t\t\t</script> 
\t\t\t</div>\t
\t</body>
\t</html>
EOD;
    } else {
        require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'sdk' . DIRECTORY_SEPARATOR . 'API_Config.php';
        require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'sdk' . DIRECTORY_SEPARATOR . 'OpenTokSDK.php';
        $apiKey = '23262682';
        $apiSecret = '4c03c626ca826d554d66c16d74afb80fe2d0e3dc';
        $apiServer = 'https://api.opentok.com/hl';
        $sessionid = $_REQUEST['grp'];
        $apiObj = new OpenTokSDK($apiKey, $apiSecret);
        $token = $apiObj->generate_token();
        if (!empty($_REQUEST['chatroommode'])) {
            if (empty($_REQUEST['join'])) {
                sendChatroomMessage($sessionid, $broadcast_language[9] . " <a href='javascript:void(0);' onclick=\"javascript:jqcc.ccbroadcast.join('" . $_REQUEST['grp'] . "');\">" . $broadcast_language[10] . "</a>");
            }
            $sql = "select vidsession from cometchat_chatrooms where id = '" . mysql_real_escape_string($sessionid) . "'";
            $query = mysql_query($sql);
            $chatroom = mysql_fetch_array($query);
            if (empty($chatroom['vidsession'])) {
                $session = $apiObj->create_session(time());
                $newsessionid = $session->getSessionId();
                $sql = "update cometchat_chatrooms set  vidsession = '" . mysql_real_escape_string($newsessionid) . "' where id = '" . mysql_real_escape_string($sessionid) . "'";
                $query = mysql_query($sql);
                $sessionid = $newsessionid;
            } else {
示例#14
0
<?php

require_once './Opentok-PHP-SDK/API_Config.php';
require_once './Opentok-PHP-SDK/OpenTokSDK.php';
// Creating an OpenTok Object
$apiObj = new OpenTokSDK(API_Config::API_KEY, API_Config::API_SECRET);
// Creating Simple Session object, passing IP address to determine closest production server
// Passing IP address to determine closest production server
//$session = $apiObj->createSession( $_SERVER["REMOTE_ADDR"] );
$session = $apiObj->createSession();
// Creating Simple Session object
// Enable p2p connections
//$session = $apiObj->createSession( $_SERVER["REMOTE_ADDR"], array(SessionPropertyConstants::P2P_PREFERENCE=> "enabled") );
// Getting sessionId from Sessions
// Option 1: Call getSessionId()
$sessionId = $session->getSessionId();
// After creating a session, call generateToken(). Require parameter: SessionId
//$token = $apiObj->generateToken($sessionId);
// Giving the token a moderator role, expire time 5 days from now, and connectionData to pass to other users in the session
//$token = $apiObj->generateToken($sessionId, RoleConstants::MODERATOR, time() + (5*24*60*60), "hello world!" );
$arr = array();
$arr['apiKey'] = API_Config::API_KEY;
//$arr['sessionId'] = $sessionId;
$sid = file_get_contents("sessionid.txt") or die("can't read file");
$ar2 = json_decode($sid, true);
$arr['sessionId'] = $ar2['sessionId'];
//$arr['token'] = $token;
$arr['token'] = $apiObj->generateToken($arr['sessionId']);
// for cross-domain ajax calls use the two lnes below
//header("content-type: application/json");
//echo $_GET['callback']. '('. json_encode($arr) . ')';
* the rights to use, copy, modify, merge, publish, distribute, sublicense, 
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
* 
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
* THE SOFTWARE.
*/
require_once '../OpenTokSDK.php';
// To download, you need a
$apiObj = new OpenTokSDK('11421872', '296cebc2fc4104cd348016667ffa2a3909ec636f', TRUE);
$sessionId = '1_MX4xNDk3MTI5Mn5-MjAxMi0wNS0yMCAwMTowMzozMS41MDEzMDArMDA6MDB-MC40NjI0MjI4MjU1MDF-';
// Make sure token has the moderator role
$token = $apiObj->generateToken($sessionId, RoleConstants::MODERATOR);
// This archiveId is generated from your javascript library after you record something
$archiveId = '5f74aee5-ab3f-421b-b124-ed2a698ee939';
// Create an archive object
$archive = $apiObj->getArchiveManifest($archiveId, $token);
$resources = $archive->getResources();
// To get all videos, loop through the resources array
$vid = $resources[0]->getId();
// $url contains the file
$url = $archive->downloadArchiveURL($vid, $token);
echo $url;
<?php

/*!
* OpenTok PHP Library v0.90.0
* http://www.tokbox.com/
*
* Copyright 2010, TokBox, Inc.
*
* Date: November 05 14:50:00 2010
*/
require_once 'OpenTokSDK.php';
$a = new OpenTokSDK(API_Config::API_KEY, API_Config::API_SECRET);
print $a->generate_token();
print "\n";
print $a->generate_token('mysession');
print "\n";
print $a->generate_token('mysession', RoleConstants::MODERATOR);
print "\n";
try {
    print $a->create_session('127.0.0.1')->getSessionId();
} catch (OpenTokException $e) {
    print $e->getMessage();
}
print "\n";
示例#17
0
}
if (!isset($myapiKey)) {
    $myapiKey = API_Config::API_KEY;
}
if (!isset($myapiSecret)) {
    $myapiSecret = API_Config::API_SECRET;
}
if (isset($iOS)) {
    $myapiKey = $iOSapikey;
    $myapiSecret = $iOSsecret;
}
if (!isset($sessionId)) {
    $res = file_get_contents("sessionid.txt") or die("can't read file");
    $res = json_decode($res, true);
    $sessionId = $res['sessionId'];
}
// Creating an OpenTok Object
$apiObj = new OpenTokSDK($myapiKey, $myapiSecret);
// Creating Simple Session object, passing IP address to determine closest production server
// Passing IP address to determine closest production server
//        e.g.   $session = $apiObj->createSession( $_SERVER["REMOTE_ADDR"] );
$session = $apiObj->createSession();
// Creating example for Simple Session object to enable p2p connections
//$session = $apiObj->createSession( $_SERVER["REMOTE_ADDR"], array(SessionPropertyConstants::P2P_PREFERENCE=> "enabled") );
// Getting sessionId from Sessions
// Option 1: Call getSessionId()
$arr = array();
$arr['apiKey'] = $myapiKey;
$arr['sessionId'] = $sessionId;
$arr['token'] = $apiObj->generateToken($sessionId, $role, $dt, $participant);
echo json_encode($arr);
示例#18
0
<?php

require_once './Opentok-PHP-SDK/API_Config.php';
require_once './Opentok-PHP-SDK/OpenTokSDK.php';
$arr = array();
// Creating an OpenTok Object
$apiObj = new OpenTokSDK(API_Config::API_KEY, API_Config::API_SECRET);
// Creating Simple Session object, passing IP address to determine closest production server
// Passing IP address to determine closest production server
//        e.g.   $session = $apiObj->createSession( $_SERVER["REMOTE_ADDR"] );
$session = $apiObj->createSession($_SERVER["REMOTE_ADDR"], array(SessionPropertyConstants::P2P_PREFERENCE => "enabled"));
// Creating example for Simple Session object to enable p2p connections
//$session = $apiObj->createSession( $_SERVER["REMOTE_ADDR"], array(SessionPropertyConstants::P2P_PREFERENCE=> "enabled") );
// Getting sessionId from Sessions
// Option 1: Call getSessionId()
$sessionId = $session->getSessionId();
$arr['sessionId'] = $sessionId;
$fname = "sessionid.txt";
file_put_contents($fname, json_encode($arr)) or die("can't write file" . $fname);
return;
// After creating a session, call generateToken(). Require parameter: SessionId
//$token = $apiObj->generateToken($sessionId);
// Giving the token a moderator role, expire time 5 days from now, and connectionData to pass to other users in the session
//$token = $apiObj->generateToken($sessionId, RoleConstants::MODERATOR, time() + (5*24*60*60), "hello world!" );
//$arr['sessionId'] = $sessionId;
//$arr['sessionId'] = "2_MX4xNDE5MTIyMn5-VGh1IERlYyAwNiAxNToyMToxOCBQU1QgMjAxMn4wLjE4MzcxMzh-";
//$arr['token'] = $token;
$arr['token'] = $apiObj->generateToken($arr['sessionId']);
$arr['apiKey'] = API_Config::API_KEY;
// for cross-domain ajax calls use the two lnes below
//header("content-type: application/json");
* OpenTok PHP Library
* http://www.tokbox.com/
*
* Copyright (c) 2011, TokBox, Inc.
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the "Software"), 
* to deal in the Software without restriction, including without limitation 
* the rights to use, copy, modify, merge, publish, distribute, sublicense, 
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
* 
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
* THE SOFTWARE.
*/
require_once '../OpenTokSDK.php';
// You must have a valid sessionId and an OpenTokSDK object
$apiObj = new OpenTokSDK('11421872', '296cebc2fc4104cd348016667ffa2a3909ec636f');
$sessionId = '1_MX4xMTQyMTg3Mn5-MjAxMi0wNi0wOCAwMTowNjo1MC40NTMxMzIrMDA6MDB-MC40OTY0OTM3NjIzMjh';
// After creating a session, call generateToken(). Require parameter: SessionId
$token = $apiObj->generateToken($sessionId);
// Giving the token a moderator role, expire time 5 days from now, and connectionData to pass to other users in the session
$token = $apiObj->generateToken($sessionId, RoleConstants::MODERATOR, time() + 5 * 24 * 60 * 60, "hello world!");
echo $token;
示例#20
0
            </div>
	<?php 
$sql = " SELECT s.time_requested,s.session_datetime,s.duration,s.title,s.description,s.question, ";
$sql .= " u.id,u.fname,u.lname ";
$sql .= " FROM sessions as s LEFT JOIN users as u ON(s.user_id = u.id) ";
$sql .= " WHERE s.exp_applied_id='" . $_SESSION['LoginUserId'] . "' and s.status='2' ";
$sql .= " and (('" . $date . "' >= s.session_datetime and '" . $date . "' <= DATE_ADD(s.session_datetime, INTERVAL s.duration MINUTE)) or (s.time_requested='1'))";
$query = mysql_query($sql) or die(mysql_error());
if ($query) {
    if (mysql_num_rows($query) > 0) {
        $field = " tokbox_id ";
        $table = " users ";
        $condition = " AND id = '" . $_SESSION['LoginUserId'] . "' ";
        $user_dt = getDetail($field, $table, $condition);
        $sessionId = $user_dt[0]['tokbox_id'];
        $apiObj = new OpenTokSDK($tokboxApi, $tokboxApiSecret);
        $tokenId = $apiObj->generate_token($sessionId, RoleConstants::PUBLISHER, null, 'exp');
        ?>
			<div id="exp_id" style="display:none;"><?php 
        echo $_SESSION['LoginUserId'];
        ?>
</div>
				<script type="text/javascript">
	
var type="exp";

var apiKey			 = "<?php 
        echo $tokboxApi;
        ?>
";
var apiSecret		 = "<?php