dA Authtoken viewer. (useful for dAmn IRC /PASS requests!) | Source
';
//echo 'Input format: http://'.$_SERVER["SERVER_NAME"].$_SERVER["SCRIPT_NAME"].'?user=user&pass=password
';
if($login_name != '' && $password != '')
{
$base_url = 'https://www.deviantart.com/users/login?';
$args = 'username='.urlencode($login_name).'&password='.urlencode($password).'&reusetoken=1';
$live_url = $base_url.$args;
$starttime=time();
$dir = 'cookies/';
$tempcookie=$dir.$login_name."_".$starttime.".txt";
echo 'Creating temporary cookie file..Done
';
$fp = fopen("$tempcookie","w") or die("
Unable to open cookie file $tempcookie for write!
");
fwrite($fp, date('r', time()));
fclose($fp);
echo 'Initialising CURL connection to: '.$base_url.' ..Done
';
$ch= curl_init();
curl_setopt($ch, CURLOPT_URL,$live_url);
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable
curl_setopt($ch, CURLOPT_TIMEOUT, 3); // times out after 4s
curl_setopt($ch, CURLOPT_POST, 1); // set POST method
curl_setopt($ch, CURLOPT_POSTFIELDS, $args);
curl_setopt($ch, CURLOPT_HEADER,1); // return header with output
curl_setopt($ch, CURLOPT_COOKIEJAR, "$tempcookie");
curl_setopt($ch, CURLOPT_COOKIEFILE, '');
$result = curl_exec($ch);
curl_close($ch);
$cookie = file_get_contents($tempcookie);
echo 'Retrieving cookie from temp file..Done
';
preg_match("/[[:alpha:][:space:]]*userinfo\s+(\"?)([^\s]+)\\1\s*$/mi", $cookie, $match);
echo 'Matching cookie data to supplied user information..Done
';
$cookie = unserialize(urldecode($match[2]));
echo "Fetching 'authtoken' from cookie data..Done
";
echo 'Parsing authtoken:
';
if($cookie['authtoken'] != '')
{
echo ''.$cookie['authtoken'].'
';
}
else
{
echo 'No authtoken could be fetched! You are probably using the wrong username/password combination.
';
}
echo 'Deleting all temp cookie data.. Finished!';
exec('unlink '.$tempcookie);
}
else
{
?>
This information will not be saved!