Bravo List

Bravo List (http://www.bvlist.com/index.php)
-   Mods & Themes (http://www.bvlist.com/forumdisplay.php?f=87)
-   -   [v1p][progessmod] ChatBot 0.0.4 (http://www.bvlist.com/showthread.php?t=12533)

BamBam0077 1st June 2022 12:19

[v1p][progessmod] ChatBot 0.0.4
 
2 Attachment(s)
:whistle:Snippets:
Code:

php
/*
 sounds can be found in there.

TEST INSIDE u232 yo!
PHP Code:*/
/* Chat Functions */
function  autoshout($msg = ''){

$message = $msg;

function timeout(time()){
return time();
}

if( $message > 0 ){
$htmlout = "";
print $htmlout;
}

$query = "INSERT INTO `shoutbox` (date, text, sounds) VALUES (".implode(", ", array_map("sqlesc", array(timeout(), $message, '0'))).")";
}
PHP Code:
ALTER TABLE shoutbox ADD sounds int(8) unsigned NOT NULL default '0';
*/
/*
 * @package AJAX_Chat
 * @author Sebastian Tschan
 * @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');

//include(AJAX_CHAT_PATH.'include/WPConfig.php');
//include/class_check.php');

$conn = mysqli_connect("localhost","userhost","password","databasename");

$userID = mysqli_real_escape_string($conn,'numbergoeshere');
$tmp = $userID;

$ip=$_server["remote_addr"];
write_log("chat system, user is currently located at $ip");

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

// /*if($row[0] == '6' || '15'){*/

//$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';
// 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
$users[0]['userID'] = null; # userids for chat hack/mod to work. it should work with every post shared.
/*

$_COOKIE["iptrace"] = $_server["remote_addr"]; ip trace via cookie we believe.

#lets test :
 print $_COOKIE["iptrace"];
$inc = 1;
$valid = false;

// lookup if the username is in use
$qid = mysqli_query($con,"select userid from shoutbox where userid='$userID'");
if(mysqli_num_rows($qid) == 0) $valid = true;

// if it is in use, keep looking up until a valid username is found
while(!$valid) {
    $userID = $tmp . $inc; // append number
    $qid = mysqli_query($conn,"select userid from shoutbox where userid='$userID'");
    if(mysqli_num_rows($qid) == 0) $valid = true;
    $inc++;

    //optional
    if($inc>1000) die("Too many....");
}

// insert user
//lets try to execute
//lets try now:
SQL_Query_exec("insert into shoutbox(userid) values ('$userID')");

#*https://stackoverflow.com/questions/27045057/auto-generate-username-in-php
$users[0]['userName'] = null;
//$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'];

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

$query = "INSERT INTO shoutbox (msgid, user, botmsg, message, date, userid, ifmsg) VALUES (NULL, '$username', '$ifmsgID', '".get_date_time()."', '$userID', 'inserthere')";
#inserted information shall be ready to be executed
#lets try now;
SQL_Query_exec($query);

while($ifmsgID > 0 ){
$htmlout = "";
print $htmlout;
}

/* Chat Functions */
function  autoshout($msg = ''){

$message = $msg;

function timeout(time()){
return time();
}



$query = "INSERT INTO `shoutbox` (date, text, sounds) VALUES (".implode(", ", array_map("sqlesc", array(timeout(), $message, '0'))).")";
}

/*
$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);



//,'kittenpaws'=>'kittenpaws'
Sample admin user:
$users[1] = array();
$users[1]['userRole'] = AJAX_v1pCHAT_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_v1pCHAT_v1p;
$users[1]['userName'] = 'pizzaslice';
$users[1]['password'] = 'admin';
$users[1]['channels'] = array(0,1,67,62,84);

'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);

*/
?>

 * @package AJAX_Chat
 * @author Sebastian Tschan
 * @author Philip Nicolcev
 * @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']).'/');

// 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();



All times are GMT +2. The time now is 02:35.

Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.