channeladddo.php
资源名称:p2p_vod.rar [点击查看]
上传用户:liguizhu
上传日期:2015-11-01
资源大小:2422k
文件大小:2k
源码类别:
P2P编程
开发平台:
Visual C++
- <?php
- include_once 'functions.php';
- $channelname = $_REQUEST["channel"];
- $bitrate = $_REQUEST["bitrate"];
- $programlist = $_REQUEST["programlist"];
- $md5 = md5($channelname);
- $filename = CHANNEL_DIR . "/" . $md5;
- if (file_exists($filename)){
- print("此频道名已存在,请使用其它频道名。");
- print('<p align="center" ><a href="channel.php">返回频道列表</a></p>');
- exit;
- }
- $data = $bitrate . "n" . $channelname . "n";
- //确认加入频道里的每个节目是否仍然存在 同时准备好要写入频道文件的节目md5值列表
- $programtable = getProgramTable();
- foreach ($programlist as $program){
- $programdir = PROGRAM_DIR . "/" . $program;
- if (!file_exists($programdir)){
- print("节目<b>".$programtable[$program]."</b>[".$program."]不存在,请确认你选择了正确的节目信息。");
- print('<p align="center" ><a href="channel.php">返回频道列表</a></p>');
- exit;
- }
- $data = $data . $program . "n";
- }
- //file_put_contents($filename, $data);
- if (!$handle = fopen($filename, 'w')) {
- print "不能打开文件 $filename";
- print('<p align="center" ><a href="channel.php">返回频道列表</a></p>');
- exit;
- }
- if (!fwrite($handle, $data)) {
- print "不能写入到文件 $filename";
- print('<p align="center" ><a href="channel.php">返回频道列表</a></p>');
- exit;
- }
- fclose($handle);
- //加入频道成功 通知sp处理
- infoSp();
- ?>
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
- <title>频道管理 - 增加频道</title>
- <style type="text/css">
- <!--
- .style1 {
- font-size: 18px;
- font-weight: bold;
- }
- -->
- </style>
- </head>
- <body>
- <p align="center" class="style1">增加频道成功!</p>
- <p align="center" class="style1"><a href="channel.php">返回频道列表</a></p>
- </body>
- </html>