<?
require('config_inc.php');
$id=intval($id);
$num=intval($num);
if(($num<$var["from"])or($num>$var["to"])){
$num=$var["to"];
}
$textcolor=htmlspecialchars($textcolor);
$bgcolor=htmlspecialchars($bgcolor);
$bordercolor=htmlspecialchars($bordercolor);
$query = "select max(sent_clicks) from ".$t_main." where b=1";
$result = MYSQL_QUERY($query);
$max=mysql_result($result,0,0);
@mysql_free_result($result);
$query = "select idc,links from ".$t_main.", ".$t_idm_idc." where id=".$id." and idm=id";
$result = MYSQL_QUERY($query);
while($row = mysql_fetch_array($result)){
$cat[]=$row["idc"];
}
$lin=mysql_result($result,0,"links");
$link1=explode("\n",trim($lin));
@mysql_free_result($result);
//
$query = "select distinct(id),title,sent_clicks from ".$t_main.", ".$t_w_idm_idc." where id=idm and ( ";
$klv=sizeof($cat);
$query.=" idc=".$cat[0];
for($i=1;$i<$klv;$i++){
$query.=" or idc=".$cat*;
}
$query.=" ) and id!=".$id." and b=1 and total_credits>0 ";
$result = MYSQL_QUERY($query);
$i=0;
while($row = mysql_fetch_array($result)){
$links["id"]*=$row["id"];
@$links["ratio"]*=$row["sent_clicks"]*100/$max;
$links["title"]*=$row["title"];
$links["adm"]*=0;
$i++;
}
@mysql_free_result($result);
//
$query = "select distinct(id),title from ".$t_user_adm.", ".$t_idu_idc." where id=idu and ( ";
$query.=" idc=".$cat[0];
for($j=1;$j<$klv;$j++){
$query.=" or idc=".$cat[$j];
}
$query.=" ) ";
$result = MYSQL_QUERY($query);
while($row = mysql_fetch_array($result)){
$links["id"]*=$row["id"];
@$links["ratio"]*=100;
$links["title"]*=$row["title"];
$links["adm"]*=1;
$i++;
}
@mysql_free_result($result);
//
if($men==0){
?>
document.write('<table width="<?print $width;?>" bgcolor="<?print $bgcolor;?>" border=1 cellspacing=0 cellpadding=4 bordercolor="<?print $bordercolor;?>"><tr><td align="center">');
<?
}else{
?>
document.write('<SCRIPT LANGUAGE="JavaScript"> N = (document.all) ? 0 : 1; if (N) { h=".left=";v=".top=";dS="document.";sD=""; } else{ h=".pixelLeft=";v=".pixelTop=";dS="";sD=".style"; } gifWidth=<?print $width-20;?>; gifHeight=20; vis=".visibility="; visible="visible";show="show"; hidden="hidden";hide="hide";showName=(N)?"show":"visible"; hideName=(N)?"hide":"hidden";stat=hideName;objectX="menu";primary="yes";var ob; function MD(e) { if (N) { if(e.target.name=="s") {ob = document.layers["panel"]}; X=e.x; Y=e.y; return false; } else {if (event.srcElement.name=="s") {ob = event.srcElement.parentElement.style;}X=event.offsetX; Y=event.offsetY; }} function MM(e) {if (primary=="yes"){Xcord = (!N) ? event.clientX : e.pageX;Ycord = (N) ? e.pageY : event.clientY;primary="no"; }Xcur = (!N) ? event.clientX : e.pageX;Ycur = (N) ? e.pageY : event.clientY;if(stat==hideName&&(Xcur!=Xcord||Ycur!=Ycord)){ menuShow(e);}if (ob) {if (N) {ob.moveTo((e.pageX-X), (e.pageY-Y));document.menu.left=ob.left;document.menu.top=ob.top;X1=ob.left;Y1=ob.top;} else {ob.pixelLeft = event.clientX-X + document.body.scrollLeft;ob.pixelTop = event.clientY-Y + document.body.scrollTop;menu.style.pixelLeft=ob.pixelLeft;menu.style.pixelTop=ob.pixelTop;return false;}}if (stat==showName&&N){ if (Xcur>X1&&Xcur<X1+gifWidth&&Ycur>Y1&&Ycur<Y1+gifHeight){document.captureEvents(Event.MOUSEDOWN);}else {document.releaseEvents(Event.MOUSEDOWN);}}}function MU() { ob = null;}if (N) { document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE | Event.MOUSEUP);}function menuShow(e){ Xpos = (!N) ? event.clientX-10 : e.pageX-10;Ypos = (N) ? e.pageY -10: event.clientY-10; XX=Xpos; YY=Ypos; X1=Xpos; Y1=Ypos; eval(dS + objectX + sD + h + Xpos); eval(dS + objectX + sD + v + Ypos); eval(dS+objectX+sD+vis+showName); objectX="s"; if(N){ document.panel.visibility="show"; document.panel.left=document.menu.left; document.panel.top=document.menu.top; }else {panel.style.pixelLeft=menu.style.pixelLeft; panel.style.pixelTop=menu.style.pixelTop;panel.style.visibility="visible";}stat=showName;}function menuHide(){objectX="menu"; eval(dS+objectX+sD+vis+hideName); objectX="panel"; eval(dS+objectX+sD+vis+hideName);}document.onmousedown = MD; document.onmousemove = MM; document.onmouseup = MU;</script><style type="text/css"> .cursor { cursor: hand} .xx1 { text-decoration: none}</style>');
document.write('<div id="panel" style="position:absolute;left:68px;top:54px;; width: <?print $width-20;?>px; height: 20px; z-index: 2; visibility: hidden"> <img src="<?=$path;?>/1.gif" name="s" width="<?print $width-22;?>" height="20" border="0"></div><div id="menu" style="position:absolute;left:68px;top:54px;; width: <?print $width;?>; height: 20px; z-index: 1; visibility: hidden"> <table bgcolor="<?print $bgcolor?>" bordercolor="<?print $bordercolor?>" width="<?print $width;?>" border="1" cellspacing="0" cellpadding="0"><tr class="cursor" > <td bgcolor="<?print $textcolor?>" width="<?print $width-20;?>" height="20" align="center" valign="top" ><font color="<?print $bgcolor;?>" face="<?print $font;?>" size=2><b>Top <?print $var["top"];?></b></font></td><td bgcolor="<?print $bgcolor?>" width="20" height="20" align="center" valign="top"><a href="javascript:menuHide();"><font color="<?print $textcolor;?>" face="<?print $font;?>" size=2 class="xx1"><b>X</b></font></a></td></tr><tr align="center"><td colspan="2">');
<?
}
$k=sizeof($link1);
for($j=0;$j<$k;$j++){
$str=explode("|",trim($link1[$j]));
if($str[0]==""){
break;
}
?>
document.write('<a href="<?print trim($str[0]);?>" target=_blank><font color="<?print $textcolor;?>" face="<?print $font;?>" size="<?print $fontsize;?>"><?print $str[1];?></font></a><br>');
<?
}
$klv=$i;
for($i=0;$i<$klv-1;$i++){
for($j=$i;$j<=$klv-1;$j++){
if($links["ratio"]*<$links["ratio"][$j]){
$a=$links["ratio"]*;
$links["ratio"]*=$links["ratio"][$j];
$links["ratio"][$j]=$a;
$a=$links["id"]*;
$links["id"]*=$links["id"][$j];
$links["id"][$j]=$a;
$a=$links["title"]*;
$links["title"]*=$links["title"][$j];
$links["title"][$j]=$a;
$a=$links["adm"]*;
$links["adm"]*=$links["adm"][$j];
$links["adm"][$j]=$a;
}
}
}
$size=floor($klv/$num);
$shw=0;
function rec_shw($id){
global $t_main;
$query="select date, t_sent_clicks, t_sent_shows, t_rec_clicks, t_rec_shows from ".$t_main." where id=".$id;
$result=@mysql_query($query);
$t_sent_shows=mysql_result($result,0,"t_sent_shows");
$t_rec_shows=mysql_result($result,0,"t_rec_shows");
$t_rec_clicks=mysql_result($result,0,"t_rec_clicks");
$t_sent_clicks=mysql_result($result,0,"t_sent_clicks");
$dat=mysql_result($result,0,"date");
@mysql_free_result($result);
if($dat==mktime(0,0,0,date("j"),date("m"),date("Y"))){
$query="update ".$t_main." set total_credits=total_credits-1 , rec_shows=rec_shows+1 , t_rec_shows=t_rec_shows+1 where id=".$id;
$result=@mysql_query($query);
}elseif($dat==mktime(0,0,0,date("j")-1,date("m"),date("Y"))){
$query="update ".$t_main." set total_credits=total_credits-1 , rec_shows=rec_shows+1 , t_rec_shows=1, y_rec_shows=".$t_rec_shows.",t_sent_shows=0 ,y_sent_shows=".$t_sent_shows." ,t_sent_clicks=0,y_sent_clicks=".$t_sent_clicks.",t_rec_clicks=0,y_rec_clicks=".$t_rec_clicks.", date=".(mktime(0,0,0,date("j"),date("m"),date("Y")))." where id=".$id;
$result=@mysql_query($query);
}else{
$query="update ".$t_main." set total_credits=total_credits-1 , rec_shows=rec_shows+1 , t_rec_shows=1, y_rec_shows=0,t_sent_shows=0 ,y_sent_shows=0 ,t_sent_clicks=0,y_sent_clicks=0,t_rec_clicks=0,y_rec_clicks=0, date=".(mktime(0,0,0,date("j"),date("m"),date("Y")))." where id=".$id;
$result=@mysql_query($query);
}
}
mt_srand((double)microtime()*1000000);
if($klv<=$num){
for($i=0;$i<$klv;$i++){
?>
document.write('<a href="<?print $path;?>/goframe.php?adm=<?print $links["adm"]*;?>&id=<?print $links["id"]*;?>&ids=<?print $id;?>" target=_blank><font color="<?print $textcolor;?>" face="<?print $font;?>" size="<?print $fontsize;?>"><?print $links["title"]*;$old*=$j;?></font></a><br>');
<?
$shw++;
if($links["adm"]*==0){
rec_shw($links["id"]*);
}
}
}else{
for($i=1;$i<$num;$i++){
if($size!=1){
if($i==1){
$j=mt_rand(0,($i*$size)-1);
}else{
do{
$j=mt_rand(0,($i*$size)-1);
}while(in_array($j,$old));
}
?>
document.write('<a href="<?print $path;?>/goframe.php?adm=<?print $links["adm"][$j];?>&id=<?print $links["id"][$j];?>&ids=<?print $id;?>" target=_blank><font color="<?print $textcolor;?>" face="<?print $font;?>" size="<?print $fontsize;?>"><?print $links["title"][$j];$old*=$j;?></font></a><br>');
<?
$shw++;
if($links["adm"][$j]==0){
rec_shw($links["id"][$j]);
}
}else{
if($i==1){
$j=mt_rand(0,$klv-1);
}else{
do{
$j=mt_rand(0,$klv-1);
}while(in_array($j,$old));
}
?>
document.write('<a href="<?print $path;?>/goframe.php?adm=<?print $links["adm"][$j];?>&id=<?print $links["id"][$j];?>&ids=<?print $id;?>" target=_blank><font color="<?print $textcolor;?>" face="<?print $font;?>" size="<?print $fontsize;?>"><?print $links["title"][$j];$old*=$j;?></font></a><br>');
<?
$shw++;
if($links["adm"][$j]==0){
rec_shw($links["id"][$j]);
}
}
}
do{
$j=mt_rand(0,$klv-1);
}while(in_array($j,$old));
?>
document.write('<a href="<?print $path;?>/goframe.php?adm=<?print $links["adm"][$j];?>&id=<?print $links["id"][$j];?>&ids=<?print $id;?>" target=_blank><font color="<?print $textcolor;?>" face="<?print $font;?>" size="<?print $fontsize;?>"><?print $links["title"][$j];?></font></a><br>');
<?
$shw++;
if($links["adm"][$j]==0){
rec_shw($links["id"][$j]);
}
}
?>
document.write('<a href="<?print $path;?>/add.php?own=<?print $id;?>" target=_blank><b><font color="<?print $textcolor;?>" face="<?print $font;?>" size="<?print $fontsize;?>">Add your link</font></b></a></td></tr></table>');
<?
if($men!=0){
?>
document.write('</td></tr></table></div>');
<?
}
$query="select date, t_sent_clicks, t_sent_shows, t_rec_clicks, t_rec_shows from ".$t_main." where id=".$id;
$result=@mysql_query($query);
$t_sent_shows=mysql_result($result,0,"t_sent_shows");
$t_rec_shows=mysql_result($result,0,"t_rec_shows");
$t_rec_clicks=mysql_result($result,0,"t_rec_clicks");
$t_sent_clicks=mysql_result($result,0,"t_sent_clicks");
$dat=mysql_result($result,0,"date");
@mysql_free_result($result);
if($dat==mktime(0,0,0,date("j"),date("m"),date("Y"))){
$query="update ".$t_main." set unsafe_credits=unsafe_credits+".$shw." , sent_shows=sent_shows+".$shw." , t_sent_shows=t_sent_shows+".$shw." where id=".$id;
$result=@mysql_query($query);
}elseif($dat==mktime(0,0,0,date("j")-1,date("m"),date("Y"))){
$query="update ".$t_main." set unsafe_credits=unsafe_credits+".$shw." , sent_shows=sent_shows+".$shw." , t_sent_shows=".$shw.", y_sent_shows=".$t_sent_shows." ,t_rec_shows=0 , y_rec_shows=".$t_rec_shows.",t_rec_clicks=0,y_rec_clicks=".$t_rec_clicks.",y_sent_clicks=".$t_sent_clicks.",t_sent_clicks=0, date=".(mktime(0,0,0,date("j"),date("m"),date("Y")))." where id=".$id;
$result=@mysql_query($query);
}else{
$query="update ".$t_main." set unsafe_credits=unsafe_credits+".$shw." , sent_shows=sent_shows+".$shw." , t_sent_shows=".$shw.", y_sent_shows=0 ,t_rec_shows=0 , y_rec_shows=0,t_rec_clicks=0,y_rec_clicks=0 ,y_sent_clicks=0,t_sent_clicks=0, date=".(mktime(0,0,0,date("j"),date("m"),date("Y")))." where id=".$id;
$result=@mysql_query($query);
}
?>
Allora, questo è il codice che dovrebbe generare un blocco di link per un mio scambi link ... ma da errore : http://scambiolink.webmasterutility.net/script.php?id=18&width=100&men=1&bgcolor=FFFFFF&fontsize=2&textcolor=000000&bordercolor=000000&num=5&font=Arial, Helvetica, sans-serif
anche se metto in una pagina <script language=javascript src="http://scambiolink.webmasterutility.net/script.php?id=18&width=100&men=1&bgcolor=FFFFFF&fontsize=2&textcolor=000000&bordercolor=000000&num=5&font=Arial, Helvetica, sans-serif"></script> che dovrebbe far visualizzare il blocco non funziona!
E' Urgentissimo, aiuto please