. * * * * BE CAREFUL: Gmail/Facebook is for non commercial usage * * otherwise see cometchat.com * * * *****************************************************************************************/ $RecipeInfo['gfsjquerychat']['Version'] = '2016-04-10'; $RecipeInfo['gfsjquerychat']['Author'] = 'felie'; $_SESSION['username']=$Author; $HTMLHeaderFmt['chat'] = ' '; function jquerychat_str2file($s,$name) { //create the $name file $f = fopen($name, 'w+'); ftruncate($f, 0); fflush($f); fwrite($f,$s); fclose($f); } $loggedinrep="$FarmPubDirUrl/jquerychat/loggedin"; // to store loggedin signals $signal="$loggedinrep/$Author"; if ($_GET[action]=='logout') unlink($signal); // delete the signal file else jquerychat_str2file('',$signal); // touch the signal file Markup_e("chats", "inline", "/\\(:chats:\\)/","chats()"); // a markup to see other, providing links to open chat with another connected user function chats() { global $loggedinrep,$Author; $t=''; if ($handle = opendir($loggedinrep)) { while (false !== ($entry = readdir($handle))) { if ($entry != "." && $entry != ".." && $entry !=$Author) { if($entry->isFile() && !$entry->isDot() && (time() - $entry->getMTime() > 7200)) // 2 hours without action ? unlink($entry) else $t.="$entry\n
"; } } closedir($handle); } return "chats
$t"; } include_once("$FarmPubDirUrl/jquerychat/chat/chat.php");