File: /home/httpd/html/tubeshemale.com/public_html/includes/inc.chat.php
<?
@session_start();
@include_once('../admin/db.php');
if(!$_SESSION[userid]) { header("Location: $basehttp/index.php"); exit(); }
?>
<div id="chatbox"><?php
if(file_exists("$cache_path/chat/log.html") && filesize("$cache_path/chat/log.html") > 0){
$handle = fopen("$cache_path/chat/log.html", "r");
$contents = fread($handle, filesize("$cache_path/chat/log.html"));
fclose($handle);
echo $contents;
}
?>
</div>
<form name="message" action="">
<input name="usermsg" type="text" id="usermsg" size="63" />
<input name="submitmsg" type="submit" id="submitmsg" value="Send" />
</form>
<script type="text/javascript">
// jQuery Document
$(document).ready(function(){
//If user submits the form
$("#submitmsg").click(function(){
var clientmsg = $("#usermsg").val();
$.post("<? echo $basehttp; ?>/process/process.post_chat.php", {text: clientmsg});
$("#usermsg").attr("value", "");
return false;
});
function loadLog(){
var oldscrollHeight = $("#chatbox").attr("scrollHeight") - 20;
$.ajax({
url: "<? echo $basehttp; ?>/cache/chat/log.html",
cache: false,
success: function(html){
$("#chatbox").html(html);
var newscrollHeight = $("#chatbox").attr("scrollHeight") - 20;
if(newscrollHeight > oldscrollHeight){
$("#chatbox").animate({ scrollTop: newscrollHeight }, 'normal');
}
},
});
}
setInterval (loadLog, 2000);
});
</script>