Bravo List
Register
Go Back   > Bravo List > Source Code > Trackers > FreeTSP
Reply
  #1  
Old 19-12-16, 08:12
BamBam0077's Avatar
BamBam0077 BamBam0077 is offline
Support
 
Join Date: Jul 2013
P2P
Posts: 261
Default [FreeTSP] Ajax Chat
Hey guys,



First of I would like to thank my daughter & my little brother who passed away early this year due to suicide for the inspiration.
Any Haters?? Got 2 Words Start Cyphering [=



Preview:

Click the image to open in full size.


First Edit header.php:
HTML Code:
<head>         <script type='text/javascript' src='js/shout.js'></script>         <script>              function ajax() {                   var req = new XMLHttpRequest();           req.onreadystatechange = function(){                           if (req.readyState == 4 && req.status == 200) {                                  document.getElementById('chat').innerHTML = req.responseText;              }          }                   req.open('GET','chat2.php', true);          req.send();          }      setInterval(function(){ajax()},1000);   function ajax2() {                   var req = new XMLHttpRequest();           req.onreadystatechange = function(){                           if (req.readyState == 4 && req.status == 200) {                                  document.getElementById('chat2').innerHTML = req.responseText;              }          }                   req.open('GET','staffchat2.php', true);          req.send();          }      setInterval(function(){ajax2()},1000);      function showHint(str) {          var xhttp;       if (str.length == 0) {           document.getElementById("txtHint").innerHTML = ""; return; }  xhttp = new XMLHttpRequest();       xhttp.onreadystatechange = function() {  if (this.readyState == 4 && this.status == 200) {       document.getElementById("txtHint").innerHTML = this.responseText; } };  xhttp.open("GET", "gethint.php?q="+str, true); xhttp.send(); }          </script> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script type="text/javascript"> $(window).load(function() {     $(".loader").fadeOut("slow"); }) </script>      <script type="text/javascript">  var b_open = 0; var i_open = 0; var u_open = 0; var color_open = 0; var html_open = 0;  var myAgent = navigator.userAgent.toLowerCase(); var myVersion = parseInt(navigator.appVersion);  var is_ie = ((myAgent.indexOf("msie") != -1) && (myAgent.indexOf("opera") == -1)); var is_nav = ((myAgent.indexOf('mozilla') != -1) && (myAgent.indexOf('spoofer') == -1) && (myAgent.indexOf('compatible') == -1) && (myAgent.indexOf('opera') == -1) && (myAgent.indexOf('webtv') == -1) && (myAgent.indexOf('hotjava') == -1));  var is_win = ((myAgent.indexOf("win") != -1) || (myAgent.indexOf("16bit") != -1)); var is_mac = (myAgent.indexOf("mac") != -1); var bbtags = new Array();  function cstat() { var c = stacksize(bbtags);  if ((c < 1) || (c == null)) { c = 0; }  if (!bbtags[0]) { c = 0; }  document.shbox.tagcount.value = "Tags " + c; }  function stacksize(thearray) { for (i = 0; i < thearray.length; i++) { if ((thearray[i] == "") || (thearray[i] == null) || (thearray == 'undefined')) { return i; } } return thearray.length; }  function pushstack(thearray, newval) { arraysize = stacksize(thearray); thearray[arraysize] = newval; }  function popstackd(thearray) { arraysize = stacksize(thearray); theval = thearray[arraysize - 1]; return theval; }  function popstack(thearray) { arraysize = stacksize(thearray); theval = thearray[arraysize - 1];  delete thearray[arraysize - 1]; return theval; }  function closeall() { if (bbtags[0]) { while (bbtags[0]) { tagRemove = popstack(bbtags)  if ((tagRemove != 'color')) { doInsert("[/" + tagRemove + "]", "", false); eval("document.shbox." + tagRemove + ".value = ' " + tagRemove + " '"); eval(tagRemove + "_open = 0"); } else { doInsert("[/" + tagRemove + "]", "", false); }  cstat(); return; } } document.shbox.tagcount.value = "Tags 0"; bbtags = new Array(); document.shbox.shbox_text.focus(); }  function add_code(NewCode) { document.shbox.shbox_text.value += NewCode; document.shbox.shbox_text.focus(); }  function alterfont(theval, thetag) { if (theval == 0) return;  if (doInsert("[" + thetag + "=" + theval + "]", "[/" + thetag + "]", true)) pushstack(bbtags, thetag);  document.shbox.color.selectedIndex = 0; cstat(); }  function tag_url() { var FoundErrors = ''; var enterURL = prompt("You Must Register URL", "http://"); var enterTITLE = prompt("You Must Register a Title", "");  if (!enterURL || enterURL == "") { FoundErrors += " " + "You Must indicate URL,"; }  if (!enterTITLE) { FoundErrors += " " + "You Must indicate a Title"; }  if (FoundErrors) { alert("Error !" + FoundErrors); return; } doInsert("[url=" + enterURL + "]" + enterTITLE + "[/url]", "", false); }           function tag_image() { var FoundErrors = ''; var enterURL = prompt("You Must Register the URL", "http://");  if (!enterURL || enterURL == "http://") { alert("Error !" + "You Must Register URL"); return; } doInsert("[img]" + enterURL + "[/img]", "", false); }  function tag_email() { var emailAddress = prompt("You Must email", "");  if (!emailAddress) { alert("Error !" + "You Must email"); return; } doInsert("[email]" + emailAddress + "[/email]", "", false); }  function doInsert(ibTag, ibClsTag, isSingle) { var isClose = false; var obj_ta = document.shbox.shbox_text;  if ((myVersion >= 4) && is_ie && is_win) { if (obj_ta.isTextEdit) { obj_ta.focus();  var sel = document.selection; var rng = sel.createRange(); rng.colapse;  if ((sel.type == "Text" || sel.type == "None") && rng != null) { if (ibClsTag != "" && rng.text.length > 0) { ibTag += rng.text + ibClsTag; } else if (isSingle) isClose = true; rng.text = ibTag; } } else { if (isSingle) isClose = true;  obj_ta.value += ibTag; } } else { if (isSingle) isClose = true;  obj_ta.value += ibTag; } obj_ta.focus(); // obj_ta.value = obj_ta.value.replace(/ /, " "); return isClose; }  function em(theSmilie) { doInsert(" " + theSmilie + " ", "", false); }  function ShowSmilies() { var SmiliesWindow = window.open("/smilies.php", "Smilies", "") }  function ShowTags() { var TagsWindow = window.open("/tags.php", "Tags", "") }  function winop() { windop = window.open("smilies.php", "mywin", ""); }  function addText(theTag, theClsTag, isSingle, theForm) { var isClose = false; var message = theForm.shbox_text; var set = false; var old = false; var selected = "";  if (navigator.appName == "Netscape" && message.textLength >= 0) { //-- Mozilla, Firebird, Netscape --// if (theClsTag != "" && message.selectionStart != message.selectionEnd) { selected = message.value.substring(message.selectionStart, message.selectionEnd); str = theTag + selected + theClsTag; old = true; isClose = true; } else { str = theTag; }  message.focus();  start = message.selectionStart; end = message.textLength; endtext = message.value.substring(message.selectionEnd, end); starttext = message.value.substring(0, start); message.value = starttext + str + endtext; message.selectionStart = start; message.selectionEnd = start; message.selectionStart = message.selectionStart + str.length;  if (old) { return false; }  set = true;  if (isSingle) { isClose = false; } }  if ((myVersion >= 4) && is_ie && is_win) { //-- Internet Explorer --// if (message.isTextEdit) { message.focus();  var sel = document.selection; var rng = sel.createRange();  rng.colapse;  if ((sel.type == "Text" || sel.type == "None") && rng != null) { if (theClsTag != "" && rng.text.length > 0) { theTag += rng.text + theClsTag; } else if (isSingle) { isClose = true; } rng.text = theTag; } } else { if (isSingle) isClose = true;  if (!set) { message.value += theTag; } } } else { if (isSingle) isClose = true;  if (!set) { message.value += theTag; } } message.focus();  return isClose; }  function smilie(theSmilie) { addText(" " + theSmilie, "", false, document.shbox); }  function simpletag(thetag) { var tagOpen = eval(thetag + "_open"); if (tagOpen == 0) { if (doInsert("[" + thetag + "]", "[/" + thetag + "]", true)) { eval(thetag + "_open = 1"); eval("document.shbox." + thetag + ".value += '*'");  pushstack(bbtags, thetag); cstat(); } } else { lastindex = 0; for (i = 0; i < bbtags.length; i++) { if (bbtags[i] == thetag) { lastindex = i; } }  while (bbtags[lastindex]) { tagRemove = popstack(bbtags); doInsert("[/" + tagRemove + "]", "", false)  if ((tagRemove != 'COLOR')) { eval("document.shbox." + tagRemove + ".value = ' " + tagRemove + " '"); eval(tagRemove + "_open = 0"); } } cstat(); } }  function SmileIT(smile,form,text){ document.forms[form].elements[text].value = document.forms[form].elements[text].value+" "+smile+" "; document.forms[form].elements[text].focus(); }  function PopMoreSmiles(form,name) { link='moresmiles.php?form='+form+'&text='+name newWin=window.open(link,'moresmile','height=500,width=450,resizable=no,scrollbars=1'); if (window.focus) {newWin.focus()} } function PopCustomSmiles(form,name) { link='moresmilies_custom.php?form='+form+'&text='+name newWin=window.open(link,'moresmile','height=600,width=400,resizable=yes,scrollbars=1'); if (window.focus) {newWin.focus()} } function popUp(URL) { day = new Date(); id = day.getTime(); eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=740,height=380,left = 340,top = 280');"); } function private_reply(to) { parent.document.forms[0].shbox_text.value = '/private ' + to + ' '; parent.document.forms[0].shbox_text.focus(); }  function smilie(theSmilie) { addText(" " + theSmilie, "", false, document.shbox); } </script>     </head> <body onload="ajax();ajax2();">
Save As Chat.php
PHP Code:
<?php /** ************************** ** FreeTSP Version: 1.0 ** ************************** ** http://www.freetsp.info ** https://github.com/Krypto/FreeTSP ** Licence Info: GPL ** Copyright (C) 2010 FreeTSP v1.0 ** A bittorrent tracker source based on TBDev.net/tbsource/bytemonsoon. ** Project Leaders: Krypto, Fireknight. ** Project Title - Ajax Chat System [= ** Credits - https://www.udemy.com/chat-system-in-php-ajax/ ** Thanks Original Coders ** Modified By Eminem **/ require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'functions'.DIRECTORY_SEPARATOR.'function_main.php'); require_once(FUNC_DIR.'function_user.php'); require_once(FUNC_DIR.'function_vfunctions.php'); require_once(FUNC_DIR.'function_bbcode.php'); db_connect(); logged_in(); site_header("Chat"false);  /* Start Chat Functions */ function autoshout ($msg '') { $message $msg;  sql_query("INSERT INTO shoutbox (date, text) VALUES (".implode(", "array_map("sqlesc", array(time(), $message))).")") or sqlerr(__FILE____LINE__);     echo "<embed loop='false' src='sounds/chat.mp3' hidden='true' autoplay='true' />";             }  unset ($insert);  $insert false$query "";  //-- Delete Shout --// if (isset($_GET['del']) && get_user_class() >= UC_SITE_EDITOR && is_valid_id($_GET['del'])) { sql_query("DELETE FROM shoutbox WHERE id=".sqlesc($_GET['del'])); }  //-- Empty Shout - Coder/Owner --// if (isset($_GET['delall']) && get_user_class() >= UC_SYSOP) { $query = "TRUNCATE TABLE shoutbox"; }  sql_query($query); unset($query);  //-- Power Users+ Can Edit Anyones Single Shouts - pdq --// if (isset($_GET['edit']) && ($_GET['user'] == $CURUSER['id']) && ($CURUSER['class'] >= UC_USER && $CURUSER['class'] <= UC_SITE_EDITOR) && is_valid_id($_GET['edit'])) { $sql = sql_query('SELECT id, text, userid FROM shoutbox WHERE userid ='.sqlesc($_GET['user']).' AND id ='.sqlesc($_GET['edit']));  $res = mysql_fetch_array($sql);  echo "<form method='post' action='chat.php'> <input type='hidden' name='id' value='".(int) $res['id']."' /> <input type='hidden' name='user' value='".(int) $res['userid']."' /> <textarea name='text' rows='3' id='member_specialbox'>".htmlspecialchars($res['text'])."</textarea> <input type='submit' name='save' value='Save' /> </form><br /><br />"; die; }  //-- Edit Shout --// if (isset($_GET['edit']) && get_user_class() >= UC_SITE_EDITOR && is_valid_id($_GET['edit'])) { $sql = sql_query('SELECT id,text FROM shoutbox WHERE id='.sqlesc($_GET['edit']));  $res = mysql_fetch_assoc($sql); unset($sql);  echo "<form method='post' action='chat.php'> <input type='hidden' name='id' value='".(int) $res['id']."' /> <textarea name='text' rows='3' id='staff_specialbox'>".htmlspecialchars($res['text'])."</textarea> <input type='submit' name='save' value='Save' /> </form><br /><br />"; }  //-- Staff Shout Edit --// if (isset($_POST['text']) && $CURUSER['class'] >= UC_SITE_EDITOR && is_valid_id($_POST['id'])) { $text = trim($_POST['text']); $text_parsed = format_comment($text);  sql_query('UPDATE shoutbox SET text = '.sqlesc($text).', text_parsed = '.sqlesc($text_parsed).' WHERE id ='.sqlesc($_POST['id']));  unset ($text, $text_parsed); }  // Power User+ Shout Edit --// //-- Correction By Fireknight Added In theme_function.php --// if (isset($_POST['text']) && (isset($_POST['user']) == $CURUSER['id']) && ($CURUSER['class'] >= UC_USER && $CURUSER['class'] < UC_SITE_EDITOR) && is_valid_id($_POST['id'])) { $text = trim($_POST['text']); $text_parsed = format_comment($text);  sql_query('UPDATE shoutbox SET text = '.sqlesc($text).', text_parsed = '.sqlesc($text_parsed).' WHERE userid='.sqlesc($_POST['user']).' AND id='.sqlesc($_POST['id']));  unset ($text, $text_parsed); }  if ($CURUSER['shoutboxpos'] == 'no') { echo("<div class='error' align='center'><br /><font color='red'>Sorry, you are NOT Authorized to Shout.</font> (<font color='red'>Check your PMs for the reason why?</font>)<br /><br /></div></body></html>"); exit; }  /* End Chat Functions */  echo "<div style='margin-top: -20px;' class='shout_filter'><div style='margin-top: -5px;;float: left;'>Community Chat Room</div></div>      <div style='margin-top: -25px;background: #5f6364;text-align:left;width:98.8%;border: 1px solid #080808;padding:5px; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);'>"; //echo "<audio src='mp3/Eminem_SoMuchBetter.mp3' preload='auto' />"; echo "<strong>Eminem - Look, if you had one shot, or one opportunity to seize everything you ever wanted, in one moment would you capture it or just let it slip?</strong>\n<br /> <strong>Our Anthems: Eminem - When I'm Gone, Eminem - Not Afraid, Eminem - Talkin' 2 Myself, Lil Wayne Ft. Eminem - Drop The World, Lil Wayne - Paradice, Lil Wayne - No Haters</strong>         <p style='padding: 0.5em;background-color:#383838;border: 1px solid #000000; margin-top: 5px;'><font color='#1E90FF'>Member</font> <font color='#20b2aa'>Scene Member</font> <font color='#ff7c00'>Trustee</font> <font color='#ffff00'>Site Contributor</font> <font color='#B000B0'>Prite Editor</font> <font color='#339933'>Forum Moderator</font> <font color='#00FF00'>Global Moderator</font> <font color='#ff0f0f'>Administrator</font> <font color='#e13535'>Site Operator</font> <font color='#4080B0'>Team Leader</font> <!-- <font color='#ff4885'> --> <font color='#4EE2EC'><span class='glow-owner'>Web Developer</span></font> </p>  <div id='container'>"; /* echo '<div id="logoutChannelInner">         <label for="channelSelection">Chat Room:</label>         <select id="channelSelection" onchange="ajaxChat.switchChannel(this.options[this.selectedIndex].value);"><option value="Public" selected="selected">Public</option></select>         <label for="styleSelection">Style:</label>         <select id="styleSelection" onchange="ajaxChat.setActiveStyleSheet(ajaxChat.getSelectedStyle());"><option value="beige">Default</option></select>         <label for="languageSelection">Language:</label>         <select id="languageSelection" onchange="ajaxChat.switchLanguage(this.value);"><option value="en">English</option></select>         </div>'; */                      echo "<div class='chatbox'> <!--<div class='loader'></div>--><div id='chat'></div></div>";                  echo "     <div style=';'>         <form method='post' action='chat.php' name='shbox'>               <div style='margin-top: 5px;margin-left:10px;-webkit-margin-start: 10px; '>      <a class='btn' href=\"javascript: PopMoreSmiles('shbox','shbox_text')\">Smilies</a>     </div>                           <div style='margin-top: -35px;margin-left:70px;-webkit-margin-start: 72px;-webkit-margin-before: -34px;'>              <input type='button' style='font-weight: bold;font-size:9px;color: #FFF;line-height: 10px;height: 30px;' name='b' value='B' onclick='javascript: simpletag(\"b\")' /> </div>               <div style='margin-top: -35px;margin-left:112px;-webkit-margin-start: 105px;-webkit-margin-before: -34px;'> <input type='button' class='codebuttons' style='font-style: italic;font-size:10px;color: #FFF;line-height: 10px;height: 30px;' name='i' value='I' onclick='javascript: simpletag(\"i\")' /> </div>                                        <div style='margin-top: -35px;margin-left:150px;-webkit-margin-start: 138px;-webkit-margin-before: -34px;'>              <input type='button' class='codebuttons' style='text-decoration: underline;font-size:9px;color: #FFF;height: 30px;' name='u' value='U' onclick='javascript: simpletag(\"u\")' /> </div>                           <div style='margin-top: -35px;margin-left:192px;'>              <input type='button' class='codebuttons' style='font-size:10px;color: #FFF;height: 30px;' name='url' value='URL' onclick='tag_url()' /> </div>                           <div style='margin-top: -35px;margin-left:247px;'>              <input type='button' class='codebuttons' style='font-size:10px;color: #FFF;height: 30px;' name='IMG' value='IMG' onclick='javascript: tag_image()' /> </div>                           <div style='margin-top: -35px;margin-left:302px;'>              <input type='button' class='width:188' style='font-size:9px;color: #FFF;height: 30px;' onclick='javascript:closeall();' name='tagcount' value='Close Tag' /> </div>              <div style='margin-top: 5px;;'> <input class='shoutbox' type='text' name='shbox_text' size='83' onkeyup='showHint(this.value)'/><br /> <div style='margin-top: -37px;margin-left: 663px;'><input class='button' name='submit' type='submit' value='Shout' /></div> <input type='hidden' name='sent' value='yes' /></div><br />                          </form></div> </div></div> <div id='onlineusers'>"; //-- Start Users on Index - Credits Bigjoos --// $active3 = ""; $file = CACHE_DIR."active.txt"; $expire = 30; //-- 30 Seconds --//  if (file_exists($file) && filemtime($file) > (time() - $expire)) { $active3 = unserialize(file_get_contents($file)); } else { $dt = sqlesc(get_date_time(gmtime() - 180));      $active1 = sql_query("SELECT id, username, class, warned, enabled, added FROM users WHERE last_access >= $dt ORDER BY class DESC") or sqlerr(__FILE__, __LINE__);  while ($active2 = mysql_fetch_assoc($active1)) { $active3[] = $active2; }  $OUTPUT = serialize($active3); $fp = fopen($file, "w");  fputs($fp, $OUTPUT); fclose($fp); }  $activeusers = "";  if (is_array($active3)) { foreach ($active3 AS $arr) { if ($activeusers) { $activeusers .= "\n"; } $messages = ($CURUSER['id'] != $arr['id'] ? "<a target='_blank' href='sendmessage.php?receiver=".$arr['id']."'><img src='{$image_dir}mail.png' width='16' height='16' border='0' alt='PM User' title='PM User' style='vertical-align:bottom;'/></a>" : "" ); $private = ($CURUSER['id'] != $arr['id'] ? "<a href=\"javascript:private_reply('".$arr['username']."')\"><img src='{$image_dir}private-shout.png' width='16' height='16' border='0' alt='Private Shout' title='Private Shout' /></a>&nbsp;" : "");         $reply = ($CURUSER['id'] != $arr['id'] ? "<a href=\"javascript:window.top.SmileIT('[b][i]@[color=#".get_user_class_color($arr['class'])."]".htmlspecialchars($arr['username'])."[/color][/i][/b]','shbox','shbox_text')\"><img width='16' height='16' src='https://cdn3.iconfinder.com/data/icons/tango-icon-library/48/internet-group-chat-24.png' title='@Reply' alt='Reply' style='border:none;' /></a>" : "" );                  if ($messages && $private && $reply) {         $activeusers .= "<div style='text-align: left;'>&nbsp;$reply $private $messages ".format_username($arr)."</div>\n";         } else {          $activeusers .= "<div style='vertical-align: top;text-align: left;'>&nbsp;".format_username($arr)."</div>\n";             } } }  $fh = fopen(CACHE_DIR."active.txt", "r"); $string = file_get_contents(CACHE_DIR."active.txt"); $count = preg_match_all('/username/', $string, $dummy);  if (!$activeusers) { $activeusers = "Sorry - No Users Presently Active "; }  echo "<div class='chaton'>Users Online</div>"; echo $activeusers;  echo "</div></div>";                   if (isset($_POST['sent']) && $_POST['sent'] == "yes") {           /* Stops Double Post */      echo '<script type="text/javascript"> window.location.href = window.location.href; </script>';      /* Stops Double Post */  $limit = 1; $userid = $CURUSER["id"]; $date = sqlesc(time()); $text = (trim($_POST["shbox_text"])); $text_parsed = format_comment($text); $private_pattern = "/(^\/private)\s([a-zA-Z0-9]+)\s([\w\W\s]+)/";           if (preg_match($private_pattern,$text,$vars)) { $to_user = mysql_result(sql_query('SELECT id FROM users WHERE username = '.sqlesc($vars[2])),0) or exit(mysql_error());  if ($to_user != 0 && $to_user != $CURUSER['id']) { $text = $vars[2]." - ".$vars[3]; $text_parsed = format_comment($text);                   sql_query ("INSERT INTO shoutbox (userid, date, text, text_parsed,to_user) VALUES (".sqlesc($userid).", $date, ".sqlesc( $text ).",".sqlesc( $text_parsed).",".sqlesc($to_user).")") or sqlerr( __FILE__, __LINE__ ); } //print "<script type=\"text/javascript\">parent.document.forms[0].shbox_text.value='';</script>"; }      $batman = mysql_fetch_row(sql_query("SELECT userid, date FROM shoutbox ORDER by id DESC LIMIT 1 ")) or print ("First Shout or an Error"); if (empty($text) || strlen($text) == 1) { print("<div id='chatdata'>Shout can't be empty</span>");             echo "<embed loop='false' src='sounds/error.mp3' hidden='true' autoplay='true' />"; }  else { sql_query("INSERT INTO shoutbox (id, userid, date, text) VALUES ('id',".sqlesc($userid).", $date, ".sqlesc($text).")") or sqlerr(__FILE__, __LINE__);                               //echo "<embed loop='false' src='sounds/chat.mp3' hidden='true' autoplay='true' />"; // echo "<embed src='mp3/Eminem_SoMuchBetter.mp3' autoplay='true' />"; $trigger_words = array(              'Albert Einstein'=>array('He developed the general theory of relativity, one of the two pillars of modern physics (alongside quantum mechanics).'), 'Lil Wayne'=>array('Dwayne Michael Carter Jr. (born September 27, 1982), known professionally as Lil Wayne, is an American hip hop recording artist and author from New Orleans, Louisiana.'), 'Pokemon'=>array($CURUSER['username'] .' has stolen them from Prevail, Yet again!'),              'PHP'=>array('Originally created by Rasmus Lerdorf in 1994, the PHP reference implementation is now produced by The PHP Development Team. PHP originally stood for Personal Home Page, but it now stands for the recursive acronym PHP: Hypertext Preprocessor.'),              'Best Holiday Location'=>array('Australia we have friendly snakes, spiders & pokemon.'),             ) ; if(preg_match('/('.join('|',array_keys($trigger_words)).')/iU',$text,$trigger_key) && isset($trigger_words[$trigger_key[0]])) { shuffle($trigger_words[$trigger_key[0]]); $message = $trigger_words[$trigger_key[0]][0]; sleep(1); //autoshout($message);                     $text = $message; $userid = "2"; $username = "System"; $date=time(); mysql_query("INSERT INTO shoutbox (userid, username, date, text) VALUES (" . sqlesc($userid) . ", " . sqlesc($username) . ", $date, " . sqlesc($text) . ")") or sqlerr(__FILE__, __LINE__);                                }         }         }         ?>
Save As chat2.php
PHP Code:
<?php /** ************************** ** FreeTSP Version: 1.0 ** ************************** ** http://www.freetsp.info ** https://github.com/Krypto/FreeTSP ** Licence Info: GPL ** Copyright (C) 2010 FreeTSP v1.0 ** A bittorrent tracker source based on TBDev.net/tbsource/bytemonsoon. ** Project Leaders: Krypto, Fireknight. ** Project Title - Ajax Chat System [= ** Credits - https://www.udemy.com/chat-system-in-php-ajax/ ** Thanks Original Coders ** Modified By Eminem **/ require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'functions'.DIRECTORY_SEPARATOR.'function_main.php'); require_once(FUNC_DIR.'function_user.php'); require_once(FUNC_DIR.'function_vfunctions.php'); require_once(FUNC_DIR.'function_bbcode.php'); db_connect(); logged_in();      $potter sql_query("SELECT s.id, s.userid, s.date, s.text, s.to_user, u.username, u.class, u.donor, u.warned, u.avatar FROM shoutbox AS s LEFT JOIN users AS u ON s.userid=u.id ORDER BY s.date DESC LIMIT 30") or sqlerr(__FILE____LINE__);       if (mysql_num_rows($potter) == 0) {          echo "No Shouts Here"; }      else {         while ($voldemort mysql_fetch_assoc($potter)) :  $user_stuff $voldemort$user_stuff['id'] = $voldemort['userid']; $datum gmdate("d M h:i"$voldemort["date"]);                       /* Start Chat Tools */ $edit = (get_user_class() >= UC_SITE_EDITOR || ($voldemort['userid'] == $CURUSER['id']) && ($CURUSER['class'] >= UC_USER && $CURUSER['class'] <= UC_MODERATOR) ? "<a href='chat.php?edit=".$voldemort["id"]."&amp;user=".$voldemort['userid']."'><img src='{$image_dir}edit.png' width='16' height='16' border='0' alt='Edit Shout' title='Edit Shout' style='vertical-align:bottom;' /></a> " ''); $empty_shout = (get_user_class() >= UC_SYSOP "<a href='chat.php?delall' onclick=\"confirm_delete(); return false; \"><img src='{$image_dir}delete_all.png' width='16' height='16' border='0' alt='Empty Shout' title='Empty Shout' style='vertical-align:bottom;' /></a> " ""); $delete = (get_user_class() >= UC_SITE_EDITOR "<a href='chat.php?del=".$voldemort['id']."'><img src='{$image_dir}delete.png' width='16' height='16' border='0' alt='Delete Single Shout' title='Delete Single Shout' style='vertical-align:bottom;' /></a> " ""); //$messages = "<a target='_blank' href='sendmessage.php?receiver=".$voldemort['userid']."'><img src='{$image_dir}mail.png' width='16' height='16' border='0' alt='PM User' title='PM User' style='vertical-align:bottom;'/></a>"; //$reply = ($CURUSER['id'] != $voldemort['userid'] ? "<a href=\"javascript:window.top.SmileIT('[b][i]@[color=#".get_user_class_color($voldemort['class'])."]".htmlspecialchars($voldemort['username'])."[/color][/i][/b]','shbox','shbox_text')\"><img width='16' height='16' src='https://cdn3.iconfinder.com/data/icons/tango-icon-library/48/internet-group-chat-24.png' title='@Reply' alt='Reply' style='border:none;' /></a>" : "" );          //$private = ($CURUSER['id'] != $voldemort['userid'] ? "<a href=\"javascript:private_reply('".$voldemort['username']."')\"><img src='{$image_dir}private-shout.png' width='16' height='16' border='0' alt='Private Shout' title='Private Shout' /></a>&nbsp;" : "");          /* End Chat Tools */           echo "<div id='chatdata'>          <!-- Start Member Tools -->                  $edit                  <!-- End Member Tools -->";                          if ($voldemort['class'] > UC_TEAM_LEADER) : // old method if ($voldemort['class'] > UC_TEAM_LEADER) {              echo "<span class='glow-owner'>".format_username($user_stuff)."</span>";          //}              else :              // old method if ($voldemort['class'] <= UC_TEAM_LEADER) { echo "<span>".format_username($user_stuff)."</span>&nbsp;<img src='/images/reply.gif'/>&nbsp;";              //}              endif;                       echo "<span style='color: #fffff;'>".format_comment($voldemort["text"])."</span>                  <span style='float:right;'>$datum</span>                  </div>";      endwhile;         } ?>
CSS:
Code:
div.shout_filter {      font-size: 18px;     background: #444647; border-top: 1px solid #353939; border-bottom: 1px solid #2e3131; -webkit-box-shadow: inset 0 1px rgba(255, 255, 255, 0.06); box-shadow: inset 0 1px rgba(255, 255, 255, 0.06); padding: 10px 20px;     margin: -10px 0 25px; height: 15px; }  .shoutbox {     margin-left: 30px;     padding: 0 5px 0 22px;     border: 1px solid #1c252b;     height: 30px;     color: #9fa8b0;     font-size: 12px;     line-height: 30px;     font-weight: bold;     text-shadow: 1px 1px #1f272b; background: #444647; border-top: 1px solid #353939; border-bottom: 1px solid #2e3131; -webkit-box-shadow: inset 0 1px rgba(255, 255, 255, 0.06); box-shadow: inset 0 1px rgba(255, 255, 255, 0.06); }  .chatbox {  margin-top: 3px;     background-color: #212121; border: 1px solid #000000; color:#333333; width: 80%; height: 300px; overflow: auto; }  #chatdata {  background-color:#383838; color:#ababab; border: 1px solid #565656; width: 96.7%; height: auto; padding: 0.5em; margin-top: 5px; margin-left: 5px; margin-right: 5px; margin-bottom: 5px; }  #onlineusers{  padding: 0.2em;     vertical-align: top; margin-top: -394px; margin-left: 5px; margin-right: 5px; margin-bottom: 5px; border: 1px solid #000000; background-color:#383838; height: auto; width: 166px; float: right; }      .chaton {         padding: 5px 5px; background: #444647; border-top: 1px solid #353939; border-bottom: 1px solid #2e3131; -webkit-box-shadow: inset 0 1px rgba(255, 255, 255, 0.06); box-shadow: inset 0 1px rgba(255, 255, 255, 0.06);     text-align: center;     font-size: 12px; color:#D4D4D4;         }      /*-- Start Staff Edit Box --*/ #staff_specialbox { border : 1px solid gray; width : 600px; background : #FBFCFA; font : 11px verdana, sans-serif; color : #000000; padding : 3px; outline : none; } /*-- Finish Staff Edit Box --*/  /*-- Start Member Edit Box --*/ #member_specialbox { border : 1px solid gray; width : 600px; background : #FBFCFA; font : 11px verdana, sans-serif; color : #000000; padding : 3px; outline : none; } /*-- Finish Member Edit Box --*/          .loader {     left: 0px;     top: 0px;     width: 100%;     height: 100%;     z-index: 9999;     background: url(https://i.imgbox.com/aYvJUBBq.gif) 50% 50% no-repeat; /* Sonic At Work [= */     /*background: url(https://i.imgbox.com/HQEIA8sI.png) 50% 50% no-repeat; Bonkers/Bubsy */ }
also add to your menu:
HTML Code:
<li><a href='chat.php'>Chat</a></li>
Cypher Now Click the image to open in full size. Merry Christmas Guys
Reply With Quote
Reply

Tags
ajax , chat , freetsp

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT +2. The time now is 19:36. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2018, vBulletin Solutions Inc.