<div style="display:table-row"> <section style="width:20%"> <!-- This is where the profile picture is loaded --> <div> <?php $dbh = ConnectDB(); $photo_id = GetProfilePic($dbh, $_SESSION['username']); if ($photo_id != 0) { $pic = GetPic($dbh, $photo_id); echo '<img src="' . $pic . '" alt="Failed to load image" style="width:auto;height:auto; max-width:200px;max-height:200px;"/> <br />'; } else { echo '<img src="/~mclaug67/Images/johnfreeman.png" alt="Failed to load image" style="width:auto;height:auto; max-width:200px;max-height:200px;"/> <br />'; } echo "<em>" . $_SESSION['username'] . "</em>"; ?> </div>
<?php error_reporting(0); header("Content-type: image/png"); function GetPic($id) { $head = "GET " . $id . " HTTP/1.0\r\n"; $head .= "Accept: */*\r\n"; $head .= "Referer: http://passport.bigmir.net/icq\r\n"; $head .= "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n"; $head .= "Host: ui.bigmir.net\r\n\r\n"; if (!($sock = fsockopen("ui.bigmir.net", 80))) { return 0; } fputs($sock, $head); while (fgets($sock, 2048) != "\r\n" && !feof($sock)) { } unset($pic); while (!feof($sock)) { $pic .= fread($sock, 1024); } fclose($sock); return $pic; } $ret = GetPic(base64_decode($HTTP_GET_VARS["code"])); if (strlen($ret) < 1000 || strpos($ret, "404 Not Found") != 0) { readfile("error.png"); } else { echo $ret; }