bot.im php script
After 6 months of no php coding at all, yesterday I’ve made a little script for a bot for twitter, jabber, yahoo messenger and other services using bot.im.The script is pretty simple, responds to some commands and also uses the exec()
php command.
And here’s the script:
<?php
//simple php script for bot.im
//created by otzy_007(Andrei G.) http://oprod.net
//the message from the user
$msg = strtolower($_REQUEST["msg"]);
$part = explode("(", $msg);
//if there's an exec command execute it
//example: exec(whoami), exec(ps), exec(uptime)
if($part[0]=='exec'){
$part[1]=rtrim($part[1], ")");
echo exec($part[1]);
}
//else execute the other commands
else
{
switch($msg)
{
case "date":
echo date("D M j G:i:s T Y");
break;
case "hello":
echo "Hi!";
break;
case "user":
echo $_REQUEST['user'];
break;
case "help":
help();
break;
default:
echo "For a list of avaible commands enter help";
break;
}
}
function help(){
echo "Avaible commands: help, date, hello, exec(\"command\") without quotes";
}
?>
Download: http://oprod.net/index.php/downloads/category/8-php?download=17%3Abot.im-script