本文整理汇总了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();
}
}
示例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']])) {
示例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");
示例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}"];
示例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") {