<?php
if (eregi("MSIE",$_SERVER['HTTP_USER_AGENT'])) $MHTML=true;
else $MHTML = false;
if($MHTML){
//see http://www.w3schools.com/media/media_mimeref.asp for details about Content-type:message/rfc822
header('Content-type:message/rfc822');
}
header('Cache-Control: no-cache');
header('Cache-Control: no-store');
header('Cache-Control: private');
?>
<?php if($MHTML):?>
MIME-Version: 1.0
Content-Type: multipart/related; boundary="----=_NextPart"
------=_NextPart
Content-Location: file:///X:/
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset="us-ascii"
<?php endif ?>
<!doctype html public '-//w3c//dtd html 4.01//en' 'http://www.w3.org/tr/html4/strict.dtd'>
<html xmlns:v= "urn:schemas-microsoft-com:vml">
<head>
<title>Yahoo Avatar Viewer</title>
<?php if($MHTML) : ?>
<style>
v\:* {behavior:url(#default#VML);display:inline-block;}
body{background:url(http://l.yimg.com/us.yimg.com/i/us/yg/rl/1_0_14/images/_default/gr_outerpage.png);font:13px/1.3 Verdana;}
</style>
<?php endif ?>
<style type= "text/css">
body { font-family:Calibri,Verdana,Tahoma,Arial,'Arial Black',Helvetica,'Century Gothic','Lucida Sans Unicode',Impact,sans-serif; }
.hd {
background:#C1D6EA url("../hack/images/gsprite_mod_sky_051408.gif") repeat-x scroll 0 -430px;
border-bottom:1px solid #93B9D9;
color:#5189BD;
}
.hdtext1 {
font-size:1.2em; font-weight:bold;
}
.widget { margin-top: 1.0em; boder: 1px solid #93B9D9}
.widget p {
margin: 0.25em 0px 0.1em 0px;
}
</style>
</head>
<body>
<?php
include ('avatar.php'); // the YahooAvatarCollection class
define ('ENDL', "\r\n");
function makeBanner($yid) {
return "<h1>$yid</h1>\r\n";
}
function makeBox($title, $content) {
$r =
"<div class= \"widget\" >\r\n" .
"<div class= \"hd hdtext1\">\r\n" .
$title .
"</div>\r\n" .
$content .
"</div>\r\n" ;
return $r;
}
$message = '';
$images = NULL;
if ( isset($_POST['yid']) ) {
$yid = $_POST['yid'];
}
elseif ($_GET['yid']) {
$yid = $_GET['yid'];
}
else {
$yid = NULL;
$banner = makeBanner('No Yahoo ID');
$message = "Please enter your Yahoo ID to get your avatar images.\r\n";
}
if ( $yid != NULL ) {
$banner = makeBanner("Yahoo Avatar for ". $yid);
$avtlist = new YahooAvatarCollection($yid); // this simplifies getting the avatar data
$avtlist->exec();
if ( $avtlist->count > 0 ) {
$avatar = $avtlist->avatarKeys[$yid];
//$avatar['avtkey']
$images = $avatar['images'];
$small = $avatar['small'];
}
else {
$message = 'no avatar found';
}
}
?>
<?php echo $banner ?>
<div id= "message"> <?php if ( $message=='') echo ' '; else echo $message; ?> </div>
<div id= "images">
<?php
foreach($images as $st => $img) {
list($size, $type) = explode(',', $st);
$content = "<div style= \"color:#eeeeee\">" . $img . "</div>\r\n" ;
// handle the flash output
if ( strstr($st, ',swf') != FALSE ) {
$content .=
"<OBJECT ID= \"swf0\" classid= \"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" ".
"codebase= \"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0\" ".
"width= \"240\" height= \"360\" align= \"center\">" . ENDL .
"<PARAM name= \"allowScriptAccess\" value= \"sameDomain\"/>" . ENDL .
"<PARAM name= \"movie\" value= \"" . $img ."\"/>" . ENDL .
"<embed name= \"swf0\" height= \"360\" width= \"240\" name= \"plugin\" src= \"" .
$img .
"\" type= \"application/x-shockwave-flash\"/> <br />". ENDL .
"</OBJECT>\r\n";
}
else {
if ( $size == 'small' ) {
if ( $MHTML ) { /* IE embedded image */
$content .= "<v:shape style=3D\"width:16px;height:16px;\" ><v:imagedata src= my_jpg_image /></v:shape>";
}
else { /* firefox etc embedded image */
$content .= "<img src= \"data:image/jpg;base64,". $small ."\" /> <br />\r\n";
}
}
else { /*regular img */
$content .= '<img src= "' . $img . "\" > <br />\r\n";
}
}
echo makeBox($st, $content);
}
?>
</div>
</body>
</html>
<?php if($MHTML):?>
------=_NextPart
Content-Location: file:///X:/my_jpg_image
Content-Transfer-Encoding: base64
Content-Type: image/jpg
<?php echo $small ?>
<?php endif ?>