Chat Commands

Started on the old forum in November 2009 · view the original in the archive · old links redirect here

2 replies · 497 views · started 17 years ago · 1 min read

3 participants
blackhowk Senior · 411 posts #1

// how to set chat commands // this is a short idea-tutorial // what it's a command? // in my opinion chat command it's a way to change one or more settings in the same time with the chat writings // whay to edit settings in the same way with the chat writings? // because this is more fast like to go into cpanel or settings and sometime you need to be fast // for example you may set the theme or the refresh time for chat, send mass message to all buddyes, or to some registered users on site // personal i use this command for more than that, one example may be: i see where it's each of my buddyes(buddilist) // or u see who and where it's online and i stay in chat with the m8's

<?php
// define the command
// whay m? choose another command!
$mbc = "/m";

// define a message - this it's a test
// the message it's catched from $_POST @ of chat formular
// this $_POST contain:
// the message + command + space between the message and command
$message = "/m You Smile like a Fox!";

// make all lower 
// whay? because i want all lower - i dont like "ASDFGHhjklRbHSISmmm" chars
$ms = strtolower($message);

// extract the command if exist
$c = substr($message, 0, 2); // return "/m"

// clear message
$cm = substr($message, 3); // return "You Smile like a Fox"
// one more thing: 
// entire $_POST message contains X characters - 
// - count the space between the message and command!

if ($c == $mbc){
// here you put the command
// the command may be:
// insert into mysql,update mysql table,mysql delete, etc
// you may set the lines in chat,refresh,theme,smilies yes or no, etc
    
		
	}else{
// here you make insert into chat with the message - "You Smile like a Fox"
// all users from chat may see the insert
// the insert may be: 
// insert into chat by user the message "You Smile like a Fox"
}
?>

i wait here the ideas, criticism, etc

djdevil89 Senior · 287 posts #3

nice idea and simply explained 😀 Thanks!

foreach ($_SERVER as $server => $value)
{
echo "$server is $value<br />";
}

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close