New Post

Tuesday, September 11, 2012

Demo: http://lythongac.net/treo.php

<?php
#----------------------------------------------------->
# ToolName : Treo nick Yh
# Programmer : Trieu Huy hoang
# Version : 1.0
# Mysite : http://trieuhuyhoang.net
# Home : http://vnhack.us
# Date : 11/09/2012
#--------------------------

if($_GET['act']=='update')
{
$username = $_POST['username']; // Your usernameid
$password = $_POST['password']; // Your password
$consumer_key = "dj0yJmk9bUNKZlNoMXFVYUZQJmQ9WVdrOVJWSlNRa0kyTlRJbWNHbzlNVGMwTnpNNE1qYzJNZy0tJnM9Y29uc3VtZXJzZWNyZXQmeD03NQ--"; //có thể thay thế nếu muốn
$secret_key = "af4af35d2005e483e293f7afddfb2986d30f4c95"; // có thể thay thế nếu muốn
$state = 2; //0 : online //2 : busy //999 idle
$status = $_POST['status']; //Status



$header[] = 'Content-type: application/json; charset=utf-8';
function curl($url, $method = 'get', $header = null, $postdata = null, $includeheader=false, $timeout = 60)
{
$s = curl_init();
$debug = false;
curl_setopt($s,CURLOPT_URL, $url);
if ($header)
curl_setopt($s,CURLOPT_HTTPHEADER, $header);

if ($debug)
curl_setopt($s,CURLOPT_VERBOSE, TRUE);

curl_setopt($s,CURLOPT_TIMEOUT, $timeout);
curl_setopt($s,CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($s,CURLOPT_MAXREDIRS, 3);
curl_setopt($s,CURLOPT_RETURNTRANSFER, true);
curl_setopt($s,CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($s,CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($s,CURLOPT_COOKIEFILE, 'cookie.txt');

if(strtolower($method) == 'post')
{
curl_setopt($s,CURLOPT_POST, true);
curl_setopt($s,CURLOPT_POSTFIELDS, $postdata);
}
else if(strtolower($method) == 'delete')
{
curl_setopt($s,CURLOPT_CUSTOMREQUEST, 'DELETE');
}
else if(strtolower($method) == 'put')
{
curl_setopt($s,CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($s,CURLOPT_POSTFIELDS, $postdata);
}

curl_setopt($s,CURLOPT_HEADER, $includeheader);
curl_setopt($s,CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; rv:14.0) Gecko/20100101 Firefox/14.0.1');
curl_setopt($s, CURLOPT_SSL_VERIFYPEER, false);

$html = curl_exec($s);
$status = curl_getinfo($s, CURLINFO_HTTP_CODE);

curl_close($s);

return $html;
}

$url1 = 'https://login.yahoo.com/WSLogin/V1/get_auth_token';
$url1 .= '?login='.$username;
$url1 .= '&passwd='.$password;
$url1 .= '&oauth_consumer_key='.$consumer_key;
$rs = curl($url1);
$rs = trim(str_replace('RequestToken=', '', $rs));
$url = 'https://api.login.yahoo.com/oauth/v2/get_token';
$url .= '?oauth_consumer_key='.$consumer_key;
$url .= '&oauth_nonce='. uniqid(rand());
$url .= '&oauth_signature='.$secret_key.'%26';
$url .= '&oauth_signature_method=PLAINTEXT';
$url .= '&oauth_timestamp='. time();
$url .= '&oauth_token='. $rs;
$url .= '&oauth_version=1.0';
$rs1 = curl($url);
echo "<textarea>".$rs1."</textarea><br>";

if (stripos($rs1, 'oauth_token') === false)
{
$rs1;
return false;
}

//parse access token
$tmp = explode('&', $rs1);
foreach ($tmp as $row)
{
$col = explode('=', $row);
$access_token[$col[0]] = $col[1];
}

//print_r ($access_token);

//fetch_crumb url
$url2 = 'http://developer.messenger.yahooapis.com/v1/session';
$url2 .= '?oauth_consumer_key='.$consumer_key;
$url2 .= '&oauth_nonce='. uniqid(rand());
$url2 .= '&oauth_signature='.$secret_key.'%26'. $access_token['oauth_token_secret'];
$url2 .= '&oauth_signature_method=PLAINTEXT';
$url2 .= '&oauth_timestamp='. time();
$url2 .= '&oauth_token='. $access_token['oauth_token'];
$url2 .= '&oauth_version=1.0';

$rs2 = curl($url2, 'get', $header);
echo "<textarea>".$rs2."</textarea><br>";


//signon url
$url3 = 'http://developer.messenger.yahooapis.com/v1/session';
$url3 .= '?oauth_consumer_key='.$consumer_key;
$url3 .= '&oauth_nonce='. uniqid(rand());
$url3 .= '&oauth_signature='.$secret_key.'%26'. $access_token['oauth_token_secret'];
$url3 .= '&oauth_signature_method=PLAINTEXT';
$url3 .= '&oauth_timestamp='. time();
$url3 .= '&oauth_token='. $access_token['oauth_token'];
$url3 .= '&oauth_version=1.0';
$url3 .= '&notifyServerToken=1';

$postdata = '{"presenceState" : '. $state. ', "presenceMessage" : "'. $status. '"}';

$rs3 = curl($url3, 'post', $header, $postdata, true);
echo "<textarea>".$rs3."</textarea><br>";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="style.css">
<meta name="author" content="LyThongAc" />

<title>..:::Treo nick Yahoo 24h:::..</title>

<style>

</style>


</head>

<body id="index" onload="">
<div>
<form action="?act=update" method="post" name="jaja">

<table align="center">

<tr>

<td><span class="method2">UserName</span></td>

<td><input name="username" type="text" id="boton" onclick="this.select()" value="" size="40px" ></td>

</tr>

<tr>

<td><span class="method2">Password</span>

</td>

<td><input name="password" type="password" id="boton" onclick="this.select()" value="" size="40px" /> </td>

</tr>

<tr>

<td><span class="method2">Status</span>

</td>

<td><input name="status" type="text" id="boton" onclick="this.select()" value="" size="40px" /> </td>

</tr>

<tr>


<td class="titulo style1">

<span class="method2">Action</span></td>

<td>


<input name="submit" type="submit" class="button" value="Treo Nick" />
<input type="reset" class="button" value="Reset" />

</span></td>

</tr>

</table>
</div>
</form>

<br />

</center>

0 nhận xét:

Post a Comment