Bravo List
Register
Go Back   > Bravo List > Source Code > Active Trackers > Torrent Trader
Reply
  #1  
Old 1st June 2022, 12:46
BamBam0077's Avatar
BamBam0077 BamBam0077 is offline
Banned
 
Join Date: Jul 2013
P2P
Posts: 410
Red face [v1p][progessmod] promote user star badge account from guest to v
Snippets:
// promote user account from guest to v1p if userid=2
Code:
$updateflush = mysqli_query($qlconnect, "UPDATE users SET star_badge='vip' WHERE id='2' and star_badge='guest' limit 1"); // upgrade from guest badge to vip badge
return $updateflush; // updates status on badges depends how you conf your files line.
SQL
Code:
alter table users add star_badge enum('guest','newbie','sceneuser','poweruser','donor','ircdonor', 'upload','moderator','admin', 'banned') not null default 'newbie';
Click the image to open in full size.

Bump: <?php
/* everytime you refresh hopefully you obtain 00.05 auto bonus ontop of your current mybonus coins */
Code:
$updateflush = SQL_Query_exec("UPDATE users SET coins = “.$CURUSER[“coins”].”+0.05 WHERE id = ".$CURUSER["id"]."");
return $updateflush;
SQL:
Code:
--sql_file_to_obtain---
alter table users add coins decimals(8,2) not null default '10.00';
create a autoCleanup.php script so start a empty PHP script add above code an insert include('autoCleanup.php'); inside of takelogin for example or index.php other then include/cleanup.php we think

Blow zip is ranks taken from mybb just edit or create userdetails($badges);

Bump: Updated more features added class ranks colours next got an auto-generated IDs + usernames + emails + passwords function will need to overlook this code as it is still a mod in progress so though that have time to look here you go:
Code:
<?php
/*
 * @package AJAX_Chat
 * @author Sebastian Tschan
 * @copyright (c) Sebastian Tschan
 * @license Modified MIT License
 * @link https://blueimp.net/ajax/
 */
// Suppress errors:
ini_set('display_errors', 0);

 Path to the chat directory:
define('AJAX_CHAT_PATH', dirname($_SERVER['SCRIPT_FILENAME']).'/');

//require(AJAX_CHAT_PATH.'functions'.DIRECTORY_SEPARATOR.'WPConfig.php');
$dbconnection= mysqli_connect("localhost","userhost","password","databasename");

#!db_connect(); above just modded to run as mysql_query($dbconnection, 'select * from users where userid='?' set userid='44'); instead.
//>> now lets do a security for class so we can move within chatroom or page.

require(AJAX_CHAT_PATH.'include'.DIRECTORY_SEPARATOR.'class_check.php'); // so we can add,edit,remove +more
//require(AJAX_CHAT_PATH.'functions'.DIRECTORY_SEPARATOR.'user_function.php'); // class_star_badge,class_rank_color, +more
require(AJAX_CHAT_PATH.'functions'.DIRECTORY_SEPARATOR.'bbcode_functions.php'); // [bbcode]hello[/bbcode]
logged_in();
$ip=$_server["remote_addr"];
write_log("chat system, user is currently located at $ip");
site_header("Chat", false);
// /*if($row[0] == '6' || '15'){*/

// List containing the registered chat users
// Sample registered user:
/* 
$users[3] = array();
$users[3]['userRole'] = AJAX_CHAT_USER;
$users[3]['userName'] = 'user';
$users[3]['password'] = 'user';
$users[3]['channels'] = array(0,1);

kittenpaws'=>'kittenpaws'
Sample admin user:
$users[1] = array();
$users[1]['userRole'] = AJAX_CHAT_MODERATOR;
$users[1]['userName'] = 'kittenpaws';
$users[1]['password'] = 'admin';
$users[1]['channels'] = array(0,1);

//,'pizzaslice'=>'pizzaslice',
Sample admin user:
$users[1] = array();
$users[1]['userRole'] = AJAX_CHAT_PREMIUM;
$users[1]['userName'] = 'pizzaslice';
$users[1]['password'] = 'admin';
$users[1]['channels'] = array(0,1);
*/



//$userID = '01b2'; # userids for chat hack/mod to work. it should randomize userid with username every post shared.
//echo $userID;
//echo $_SERVER["REMOTE_ADDR"];
// who knows sceneaccess.org!+?
//echo $username = 'bob';

//let's begin
// AJAX Chat users parameters:
$users=array();

Define AJAX Chat user roles:
//define('AJAX_CHAT_BANNED',		6);
//define('AJAX_CHAT_CUSTOM',		5);
//define('AJAX_CHAT_ADMIN',		3);
//define('AJAX_CHAT_MODERATOR',	2);
//define('UC_USER', 0);

define('AJAX_CHAT_BANNED',		0); // demoted to banned status until autosys promotes users account to user+ when criteria is met. - 1.0 maintained, 10 forum post, obtained 1 week status since activation, ip_chec etc. my need to edit autoCleanup to tweak class status
define('AJAX_CHAT_GUEST',		1); // default account until autosys promotes users account to user+ when criteria is met. - 1.0 maintained, 10 forum post, obtained 1 week status since activation, ip_chec etc. my need to edit autoCleanup to tweak class status
define('AJAX_CHAT_CHATBOT',		2); // sys_bot account until autosys demotes or promotes account to user+ when criteria is met. - 1.0 maintained, 10 forum post, obtained 1 week status since activation, ip_chec etc. my need to edit autoCleanup to tweak class status
define('AJAX_CHAT_USER',	3); // default account until autosys promotes users account to user+ when criteria is met. - 1.0 maintained, 10 forum post, obtained 1 week status since activation, ip_chec etc. my need to edit autoCleanup to tweak class status
define('AJAX_CHAT_POWER_USER', 4); // default account until autosys promotes users account to user+ when criteria is met. - 1.0 maintained, 10 forum post, obtained 1 week status since activation, ip_chec etc. my need to edit autoCleanup to tweak class status
define('AJAX_CHAT_TRUSTEE', 6); // default account until autosys promotes users account to user+ when criteria is met. - 1.0 maintained, 10 forum post, obtained 1 week status since activation, ip_chec etc. my need to edit autoCleanup to tweak class status
define('AJAX_CHAT_UPLOADER', 6); // default account until autosys promotes users account to user+ when criteria is met. - 1.0 maintained, 10 forum post, obtained 1 week status since activation, ip_chec etc. my need to edit autoCleanup to tweak class status
define('AJAX_CHAT_VIPDONOR', 5); // default account until autosys promotes users account to user+ when criteria is met. - 1.0 maintained, 10 forum post, obtained 1 week status since activation, ip_chec etc. my need to edit autoCleanup to tweak class status
define('AJAX_CHAT_MODERATOR', 6); // default account until autosys promotes users account to user+ when criteria is met. - 1.0 maintained, 10 forum post, obtained 1 week status since activation, ip_chec etc. my need to edit autoCleanup to tweak class status
define('AJAX_CHAT_SUPER_MODERATOR', 7); // default account until autosys promotes users account to user+ when criteria is met. - 1.0 maintained, 10 forum post, obtained 1 week status since activation, ip_chec etc. my need to edit autoCleanup to tweak class status
define('AJAX_CHAT_ADMINISTRATOR', 8); // default account until autosys promotes users account to user+ when criteria is met. - 1.0 maintained, 10 forum post, obtained 1 week status since activation, ip_chec etc. my need to edit autoCleanup to tweak class status
define('AJAX_CHAT_SUPER_ADMINISTRATOR', 9); // default account until autosys promotes users account to user+ when criteria is met. - 1.0 maintained, 10 forum post, obtained 1 week status since activation, ip_chec etc. my need to edit autoCleanup to tweak class status

// AJAX Chat config parameters:
$config = array();

function get_user_icons($arr)
  {
    global $TBDEV;
     if ($arr["enabled"] == "yes") {
    
# + images for classranks beside username bob<staricon><adminshield><custombadgegoeshere> userforum_ranks +
 $banned_badge = "banned_user_icon.png";
 $pics .= $arr["banned"] == "yes" ? "<img src=\"{$TBDEV['pic_base_url']}{$banned_badge}\" alt=\"Banned Account\" border='0' style='margin-left: 2pt' />" : "";

 $guest_badge = "guest_user_icon.png";
 $pics .= $arr["guest"] == "yes" ? "<img src=\"{$TBDEV['pic_base_url']}{$guest_badge}\" alt=\"Guest Account\" border='0' style='margin-left: 2pt' />" : "";
 
 $user_badge = "user_badge.png";
 $pics .= $arr["user"] == "yes" ? "<img src=\"{$TBDEV['pic_base_url']}{$banned_badge}\" alt=\"User Account\" border='0' style='margin-left: 2pt' />" : "";

 $poweruser_badge = "poweruser_badge.png";
 $pics .= $arr["poweruser"] == "yes" ? "<img src=\"{$TBDEV['pic_base_url']}{$poweruser_badge}\" alt=\"Power Account\" border='0' style='margin-left: 2pt' />" : "";

 $uploader_badge = "uploader_badge.png";
  $pics .= $arr["uploader"] == "yes" ? "<img src=\"{$TBDEV['pic_base_url']}{$banned_badge}\" alt=\"Uploader Account\" border='0' style='margin-left: 2pt' />" : "";

 $trustee_badge = "trustee_badge.png";
  $pics .= $arr["trustee"] == "yes" ? "<img src=\"{$TBDEV['pic_base_url']}{$trustee_badge}\" alt=\"Trustee Account\" border='0' style='margin-left: 2pt' />" : "";

 $vipdonor_badge = "vipdonor_badge.png";
  $pics .= $arr["vipdonor"] == "yes" ? "<img src=\"{$TBDEV['pic_base_url']}{$vipdonor_badge}\" alt=\"V1P Account\" border='0' style='margin-left: 2pt' />" : "";

 $moderator_badge = "moderator_badge.png";
  $pics .= $arr["banned"] == "yes" ? "<img src=\"{$TBDEV['pic_base_url']}{$banned_badge}\" alt=\"Banned Account\" border='0' style='margin-left: 2pt' />" : "";

 $supermod_badge = "supermoderator_badge.png";
  $pics .= $arr["supermod"] == "yes" ? "<img src=\"{$TBDEV['pic_base_url']}{$banned_badge}\" alt=\"Banned Account\" border='0' style='margin-left: 2pt' />" : "";

 $administrator = "administrator_badge.png";
 $pics .= $arr["administrator"] == "yes" ? "<img src=\"{$TBDEV['pic_base_url']}{$banned_badge}\" alt=\"Administrator\" border='0' style='margin-left: 2pt' />" : "";
 
 $superadmin = "supermoderator_badge.png";
  $pics .= $arr["superadmin"] == "yes" ? "<img src=\"{$TBDEV['pic_base_url']}{$banned_badge}\" alt=\"Super Administrator\" border='0' style='margin-left: 2pt' />" : "";

// > end class userimage ranks

 $donorpic = "star.gif";
 $warnedpic = "warned.gif";
 $disabledpic = "disabled.gif";
 
 $pics = $arr["donor"] == "yes" ? "<img src=\"{$TBDEV['pic_base_url']}{$donorpic}\" alt='Donor' border='0' style='margin-left: 2pt;' />" : "";
 
 if ($arr["enabled"] == "yes") {
 
 $pics .= $arr["warned"] == "yes" ? "<img src=\"{$TBDEV['pic_base_url']}{$warnedpic}\" alt=\"Warned\" border='0' style='margin-left: 2pt' />" : "";
 }else{
 $pics .= "<img src=\"{$TBDEV['pic_base_url']}{$disabledpic}\" alt=\"Disabled\" border='0' $style />\n";
    return $pics;
 }
}

function get_user_class()
{
    global $CURUSER;
    return $CURUSER["class"];
}

function get_user_class_name($class)
{
  switch ($class)
  {
    case UC_USER: return "User";

    case UC_POWER_USER: return "Power User";

    case UC_VIP: return "VIP";

    case UC_UPLOADER: return "Uploader";

    case UC_MODERATOR: return "Moderator";

    case UC_ADMINISTRATOR: return "Administrator";

    case UC_SYSOP: return "SysOp";
  }
  return "";
}

function is_valid_user_class($class)
{
  return is_numeric($class) && floor($class) == $class && $class >= UC_USER && $class <= UC_SYSOP;
}

function is_valid_id($id)
{
  return is_numeric($id) && ($id > 0) && (floor($id) == $id);
}

// Default guest user (don't delete this one):
$users[0] = array();
$users[0]['userRole'] = AJAX_CHAT_GUEST;
#*https://stackoverflow.com/questions/27045057/auto-generate-username-in-php

///// Randomized userID Token ///////
//$string1="abcdefghijklmnopqrstuvwxyz";
$string2="1234567890";

$string=/*$string1.*/$string2;
$string= str_shuffle($string);
$autotoken =  substr($string,0,8); 
///////////////////////////

$users['userID'] = '$autotoken'; # autotoken should generate a userids for chat to work. so example> id=1 already taken so it should generate another number simular to 2 so in other words id= would now become 2 so it should work with every post shared. 2 become 2++ means 2 becomes 3,4,5,6 etc. if doesn't already exist inside our database.

#*https://stackoverflow.com/questions/27045057/auto-generate-username-in-php

///// Randomized userName Token ///////
$random_username="abcdefghijklmnopqrstuvwxyz";
$string=$random_username;
$string= str_shuffle($string);
$autoToken =  substr($string,0,8); 
///////////////////////////

$userName = $autoToken;

//$users[0]['password'] = null;
//$users[0]['channels'] = array(0);
//hackitwithdescretion[=
//>>msg we want sent out on autoload:
  /*'if you would like to become a team member just send a pm to xo.',*/
//so shall we begin...sql injection if needed. so lets begin
//$ifmsg = 'if you would like to become a team member just send a pm to xo.'; // botmsg to be relayed out to all within chat.

$userID = $users[0]['userID'];

$message = ""; // bot message system errors?
$msg = ""; // bot message system msg #2 maybe?
$etc = ""; // sql injection option maybe?

//-- 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='forums.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='forums.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);
}

//sql:
//alter table `shoutbox` add `ifmsg` int(8) not null default auto_increnment;

$insert_bot_message = 'if you would like to become a team member just send a pm to xo.'; // botmsg to be relayed out to all within chat.

$que '".get_date_time()."'ry = "INSERT INTO shoutbox (msgid, userid, username, date, text, message, botmsg) VALUES (NULL, '$userName, '".get_date_time()."', $defaultmessage', 'you would like to become a team member just send a pm to xo', '$insert_bot_message')";
# should have by now inserted information required to get our bot system to execute our message.
#lets try now;
SQL_Query_exec($query);
/*
while($ifmsg > 0 ){
$htmlout = "<embed loop='flase' src='chat/sounds/success.wav' hidden='true' autoplay='true' />";
print $htmlout;
} */

/*
$query = "INSERT INTO shoutbox (msgid, user, message, date, userid)

VALUES (NULL,

'$username',

'if you would like to become a team member just send a pm to xo.',

'".get_date_time()."',

'$userID')";
        SQL_Query_exec($query);
}

Sample moderator user:
$users[1] = array();
$users[1]['userRole'] = AJAX_v1pCHAT_MODRATOR;
$users[1]['userName'] = 'jane';
$users[1]['password'] = 'moderator';
$users[1]['channels'] = array(0,1);

$username2 = $users[1]['userName'];
echo $username2; // to check if works

$query = "INSERT INTO shoutbox (msgid, user, message, date, userid) VALUES (NULL, '$username2','if you would like to become a team member just send a pm to xo.', '".get_date_time()."','$userID')";
SQL_Query_exec($query);

// Sample admin user:
$users[1] = array();
$users[1]['userRole'] = AJAX_v1pCHAT_MODRATOR;
$users[1]['userName'] = 'jane';
$users[1]['password'] = 'moderator';
$users[1]['channels'] = array(0,1);

//('zoe'=>'zoe'
Sample admin user:
$users[1] = array();
$users[1]['userRole'] = AJAX_v1pCHAT_ADMIN;
$users[1]['userName'] = 'zoe';
$users[1]['password'] = 'admin';
$users[1]['channels'] = array(0,1,2,3);



//,'
'unodecks'=>'unodecks'); // systembot username list.

// Sample admin user:
$users[1] = array();
$users[1]['userRole'] = AJAX_CHAT_ADMIN;
$users[1]['userName'] = 'admin';
$users[1]['password'] = 'admin';
$users[1]['channels'] = array(0,1);

*/
?>
<?php

 * @package AJAX_Chat
 * @author Sebastian Tschan
 * @author Philip Nicolcev
 * @copyright (c) Sebastian Tschan
 * @license Modified MIT License
 * @link https://blueimp.net/ajax/
 */


// Path to the chat directory:
define('AJAX_CHAT_PATH', dirname($_SERVER['SCRIPT_FILENAME']).'/');

// Include custom libraries and initialization code:
require(AJAX_CHAT_PATH.'lib/custom.php');

// Include Class libraries:
require(AJAX_CHAT_PATH.'lib/classes.php');

// Initialize the chat:
$ajaxChat = new CustomAJAXChat();

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;
}


// >> needs to wpconfig this below its the ajax chat on one script with hopefully with above bot system

/**
**************************
** 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/
**
**/


/////////////////////////////////////////// CHAT /////////////////////////////////////////////////////////////////////////
/* 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  = "";


/* End Chat Functions */

echo "<div style='margin-top: -20px;' class='shout_filter'><div style='margin-top: -5px;margin-left: -10px;float: left;'>Community Area</div></div>
	 <div style='margin-top: -15px;background: #5f6364;text-align:left;width:97%;border-top: 1px solid #353939;border-left: 1px solid #2e3131;border-right: 1px solid #2e3131;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:5px;  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);'>";
  echo "<p style='margin-top: 5px;'><font color='#4EE2EC'><span class='glow-owner'>Eminem</span></font> <strong> - 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 />
		<font color='#4EE2EC'><span class='glow-owner'>Xzibit Feat. Eminem</span></font> - Don't Approach Me - https://www.youtube.com/watch?v=eV42a1nrGxk</span> <font color='#4EE2EC'><span class='glow-owner'>Eminem</span></font> - Like Toy Soldiers  - https://www.youtube.com/watch?v=lexLAjh8fPA
		<p style='margin-top: 5px;padding: 0.5em;background-color:#383838;border: 1px solid #000000;'><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> <font color='#4EE2EC'><span class='glow-owner'>System</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='margin-left: -10px;'>
             <form method='post' name='shbox' id='message' onsubmit='addMessage();return:false;'>

			 <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: 71px;-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: -35px;'>
             <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: 136px;-webkit-margin-before: -35px;'>
			 <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;-webkit-margin-start: 170px;-webkit-margin-before: -35px;'>
			 <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;-webkit-margin-start: 219px;-webkit-margin-before: -35px;'>
			 <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;-webkit-margin-start: 266px;-webkit-margin-before: -35px;'>
			 <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;margin-left: -20px;'>
             <input class='shoutbox' type='text' name='shbox_text' size='79' onkeyup='showHint(this.value)'/><br />
             <div style='margin-top: -37px;margin-left: 635px;-webkit-margin-start: 620px;-webkit-margin-before: -35px;'><input class='button' type='submit' value='Send' /></div>
             <input type='hidden' name='sent' value='yes' /></div><br />
			 </form></div>
        </div></div>
<div style='-webkit-margin-start: 640px;-webkit-margin-before: -389px;' 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('@[color=#".get_user_class_color($arr['class'])."]".htmlspecialchars($arr['username'])."[/color]','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 $count</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' />";
          // print "<script type=\"text/javascript\">parent.document.forms[0].shbox_text.value='';</script>";
            $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 = "7";
            $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__);



		}
		}
    }
//////////////////////////////////////////////////// END CHAT ////////////////////////////////////////////////////////////////////////////////////
?>

<?php
#save as chat2.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/
**
**/

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.lovefire, 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_SYSOP || ($voldemort['userid'] == $CURUSER['id']) && ($CURUSER['class'] >= UC_USER && $CURUSER['class'] <= UC_MODERATOR) ? "[<a href='forums.php?edit=".$voldemort["id"]."&amp;user=".$voldemort['userid']."'>E</a>] " : '');
         $empty_shout = (get_user_class() >= UC_SYSOP ? "<a href='forums.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_SYSOP  ? "<a href='forums.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('@[color=#".get_user_class_color($voldemort['class'])."]".htmlspecialchars($voldemort['username'])."[/color]','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 -->
				 <!-- End Member Tools -->
				 <span style='margin-top: -150px;margin-left: 560px;-webkit-margin-start: 545px;vertical-align: top;position: relative;'>$datum</span>";

			if ($voldemort['class'] > UC_SYSOP) :
              // old method if ($voldemort['class'] > UC_TEAM_LEADER) {
			  echo "<span style='margin-left: -625px;-webkit-margin-start: -610px;' class='glow-owner'>@".format_username($user_stuff)."</span>&nbsp;<img src='/images/reply.gif'/>";
		      //}
			 else :
			  // old method if ($voldemort['class'] <= UC_TEAM_LEADER) {
              echo "<span style='margin-left: -625px;-webkit-margin-start: -610px;'>@".format_username($user_stuff)."</span>&nbsp;<img src='/images/reply.gif'/>";
		      //}
			 endif;

		   echo "<div class='chatoutput'><span style='color: #fffff;'>".format_comment($voldemort["text"])."</span></div>
		         <span style='margin-top: 0px;margin-left: 610px;  -webkit-margin-start: 595px; vertical-align: top;position: relative;'>$edit</span>
				 </div>";
	 endwhile;
	}
?>

<?php
# now save as chat3.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/
**
**/

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.lovefire, u.explorer, u.pokemon, u.dbz, 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"]);
		 //$datum = time2string(time() - gmdate("d M h:i", $voldemort["date"])).' ago';
		 //$datum = timeAgo($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='forums.php?edit=".$voldemort["id"]."&amp;user=".$voldemort['userid']."'>E</a>] " : '');
         $empty_shout = (get_user_class() >= UC_SYSOP ? "<a href='forums.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='forums.php?del=".$voldemort['id']."'>D</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('@[color=#".get_user_class_color($voldemort['class'])."]".htmlspecialchars($voldemort['username'])."[/color]','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 -->
				 <!-- End Member Tools -->
				 <span style='margin-top: -150px;margin-left: 560px;vertical-align: top;position: relative;'>$datum</span>";

			if ($voldemort['class'] > UC_TEAM_LEADER) :
              // old method if ($voldemort['class'] > UC_TEAM_LEADER) {
			  echo "<span style='margin-left: -625px;-webkit-margin-start: -610px;' class='glow-owner'>@".format_username($user_stuff)."</span>&nbsp;<img src='/images/reply.gif'/>";
		      //}
			 else :
			  // old method if ($voldemort['class'] <= UC_TEAM_LEADER) {
              echo "<span style='margin-left: -625px;-webkit-margin-start: -610px;'>@".format_username($user_stuff)."</span>&nbsp;<img src='/images/reply.gif'/>";
		      //}
			 endif;

		   echo "<div class='chatoutput'><span style='color: #fffff;'>".format_comment($voldemort["text"])."</span></div>
		         <span style='margin-top: 0px;margin-left: 590px;  -webkit-margin-start: 595px; vertical-align: top;position: relative;'>$delete $edit</span>
				 </div>";
	 endwhile;
	}
?>
Attached Files
File Type: rar mybb_1820.rar (10.2 KB, 3 views)

Last edited by BamBam0077; 1st June 2022 at 16:18.
Reply With Quote
Reply

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 14:15. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2023, vBulletin Solutions Inc.