当前位置: 首页>>代码示例>>PHP>>正文


PHP startChatSession函数代码示例

本文整理汇总了PHP中startChatSession函数的典型用法代码示例。如果您正苦于以下问题:PHP startChatSession函数的具体用法?PHP startChatSession怎么用?PHP startChatSession使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了startChatSession函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: init

 public function init()
 {
     define('DBPATH', 'localhost');
     define('DBUSER', 'root');
     define('DBPASS', 'root');
     define('DBNAME', 'bdpinos');
     // session_start();
     global $dbh;
     $dbh = mysql_connect(DBPATH, DBUSER, DBPASS);
     mysql_selectdb(DBNAME, $dbh);
     if ($_GET['action'] == "chatheartbeat") {
         chatHeartbeat();
     }
     if ($_GET['action'] == "sendchat") {
         sendChat();
     }
     if ($_GET['action'] == "closechat") {
         closeChat();
     }
     if ($_GET['action'] == "startchatsession") {
         startChatSession();
     }
     if (!isset($_SESSION['chatHistory'])) {
         $_SESSION['chatHistory'] = array();
     }
     if (!isset($_SESSION['openChatBoxes'])) {
         $_SESSION['openChatBoxes'] = array();
     }
 }
开发者ID:renzot23,项目名称:Los-Pinos-Virtual,代码行数:29,代码来源:Chat.php

示例2: define

define('DBNAME', 'chat');
session_start();
global $dbh;
$dbh = mysql_connect(DBPATH, DBUSER, DBPASS);
mysql_selectdb(DBNAME, $dbh);
if ($_GET['action'] == "chatheartbeat") {
    chatHeartbeat();
}
if ($_GET['action'] == "sendchat") {
    sendChat();
}
if ($_GET['action'] == "closechat") {
    closeChat();
}
if ($_GET['action'] == "startchatsession") {
    startChatSession();
}
if (!isset($_SESSION['chatHistory'])) {
    $_SESSION['chatHistory'] = array();
}
if (!isset($_SESSION['openChatBoxes'])) {
    $_SESSION['openChatBoxes'] = array();
}
function chatHeartbeat()
{
    $sql = "select * from chat where (chat.to = '" . mysql_real_escape_string($_SESSION['username']) . "' AND recd = 0) order by id ASC";
    $query = mysql_query($sql);
    $items = '';
    $chatBoxes = array();
    while ($chat = mysql_fetch_array($query)) {
        if (!isset($_SESSION['openChatBoxes'][$chat['from']]) && isset($_SESSION['chatHistory'][$chat['from']])) {
开发者ID:eswar544,项目名称:version-in,代码行数:31,代码来源:chat.php

示例3: session_start

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.

*/
session_start();

global $dbh;

if ($_GET['action'] == "chatheartbeat") { chatHeartbeat(); } 
if ($_GET['action'] == "sendchat") { sendChat(); } 
if ($_GET['action'] == "closechat") { closeChat(); } 
if ($_GET['action'] == "startchatsession") { startChatSession(); } 

if (!isset($_SESSION['chatHistory'])) {
	$_SESSION['chatHistory'] = array();	
}

if (!isset($_SESSION['openChatBoxes'])) {
	$_SESSION['openChatBoxes'] = array();	
}

function chatHeartbeat() {
	include("../static/site_config.php"); 
	include ("../static/clase_mysql.php");
	$miconexion = new clase_mysql;
	$miconexion->conectar($db_name,$db_host, $db_user,$db_password);
	$miconexion->consulta("select * from chat where (chat.to_ = '".$_SESSION['user']."' AND recd = 0) order by id_chat ASC");  
开发者ID:jncorrea,项目名称:gop,代码行数:31,代码来源:chat.php

示例4: getOnlineUsers

$slug = Filter::text($_GET['slug']);
$project = Project::getProjectFromSlug($slug);
if ($_GET['action'] == "getonlineusers") {
    getOnlineUsers($slug);
}
if ($_GET['action'] == "chatheartbeat") {
    chatHeartbeat($slug, $pageId);
}
if ($_GET['action'] == "sendchat") {
    sendChat($pageId);
}
if ($_GET['action'] == "closechat") {
    closeChat();
}
if ($_GET['action'] == "startchatsession") {
    startChatSession($pageId);
}
if (!isset($_SESSION['chatHistory'])) {
    $_SESSION['chatHistory'] = array();
}
if (!isset($_SESSION['openChatBoxes'])) {
    $_SESSION['openChatBoxes'] = array();
}
function chatHeartbeat($slug, $pageId)
{
    //Add check for open chat boxes in order to keep track of multiple windows
    if (empty($_SESSION['openChatBoxes']["{$pageId}"])) {
        $_SESSION['openChatBoxes']["{$pageId}"] = 0;
        $lastRecord = 0;
    } else {
        $lastRecord = $_SESSION['openChatBoxes']["{$pageId}"];
开发者ID:malimu,项目名称:Pipeline,代码行数:31,代码来源:chat.php

示例5: get_username

<?php

require '../includes/init.php';
include 'chatFunctions.php';
if (check_login() == true) {
    $username = get_username();
    $enroll = get_enroll();
    $action = $_POST['action'];
    if (isset($_POST['roll'])) {
        $to_roll = mysql_real_escape_string($_POST['roll']);
    }
    if ($action == "startChatSession") {
        startChatSession($to_roll, $enroll);
    } else {
        if ($action == "sendChat") {
            $msg = $_POST['msg'];
            $to_user = mysql_real_escape_string($_POST['name']);
            $t = time() - 3;
            $sql = "SELECT NULL FROM stud_data WHERE usr_roll=" . $to_roll . " AND time>=" . $t;
            $result = mysql_query($sql);
            $count = mysql_num_rows($result);
            if ($count == 1) {
                sendChat($to_roll, $to_user, $msg, $enroll, $username);
            } else {
                echo "<root success='no'><user>" . $to_user . "</user></root>";
            }
        } else {
            if ($action == "getChat") {
                getChat($to_roll, $enroll);
            } else {
                if ($action == "setWritingStatus") {
开发者ID:ArunavhaChanda,项目名称:Breaking-Bubbles,代码行数:31,代码来源:processRequest.php


注:本文中的startChatSession函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。