📄 ads_historypic.php
字号:
<?
/**********************************
* 历史广告数据图示
* 建立:2004-12-14 qinsy
* 最后修改:2005-01-10 qinsy
***********************************/
include_once("top.php");
$sqlads="select distinct link_tit,ads.id,ads.ads_type from ads,daydata where web_user='$_SESSION[web_username]' and ads_id=ads.id and daydata.own_type=1 order by ads.id desc";
$rsads=mysql_query($sqlads);
while($rowads=mysql_fetch_array($rsads)){
$ads_id=$rowads["id"];
$arr_ads[$ads_id]=$rowads["link_tit"];
$adstype=$rowads["ads_type"];
if($adstype==3){
$arr_adstype[$ads_id]="<font color=ff3300>*</font>";
}elseif($adstype==4){
$arr_adstype[$ads_id]="<font color=99cc00>#</font>";
}
}
$start_date=$s_yy."-".$s_mm."-".$s_dd;
$over_date=$o_yy."-".$o_mm."-".$o_dd;
if($start_date=="--" || $over_date=="--"){
$datedef=date("Y-m-d",time()-3*86400);
$nowdate=date("Y-m-d",time()-86400);
$sqlf_date=" and date>='$datedef' and date<='$nowdate' ";
}else{
$sqlf_date=" and date>='$start_date' and date<='$over_date' ";
}
if(empty($adsid) || $adsid=="all"){
$sqlf_adsid="";
}else{
$sqlf_adsid=" and ads_id='$adsid'";
}
$str_disp="";
$i=0;
$sumopen=0;
$sumclick=0;
$maxnum=0;
if($adsid!="all" && !empty($adsid)){
$sql="select date,sum( open_num ) as totopen, sum( click_num ) as totclick from daydata where web_user='$_SESSION[web_username]' and own_type=1 $sqlf_date $sqlf_adsid group by date ORDER BY date";
$rs=mysql_query($sql);
while($row=mysql_fetch_array($rs)){
if($date!=$row["date"]){
$totopen=(empty($row[totopen]))?1:$row[totopen];
$rate=round($row[totclick]/$totopen*100);
$arr_disp[0][$i]=$row["date"];
$arr_disp[1][$i]=$row["totopen"];
$arr_disp[2][$i]=$row["totclick"];
$arr_disp[3][$i]=$rate;
$i++;
if($row["totopen"]>$maxnum){
$maxnum=$row["totopen"];
}
if($row["totclick"]>$maxnum){
$maxnum=$row["totclick"];
}
$sumopen=$sumopen+$row["totopen"];
$sumclick=$sumclick+$row["totclick"];
}
}
while(list($k,$v)=each($arr_disp[0])){
$aopen=$arr_disp[1][$k];
$aclick=$arr_disp[2][$k];
$rate=$arr_disp[3][$k];
if($aopen==0){
$rate=0;
}
$len_open=round($aopen/$maxnum*380);
$len_click=round($aclick/$maxnum*380);
$r_open=round($aopen/$sumopen*100);
$r_click=round($aclick/$sumclick*100);
$str_ocdata="<a href='view_ocpdata.php?adsid=$adsid&viewday=$v' target='_blank' title='点击查看 ".$v."日 点击/弹出综合图'>查看</a>";
$str_disp.="
<tr align=center class=\"listbody\">
<td>$v</td>
<td align=left>
<table border=0 cellspacing=0 cellpadding=1 width='99%' align=center>
<tr><td valign=middle>
<table border=0 cellspacing=0 cellpadding=0 width='$len_open'>
<tr><td height='8' bgcolor='6699ff' onClick='showopen(\"$adsid\",\"$v\")' title='点击查看".$v."日弹出明细记录' class='hand'><font size=-6>$aopen</font></td></tr>
</table>
</td></tr>
<tr><td valign=middle>
<table border=0 cellspacing=0 cellpadding=0 width='$len_click'>
<tr><td height='8' bgcolor='99cc00' onClick='showclick(\"$adsid\",\"$v\")' title='点击查看".$v."日点击明细记录' class='hand'><font size=-6>$aclick</font></td></tr>
</table>
</td></tr>
</table>
</td>
<td>".$rate."%</td>
<td>".$r_open."%</td>
<td>".$r_click."%</td>
<td>".$str_ocdata."</td>
</tr>";
}
}else{
$sql="select * from daydata where web_user='$_SESSION[web_username]' and own_type=1 $sqlf_date $sqlf_adsid ORDER BY date";
$rs=mysql_query($sql);
while($row=mysql_fetch_array($rs)){
$sdate=$row["date"];
$ads_id=$row["ads_id"];
$arr_totopen["$sdate"]=$arr_totopen["$sdate"]+$row["open_num"];
$arr_totclick["$sdate"]=$arr_totclick["$sdate"]+$row["click_num"];
$arr_open["$sdate"]["$ads_id"]=$arr_open["$sdate"]["$ads_id"]+$row["open_num"];
$arr_click["$sdate"]["$ads_id"]=$arr_click["$sdate"]["$ads_id"]+$row["click_num"];
if($arr_totopen["$sdate"]>$maxnum){
$maxnum=$arr_totopen["$sdate"];
}
if($arr_totclick["$sdate"]>$maxnum){
$maxnum=$arr_totclick["$sdate"];
}
$sumopen=$sumopen+$row["open_num"];
$sumclick=$sumclick+$row["click_num"];
}
while(list($k,$v)=each($arr_totopen)){
$totclick=$arr_totclick["$k"];
$len_open=round($v/$maxnum*260);
$len_click=round($totclick/$maxnum*260);
$r_open=round($v/$sumopen*100);
$r_click=round($totclick/$sumclick*100);
$str_list="";
while(list($sk,$sv)=each($arr_open["$k"])){
$sclick=$arr_click["$k"]["$sk"];
$ads_len_open=round($sv/$maxnum*260);
$ads_len_click=round($sclick/$maxnum*260);
$str_list.="
<table border=0 cellspacing=0 cellpadding=1 width='99%' align=center>
<tr class=listbody><td width=160 rowspan=2 align=right>".$arr_adstype[$sk]."<a href='view_ocpdata.php?adsid=$sk&viewday=$k' title='点击查看点击/弹窗综合图' target='_blank'><span class='intd'>$arr_ads[$sk]</span></a></td><td valign=middle>
<table border=0 cellspacing=0 cellpadding=0 width='$ads_len_open'>
<tr><td height='8' bgcolor='6699ff' onClick='showopen(\"$sk\",\"$k\")' title='点击查看[".$arr_ads["$sk"]."]".$k."日弹出明细记录' class='hand'><font size=-6>$sv</font></td></tr>
</table>
</td></tr>
<tr class=listbody><td valign=middle>
<table border=0 cellspacing=0 cellpadding=0 width='$ads_len_click'>
<tr><td height='8' bgcolor='99cc00' onClick='showclick(\"$sk\",\"$k\")' title='点击查看[".$arr_ads["$sk"]."]".$k."日点击明细记录' class='hand'><font size=-6>$sclick</font></td></tr>
</table>
</td></tr>
</table>
<table border=0 cellspacing=0 cellpadding=1 width='99%' align=center>
<tr><td height=1 bgcolor=dddddd></td></tr>
</table>";
}
$totopen=(!empty($v))?$v:1;
$rate=round($totclick/$totopen*100);
$str_disp.="
<tr align=center class=\"listbody\" height=24>
<td>$k</td>
<td align=left>
<table border=0 cellspacing=0 cellpadding=1 width='99%' align=center>
<tr><td height=1 bgcolor=dddddd></td></tr>
</table>
<table border=0 cellspacing=0 cellpadding=1 width='99%' bgcolor=f0f0f0 align=center>
<tr><td width=160 align=right><span class='intd'>总弹出</span></td><td valign=middle>
<table border=0 cellspacing=0 cellpadding=0 width='$len_open'>
<tr><td height='8' bgcolor='6699ff'><font size=-6>$v</font></td></tr>
</table>
</td></tr>
<tr><td width=160 align=right><span class='intd'>总点击</span></td><td valign=middle>
<table border=0 cellspacing=0 cellpadding=0 width='$len_click'>
<tr><td height='8' bgcolor='99cc00'><font size=-6>$totclick</font></td></tr>
</table>
</td></tr>
</table>
<table border=0 cellspacing=0 cellpadding=1 width='99%' align=center>
<tr><td height=1 bgcolor=dddddd></td></tr>
</table>$str_list
</td>
<td>".$rate."%</td>
<td>".$r_open."%</td>
<td>".$r_click."%</td>
</tr>";
}
}
?>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
function dataview(){
document.form_pic.submit();
}
function showopen(id,day){
open("view_daydata.php?op=open&adsid="+id+"&viewday="+day);
}
function showclick(id,day){
open("view_daydata.php?op=click&adsid="+id+"&viewday="+day);
}
//-->
</script>
<table width="1001" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#f7f7f7">
<tr>
<td width="200" height="323" valign="top" bgcolor="#E8EEF4">
<? include("menu.php"); ?></td>
<td align="center" valign="top" class="bgconn">
<table width="98%" border="0" cellpadding="0" cellspacing="0" >
<tr>
<td height="40" class="orange_text">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="30" align="left" valign="middle"><img src="../image/wb7.gif" width="150" height="20"></td>
</tr>
<tr>
<td height="43" align="center" valign="middle">
<table width="99%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="20" align="left" valign="middle">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -