Current rate per message: +$chat_msg_per_rate MDF - don't spam";
$new = $tstamp - 60;
// if active, display them
$sc_onl = mysqli_query($conx, "SELECT username FROM accounts WHERE chat_time >= $new && chat_istyping='yes' ORDER BY username");
$l_cnt = mysqli_num_rows($sc_onl);
$onlci = mysqli_query($conx, "SELECT tstamp FROM chat ORDER BY id DESC LIMIT 1");
$cironl = mysqli_fetch_assoc($onlci);
$chatac = $cironl['tstamp'];
// selects user accounts
$slct_onl = mysqli_query($conx, "SELECT chat_istyping,uid,username,chat_time,chat_attack_hp,chat_shield_tstamp,md_verf FROM accounts ORDER BY username");
$separator = '';
while($slc_on = mysqli_fetch_array($slct_onl))
{
$online_username = $slc_on['username'];
$online_uid = $slc_on['uid'];
$online_time = $slc_on['chat_time'];
$online_verf = $slc_on['md_verf'];
$online_typing = $slc_on['chat_istyping'];
$on_chat_attack_hp = $slc_on['chat_attack_hp'];
$on_chat_shield_tstamp = $slc_on['chat_shield_tstamp'];
$usrif_q = mysqli_query($conx, "SELECT username_color,text_color FROM user_theme_colors WHERE uid='$online_uid' && theme_id='$g_themeid'");
while($usrif_r = mysqli_fetch_assoc($usrif_q)) {
$cusername_color = $usrif_r['username_color'];
$cchat_tcolor = $usrif_r['text_color'];
}
// math stuff for time ago function
$differ = time() - $online_time;
$mins = round($differ / 60);
if ($mins <= 1 && $online_typing == 'yes') {
echo "$separator";
echo "$online_username";
if (!$separator) $separator = ', ';
}
}
if($l_cnt == 1) {
echo " is typing...";
}
elseif($l_cnt >= 2) {
echo " are typing...";
}
else {
}
$chat_q = mysqli_query($conx, "SELECT id,uid,tstamp,message,pmuid,msgtype,display_name,mtype,imgurl,telegram FROM chat ORDER BY id DESC LIMIT 35");
while($chat_r = mysqli_fetch_assoc($chat_q)) {
$chat_id = $chat_r['id'];
$chat_uid = $chat_r['uid'];
$chat_tstamp = $chat_r['tstamp'];
$string = $chat_r['message'];
$pmuid = $chat_r['pmuid'];
$msg_type = $chat_r['msgtype'];
$displayname = $chat_r['display_name'];
$mtype = $chat_r['mtype'];
$c_imgurl = $chat_r['imgurl'];
$sent_telegram = $chat_r['telegram'];
// ************************ //
// *** BLOCKING SYSTEM *** //
// ************************ //
$blks = mysqli_query($conx, "SELECT blocked_uid FROM blocking WHERE uid='$u_uid' && blocked_uid='$chat_uid'");
$blkc = mysqli_num_rows($blks);
if($blkc > 0) {
$chat_uid = "286";
}
$blks = mysqli_query($conx, "SELECT blocked_uid FROM blocking WHERE blocked_uid='$u_uid' && uid='$chat_uid'");
$blkc = mysqli_num_rows($blks);
if($blkc > 0) {
$chat_uid = "286";
}
// ************************ //
// *** BLOCKING SYSTEM *** //
// ************************ //
if($chat_uid != '286') {
include("../inc/replace.php");
$usr_q = mysqli_query($conx, "SELECT username,csplit,sticker,md_verf FROM accounts WHERE uid='$chat_uid'");
while($usr_r = mysqli_fetch_assoc($usr_q)) {
$chat_username = $usr_r['username'];
$chat_sticker = $usr_r['sticker'];
$chat_csplit = $usr_r['csplit'];
$chat_md_verf = $usr_r['md_verf'];
if($chat_md_verf == 'yes') {
$verif_check = " ";
}
else {
$verif_check = "";
}
$usri_q = mysqli_query($conx, "SELECT * FROM user_theme_colors WHERE uid='$chat_uid' && theme_id='$g_themeid'");
while($usri_r = mysqli_fetch_assoc($usri_q)) {
$username_color = "#4c4c4c";
$chat_tcolor = "#4c4c4c";
$csplit1_color = "#4c4c4c";
$csplit2_color = "#4c4c4c";
$csplit3_color = "#4c4c4c";
$csplit1_name = $usri_r['csplit1_name'];
$csplit2_name = $usri_r['csplit2_name'];
$csplit3_name = $usri_r['csplit3_name'];
}
}
// whisper data
$usr_qq = mysqli_query($conx, "SELECT username,csplit,sticker,md_verf FROM accounts WHERE uid='$pmuid'");
while($usr_rr = mysqli_fetch_assoc($usr_qq)) {
$chat_usernamer = $usr_rr['username'];
$chat_csplitt = $usr_rr['csplit'];
$chat_stickerr = $usr_rr['sticker'];
$chat_md_verffffff = $usr_rr['md_verf'];
if($chat_md_verffffff == 'yes') {
$verif_checkkkkk = " ";
}
else {
$verif_checkkkkk = "";
}
$usri_qq = mysqli_query($conx, "SELECT * FROM user_theme_colors WHERE uid='$pmuid' && theme_id='$g_themeid'");
while($usri_rr = mysqli_fetch_assoc($usri_qq)) {
$username_colorr = "#4c4c4c";
$chat_tcolorr = "#4c4c4c";
$csplit1_colorr = "#4c4c4c";
$csplit2_colorr = "#4c4c4c";
$csplit3_colorr = "#4c4c4c";
$csplit1_namee = $usri_rr['csplit1_name'];
$csplit2_namee = $usri_rr['csplit2_name'];
$csplit3_namee = $usri_rr['csplit3_name'];
}
}
/* vvv IF THE CHAT MESSAGE TYPE IS A WHISPER vvvv */
if($msg_type == 'pm') {
if($chat_username == $u_username) {
if($chat_csplitt == 'on') {
if($chat_stickerr != '') {
$whisper_stickerr = "
";
}
if($chat_sticker != '') {
$whisper_sticker = "
";
}
$tochat_usernamer = " $csplit1_namee$csplit2_namee$csplit3_namee $verif_checkkkkk $whisper_stickerr";
}
else {
$tochat_usernamer = " $chat_usernamer
$verif_checkkkkk";
}
if($chat_stickerr != '') {
$whisper_stickerr = "
";
}
if($chat_sticker != '') {
$whisper_sticker = "
";
}
if($displayname == 'no') {
$chat_username = "";
$tochat_usernamer = "";
$csplit1_name = "";
$csplit2_name = "";
$csplit3_name = "";
$whisper_sticker = "";
$whisper_stickerr = "";
$verif_checkkkkk = "";
$verif_check = "";
}
echo "
| ";
if($chat_csplit == 'on') {
echo "$whisper_sticker$verif_check$csplit1_name$csplit2_name$csplit3_name";
}
else {
echo "$whisper_sticker$verif_check$chat_username";
}
echo " $tochat_usernamer |
" . $string . "
| sent "; echo timeago($chat_tstamp); echo " ago"; if($sent_telegram == 'yes') { echo " via Telegram";} echo" |
";
}
elseif($pmuid == $u_uid) {
if($chat_csplit == 'on') {
$chat_username_cspl = "
$csplit1_name$csplit2_name$csplit3_name";
}
else {
$chat_username_cspl = "
$chat_username";
}
$fromchatr_usernamer = "$chat_username_cspl $verif_check ";
if($displayname == 'no') {
$chat_username = "";
$fromchatr_usernamer = "";
}
echo "
" . $string . "
| sent "; echo timeago($chat_tstamp); echo " ago"; if($sent_telegram == 'yes') { echo " via Telegram";} echo" |
";
}
}
/* ^^^ IF THE CHAT MESSAGE TYPE IS A WHISPER ^^^ */
/* #################################################### */
/* vvv IF THE CHAT MESSAGE IS NORMAL vvvv */
else {
if($chat_username == $u_username) {
if($displayname == 'no') {
$chat_username = "";
$csplit1_name = "";
$csplit2_name = "";
$csplit3_name = "";
$verif_check = "";
}
echo "";
if($chat_csplit == 'on') {
echo $verif_check;
echo "$csplit1_name$csplit2_name$csplit3_name";
if($chat_sticker != '' && $displayname != 'no') {
echo " ";
}
}
else {
echo $verif_check;
echo $chat_username;
if($chat_sticker != '' && $displayname != 'no') {
echo " ";
}
}
echo " |
";
// if message is an image
if($mtype == 'img') {
//
// Data Saver
if($u_datasaver == 'on') {
echo "
[view image]
";
}
else {
echo "
";
}
// Data Saver
//
}
// if message is normal
else {
echo "
" . $string . "
";
}
echo "
";
if($mtype == 'img') {
echo "view image ";
echo "sent "; echo timeago($chat_tstamp); echo " ago"; if($sent_telegram == 'yes') { echo " via Telegram";} echo" |
";
}
else {
echo "sent "; echo timeago($chat_tstamp); echo " ago"; if($sent_telegram == 'yes') { echo " via Telegram";} echo" | ";
}
}
else {
if($displayname == 'no') {
$chat_username = "";
$csplit1_name = "";
$csplit2_name = "";
$csplit3_name = "";
$verif_check = "";
}
echo "";
if($chat_csplit == 'on') {
if($chat_sticker != '' && $displayname != 'no') {
echo " ";
}
echo "$csplit1_name$csplit2_name$csplit3_name";
}
else {
if($chat_sticker != '' && $displayname != 'no') {
echo " ";
}
echo $chat_username;
}
echo " " . $verif_check;
echo " |
";
// if message is an image
if($mtype == 'img') {
//
// Data Saver
if($u_datasaver == 'on') {
echo "
[view image]
";
}
else {
echo "
";
}
// Data Saver
//
}
// if message is normal
else {
echo "
" . $string . "
";
}
echo "
";
if($mtype == 'img') {
echo "view image ";
echo "sent "; echo timeago($chat_tstamp); echo " ago"; if($sent_telegram == 'yes') { echo " via Telegram";} echo" |
";
}
else {
echo "sent "; echo timeago($chat_tstamp); echo " ago"; if($sent_telegram == 'yes') { echo " via Telegram";} echo" | ";
}
}
}
/* ^^^ IF THE CHAT MESSAGE TYPE IS NORMAL ^^^ */
}
}
?>