require("config.inc.php3");
$conn=mysql_connect($server,$user,$password); //连接数据服务器
$query="SELECT name,time,url FROM jm where flag=1 ";
if ($tv_id=="" ) {
$tv_id=1;
}
$query=$query." and tv_id =".$tv_id;
if ($date=="") {
$date=date("Y/m/d",time(0));
}
$query=$query." and date ='".$date."'";
$result=mysql_db_query($db,$query);
$year=substr($date,0,4);
if (substr($date,5,1)=="0") {
$month=substr($date,6,1);
}else{
$month=substr($date,5,2);
}
if (substr($date,8,1)=="0") {
$day=substr($date,9,1);
}else{
$day=substr($date,8,2);
}
$lastWeek=date( "Y/m/d",mktime(0,0,0,date("m",mktime(0,0,0,$month,$day,$year)) ,date("d",mktime(0,0,0,$month,$day,$year))-7,date("Y",mktime(0,0,0,$month,$day,$year))));
$nextWeek=date( "Y/m/d",mktime(0,0,0,date("m",mktime(0,0,0,$month,$day,$year)) ,date("d",mktime(0,0,0,$month,$day,$year))+7,date("Y",mktime(0,0,0,$month,$day,$year))));
$dateTemp=getdate(mktime(0,0,0,$month,$day,$year));
for ($i=0; $i<=6; $i++) {
$dateTemp1=$dateTemp["wday"]-$i;
${Week.$i}=date( "Y/m/d",mktime(0,0,0,date("m",mktime(0,0,0,$month,$day,$year)),date("d",mktime(0,0,0,$month,$day,$year))-$dateTemp1,date("Y",mktime(0,0,0,$month,$day,$year))));
}
$color="";
$string="";
$image="";
switch ($tv_id) {
case "1":
$color="FF6C00";
$string="中文台";
$image="fhlogo_zhw.gif";
break;
case "2":
$color="00B2EB";
$string="美洲台";
$image="fhlogo_mzh.gif";
break;
case "3":
$color="72B321";
$string="欧洲台";
$image="fhlogo_ozh.gif";
break;
case "4":
$color="595959";
$string="电影台";
$image="dianylogo.gif";
$change="";
break;
case "5":
$color="005CCE";
$string="资讯台";
$image="zixlogo.gif";
break;
default:
$color="FF6C00";
$string="中文台";
break;
}
$query="SELECT time_zone,down_name,bulletin FROM tv where id=".$tv_id;
$result2=mysql_db_query($db,$query);
$rs2=mysql_fetch_array($result2);
?>
凤凰网
if ($tv_id==4) {
echo "
";
} else {
echo "
| |
上周节目表 |
 |
${string}(本周)节目表 |
${year}年${month}月${day}日 ${rs2[time_zone]} |
|
|
|
";
}
?>
|
|
if ($rs2[down_name]!="") {
$outString = "周";
if ($tv_id == 4 || $tv_id == 5) {
$outString = "月";
}
echo "
";
}
"";
if ($rs2[bulletin]!="") {
echo "
";
}
?>
|
if ($tv_id!=4) {
echo "
";
if ($date==$Week0) {
echo "
|
星期日
| ";
} else {
echo " | ";
}
if ($date==$Week1) {
echo "
星期一
| ";
} else {
echo " | ";
}
if ($date==$Week2) {
echo "
星期二
| ";
} else {
echo " | ";
}
if ($date==$Week3) {
echo "
星期三
| ";
} else {
echo " | ";
}
if ($date==$Week4) {
echo "
星期四
| ";
} else {
echo " | ";
}
if ($date==$Week5) {
echo "
星期五
| ";
} else {
echo " | ";
}
if ($date==$Week6) {
echo "
星期六
| ";
} else {
echo " | ";
}
echo "
|
";
}
?>
|
|
|
$total=mysql_num_rows($result);
$half=floor($total/2);
$half1=$half;
if ($total!=$half*2) {
$half1=$half+1;
}
?>
|
for ($i=0; $i<$half1; $i++) {
$rs=mysql_fetch_array($result);
echo "| $rs[time] ";
if ($rs[url]!="") {
echo "$rs[name] | ";
} else {
echo "$rs[name] ";
}
}
?>
|
for ($i=$half1; $i<=($half1+$half); $i++) {
$rs=mysql_fetch_array($result);
echo "| ".$rs[time]." ";
if ($rs[url]!="") {
echo "$rs[name] | ";
} else {
echo "$rs[name] ";
}
}
?>
|
|
|
|
|
|
|
|
mysql_close($conn);
?>