rendered paste body<?php
$cookie_file = "C:\\Documents and Settings\\{1337}\\Application Data\\Mozilla\\Firefox\\Profiles\\1tvofrmh.default\\cookies.txt";
function getNeedleBetween($haystack, $start, $end)
{
$schf_ptr = strpos($haystack, $start);
$echf_ptr = strpos($haystack, $end, $schf_ptr);
$chf_ptr = $schf_ptr + strlen($start);
$chf_diff = $echf_ptr - $chf_ptr;
if($chf_diff < 1)
{
return "";
}
$chf = substr($haystack, $chf_ptr, $chf_diff);
return($chf);
}
function cURLpost($url, $postvars)
{
$curl = curl_init();
global $cookie_file;
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1");
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_REFERER, $url);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
//curl_setopt($curl, CURLOPT_PROXY, 'localhost:8118');
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_HEADER, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postvars);
curl_setopt($curl, CURLOPT_COOKIEFILE, $cookie_file);
curl_setopt($curl, CURLOPT_COOKIEJAR, $cookie_file);
$result = curl_exec ($curl);
if(!$result)
{
return (0);
}
curl_close ($curl);
return($result);
}
function cURLget($url)
{
$curl = curl_init();
global $cookie_file;
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1");
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_REFERER, $url);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_POST, 0);
//curl_setopt($curl, CURLOPT_PROXY, 'localhost:8118');
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_COOKIEFILE, $cookie_file);
curl_setopt($curl, CURLOPT_COOKIEJAR, $cookie_file);
$result = curl_exec ($curl);
if(!$result)
{
return (0);
}
curl_close ($curl);
return($result);
}
function tinyurl($url)
{
$url = urlencode($url);
$submit = urlencode("Make TinyURL!");
$page = cURLpost("http://tinyurl.com/create.php", "url=$url&");
$tinyurl = getNeedleBetween($page, "<blockquote><b>http://tinyurl.com/", "</b><br><small>");
return "http://tinyurl.com/$tinyurl";
}
function XMLtime2UNIX($timestamp)
{
//example timestamp 2007-12-20T14:42:16-06:00
//note: this is only accurate to the nearest minute. doesn't compute seconds in the ret timestamp.
//date
$d1 = explode("T", $timestamp);
$d1_e = explode("-", $d1[0]);
$d_year = $d1_e[0];
$d_month = $d1_e[1];
$d_day = $d1_e[2];
//time
$d2_e = explode(":", $d1[1]);
$t_hour = $d2_e[0];
$t_minute = $d2_e[1];
return mktime($t_hour, $t_minute, 0, $d_month, $d_day, $d_year);
}
function updateNick()
{
$handle = fopen("c:\\nowplaying.xml", "r");
$data = fread($handle, filesize("c:\\nowplaying.xml"));
$title = getNeedleBetween($data, "<title>","</title>");
$artist = getNeedleBetween($data, "<artist>","</artist>");
$length = getNeedleBetween($data, "<time>","</time>");
$s_timestamp = XMLtime2UNIX(getNeedleBetween($data, "<song timestamp=\"", "\">"));
$newstatus = "(8)$title - $artist(8)";
if((time() - $s_timestamp) > ($length + 60))
{
$newstatus = "^_^";
}
$find_window = @mb_SysGetProcAddr('user32.dll','FindWindowA');
$get_window_text = @mb_SysGetProcAddr('user32.dll','GetWindowTextA');
$hWND = @mb_SysCallProc($find_window,'Valve001',0);
if($hWND > 0)
{
$malloc = @mb_SysMalloc(2048);
$window_text = @mb_SysCallProc($get_window_text,$hWND,$malloc,2048);
$window_title = @mb_SysGetString($malloc);
mt_setvar('isgaming', "1");
} else {
if(mt_getvar('isgaming') == "1")
{
mb_PSetMyStatus("AIM", ID_STATUS_ONLINE);
mb_PSetMyStatus("MSN", ID_STATUS_ONLINE);
mb_PSetMyAwayMsg("MSN", $newstatus);
}
mt_setvar('isgaming', "0");
}
if(mt_getvar('isgaming') == "1")
{
$newstatus = "Playing a game: $window_title";
mb_PSetMyStatus("AIM", ID_STATUS_AWAY);
mb_PSetMyStatus("MSN", ID_STATUS_OCCUPIED);
mb_PSetMyAwayMsg("MSN", $newstatus);
mb_PSetMyAwayMsg("AIM", $newstatus);
mt_setvar('status', $newstatus, 1);
echo($newstatus."\n");
}
elseif(mt_getvar('status') != $newstatus)
{
mb_PSetMyAwayMsg("MSN", $newstatus);
mt_setvar('status', $newstatus, 1);
echo($newstatus."\n");
}
fclose($handle);
}
function mbe_MsgIn($cid,$body,$timestamp,$known)
{
if(strip_tags($body) == "mbe_ShutDown")
{
$cid_uin = mb_CGetUIN($cid);
mb_MsgSend($cid, "Fuck you too, $cid_uin");
return 0;
}
if(substr(strip_tags($body), 0, 11) == "maketinyurl")
{
$url = substr(strip_tags($body), 11);
$tinyurl_url = tinyurl($url);
mb_MsgSend($cid, "TinyURL for $url: $tinyurl_url");
return 0;
}
if(substr(strip_tags($body), 0, 8) == "LLsearch")
{
$searchterm = urlencode(substr(strip_tags($body), 9));
$page = cURLget("http://luelinks.net/links.php?s_aw=$searchterm&mode=as&go=Search");
$first_result_tr = getNeedleBetween($page, "<tr class=\"r0\">", "</tr>");
$result = getNeedleBetween($first_result_tr, "linkme.php?l=", "\">");
if(is_numeric($result))
{
mb_MsgSend($cid, "LUElinks result for $searchterm: http://luelinks.net/linkme.php?l=$result");
} else {
mb_MsgSend($cid, "No results on LUElinks for $searchterm");
}
}
return 0;
}
function mbot_load()
{
global $status;
$status = array();
//here we'll register our handler;
mb_SelfRegister(MB_EVENT_MSG_IN,1);
mt_setvar('status', "^_^", 1);
mt_setvar('isgaming', "0", 1);
updateNick();
mb_SchReg("StatusUpdater", "*/1 * *", "updateNick", 1, 0); // update after every 1 minute (*/1 * *)
}
?>