本文整理匯總了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") {