Forum Moderators: coopster
I'm making AJAX/PHP/MYSQL chat thing, and I need to add some IRC commands.
Unfortunately, I don't know how to make it ask:
IF $_POST['message']
is something like --> /kick *
that * refers to persons name. But I need to know how to make it notice which command is used and seperate the actual commad from the command tag.
Like if I write "/time 60" it would do the function i have arraged for this "/time" command. And it would use that "60" part as a variable in that function...
Thats pretty hard to understand, but I hope someone will get the idea I'm trying to expres :)
$_POST['message']
on white space, first thing would be your command and rest would be parameter(s)
like
$_POST['message']= "/kick Anyango"
if you split that word on space
you ll get
command=/kick
parameter=Anyango
not sure if it helps
$commandArray=split(" ",$_POST['message']);
$command=$commandArray[0];
$parameter=$commandArray[1];
now u can use those variables anywhere u want
[php.net...]