rendered paste body<?
header("Content-type: text/html; charset=windows-1251");
header("Expires: Thu, 01 Jan 1970 00:00:01 GMT");
header("Expires: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Pragma: no-cache");
if(is_numeric($_REQUEST['bid'])){
$curl=curl_init("http://www.vworker.com/RentACoder/misc/BidRequests/ShowBidRequest.asp?lngBidRequestId=".$_REQUEST['bid']);
curl_setopt($curl,CURLOPT_HEADER,0);
curl_setopt($curl,CURLOPT_RETURNTRANSFER,1);
curl_setopt($curl,CURLOPT_FOLLOWLOCATION,1);
$html=curl_exec($curl);
curl_close($curl);
preg_match_all("/<div class=\"KonaBody\">((.|\n)*?)<\/span><br><\/font>/",$html,$m);
$html=preg_replace("~\"/RentACoder/DotNet/WarningPage\.aspx\?Source=webpage\&ExternalUrl=(.*?)\"~","\"$1\"",$m[1][0]);
echo urldecode($html);
}else{
$url="http://www.vworker.com/RentACoder/misc/BidRequests/ShowBidRequests.asp?lngBidRequestListType=3&optSortTitle=2&lngBidRequestCategoryId=-1&txtMaxNumberOfEntriesPerPage=".($_REQUEST['action']=='get_new_bids'?20:50)."&optBidRequestPhase=2&lngSortColumn=-6&blnModeVerbose=True&optBiddingExpiration=1";
#curl work
$curl=curl_init($url);
curl_setopt($curl,CURLOPT_HEADER,0);
curl_setopt($curl,CURLOPT_RETURNTRANSFER,1);
curl_setopt($curl,CURLOPT_FOLLOWLOCATION,1);
$html=curl_exec($curl);
curl_close($curl);
preg_match_all("/<\!--icon-->(.|\n)*?<!--description-->(.|\n)*?<\/tr>/",$html,$matches);
foreach($matches[0] as $m){
preg_match_all("/<a href=\"\/RentACoder\/misc\/BidRequests\/ShowBidRequest.asp\?lngBidRequestId=(.+?)\">(.|\n)*?<b>(.*?)<\/b>/",$m,$t);
$id=$t[1][0];
$bids[$id]['id']=$id;
$bids[$id]['link']="http://www.rentacoder.com/RentACoder/misc/BidRequests/ShowBidRequest.asp?lngBidRequestId=".$id;
$bids[$id]['title']=trim(str_replace("&","&",$t[3][0]));
preg_match_all("/<a href=\"\/RentACoder\/SoftwareBuyers\/ShowBuyerInfo.asp\?lngAuthorId=(.+?)\">(.*?)<\/a>(.|\n)*?<a(.|\n)*?>(.*?)<\/a>/",$m,$t);
$bids[$id]['buyer_id']=$t[1][0];
$bids[$id]['buyer_link']="http://www.rentacoder.com/RentACoder/SoftwareBuyers/ShowBuyerInfo.asp?lngAuthorId=".$t[1][0];
$bids[$id]['buyer_name']=$t[2][0];
$bids[$id]['buyer_ratings']=$t[5][0];
preg_match_all("/<!--project type \/ categories-->(.|\n)*?<font size=\"1\">(.*?)<br>(.|\n)*?\s(\S.*?)<\/td>/",$m,$t);
$bids[$id]['type']=$t[2][0];
$bids[$id]['keywords']=$t[4][0];
preg_match_all("/Max bid: (.*?)(&|\n)/",$m,$t);
$bids[$id]['max_bid']=trim($t[1][0]);
preg_match_all('/<!--description-->(.|\n)*?<font size="2">((.|\n)*?)(<font size=1>(.|\n)*?)?<\/font><br>/',$m,$t);
$bids[$id]['desc']=strip_tags(trim($t[2][0]));
#getting the first id that is really the last id
if(!$last_id) $last_id=$id;
}
#if the script requests only new bids we output them and quit
if($_REQUEST['action']=='get_new_bids'){
echo "id".$last_id." ";
foreach($bids as $bid){
if($bid['id']!=$_REQUEST['id']) show_bid($bid);
else die;
}
die;
}
?>
<title>rac.rac</title>
<style>
*{font-family:trebuchet ms;}
div.bid{padding:5px;border-bottom:5px solid #eee;}
h1,h2{margin:0;font-weight:normal;}
h1,h1 *{font-size:15px;}
h2,h2 *{font-size:12px;color:#888;}
div.bid div{color:#000;font-size:12px;}
a.hide{float:left;text-decoration:none;font-size:13px;background:#eee;padding:0px 6px;border:1px solid #ccc;margin-right:8px;}
a.all{float:none;}
</style>
<script>
//create variables
var xmlReqArr=new Array();
var last_id=<?=$last_id;?>;
var loading_bids=false;
var lostFocus=false;
var blinkTimer=0;
function get_new_bids(){
if(loading_bids==false){
var xr_list=null;
if(window.XMLHttpRequest){xr_list=new XMLHttpRequest();}else if(window.ActiveXObject){xr_list=new ActiveXObject("Microsoft.XMLHTTP");}
xr_list.onreadystatechange=function(){
if(xr_list.readyState==4){
var rtext=xr_list.responseText;
pos=rtext.indexOf(' ');
idtext=rtext.substring(0,pos);
if(idtext.substring(0,2)=='id'){
last_id=idtext.substring(2)*1;
rtext=rtext.substr(pos);
rtext=rtext.replace(/^\s+|\s+$/g,'');
if(rtext.length>0){
document.getElementById("bids").innerHTML=rtext+document.getElementById("bids").innerHTML;
blinkTitle();
}
}
loading_bids=false;
}
};
xr_list.open("GET","rac.php?action=get_new_bids&id="+last_id,true);
xr_list.send(null);
loading_bids=true;
}
return false;
}
function loadData(div){
if(xmlReqArr[div]!='loaded'){
t=document.getElementById(div).innerHTML;
document.getElementById(div).style.color="#777";
xmlReqArr[div]=null;
if(window.XMLHttpRequest) xmlReqArr[div]=new XMLHttpRequest();
else if(window.ActiveXObject) xmlReqArr[div]=new ActiveXObject("Microsoft.XMLHTTP");
if(xmlReqArr[div]==null) return;
xmlReqArr[div].onreadystatechange=function(){
if(xmlReqArr[div].readyState==4 && xmlReqArr[div].responseText.length){
document.getElementById(div).innerHTML=xmlReqArr[div].responseText;
document.getElementById(div).style.color="#000";
xmlReqArr[div]='loaded';
}
}
}
xmlReqArr[div].open("GET","rac.php?bid="+div,true);
xmlReqArr[div].send(null);
}
function blinkTitle(){
if(lostFocus){
document.title=(document.title.substr(0,2)=="* ")?document.title.substr(2):"* "+document.title;
blinkTimer=window.setTimeout(blinkTitle,500);
}
}
function clearblink(){
if(blinkTimer) window.clearTimeout(blinkTimer);
if(document.title.substr(0,2)=="* ") document.title=document.title.substr(2);
lostFocus=false;
}
function hide(qid,id){
q=document.getElementById(qid);
d=document.getElementById(id);
if(d.style.display!='none'){
d.style.display='none';
q.innerHTML='+';
}else{
d.style.display='block';
q.innerHTML='−';
}
}
function hideall(){
divs=document.getElementById("bids").getElementsByTagName('div');
for (var i=0;i<divs.length;i++) {
if(divs[i].id.substring(0,1)=="e"){
id=divs[i].id.substring(1);
document.getElementById("e"+id).style.display='none';
document.getElementById("q"+id).innerHTML='+';
}
}
}
</script>
<body onload="setInterval(get_new_bids,10000);" onfocus="clearblink();" onblur="lostFocus=true;">
<div style='text-align:left;padding-left:7px;'><a class="all" id='q<?=$bid['id'];?>' href="javascript:hideall();">− all</a></div>
<div id="bids">
<?
foreach($bids as $bid) show_bid($bid);
?>
</div>
<?
}
function show_bid($bid){
?>
<div class="bid"><h1><a class="hide" id='q<?=$bid['id'];?>' href="javascript:hide('q<?=$bid['id'];?>','e<?=$bid['id'];?>');">−</a><a target='blank' href='<?=$bid['link'];?>'><?=$bid['title'];?></a> - <a title='<?=$bid['type'];?>'><?=$bid['max_bid'];?></a></h1><div id='e<?=$bid['id'];?>'><h2><?=$bid['keywords'];?></h2><div id='<?=$bid['id'];?>' onclick="loadData('<?=$bid['id'];?>')"><?=$bid['desc'];?></div></div></div>
<?
}