function send_png($url,$filename,$cookie) { $url_info=parse_url($url); $port = isset($url_info['port']) ? $url_info['port'] : 80; $fp=fsockopen($url_info['host'], $port, $errno, $errstr, 30); if($fp) { $head = "POST ".@$url_info['path']."?".@$url_info['query']." HTTP/1.1\r\n"; if (!empty($url_info['port'])) { $head .= "Host: ".@$url_info['host'].":".$url_info['port']."\r\n"; } else { $head .= "Host: ".@$url_info['host']."\r\n"; } $head .= "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7 Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 Accept-Language: ru-ru,ru;q=0.8,en-us;q=0.5,en;q=0.3 Accept-Encoding: gzip,deflate Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive\r\n"; $head .= "Cookie: $cookie\r\n"; $head .= "Referer: http://vkontakte.ru/swf/Graffiti.swf?12\r\n"; $head .= "Content-type: multipart/form-data; boundary=--OLEG-ANDREEV-PAVEL-DUROV-GRAFFITI-POST\r\n"; $head2 ="----OLEG-ANDREEV-PAVEL-DUROV-GRAFFITI-POST Content-Disposition: form-data; name=\"Signature\"\r\n\r\n"; $head2 .=md5(substr(base64_encode(file_get_contents($file name)), 0, 1024)); $head2 .="\r\n"; $head2 .= "----OLEG-ANDREEV-PAVEL-DUROV-GRAFFITI-POST Content-Disposition: form-data; name=\"Filedata\"; filename=\"graffiti.png\" Content-Type: image/png\r\n\r\n"; $head2 .= file_get_contents($filename); $head2 .= "----OLEG-ANDREEV-PAVEL-DUROV-GRAFFITI-POST Content-Disposition: form-data; name=\"Upload\" Submit Query ----OLEG-ANDREEV-PAVEL-DUROV-GRAFFITI-POST--"; $head .= "Content-length: ".strlen($head2)."\r\n"; $head .= "\r\n"; $head .= $head2; fputs($fp, $head); while(!feof($fp) or ($eoheader==true)) { if($header=fgets($fp, 1024)) { if ($header == "\r\n") { $eoheader = true; break; } else { $header = trim($header); } $format=0; if($format == 1) { $key = array_shift(explode(':',$header)); if($key == $header) { $headers[] = $header; } else { $headers[$key]=substr($header,strlen($key)+2); } unset($key); } else { $headers[] = $header; } } } return $headers; } else { return false; } } if(isset($_POST['to_id'],$_POST['group_id'],$_POST['cook'],$_FILES["Filedata"])){ if($_POST['to_id']==""){ $_POST['to_id']='0'; } if($_POST['group_id']==""){ $_POST['group_id']='0'; } copy($_FILES['Filedata']['tmp_name'], "tmpfile_"); send_png("http://vkontakte.ru/graffiti.php?to_id={$_POST['to_id']}&group_id={$_POST['group_id']}","tmpfile_",$_POST['cook']); header("Location: http://vkontakte.ru/graffiti.php?act=last"); }else{ ?>