6.2 与PHP+Mysql

 

高级应用可以实现通过获取FlvID或ListID这样的参数,传给JcScpFile[配置文件],配置文件接收传过来的FlvID或ListID,再进行查询数据库,最终匹配出对应的配置文件参数,从而播放视频。
简要过程说明(本例以php为例,其过程与ASP实际是类似的):
1. /Player/player.swf?FlvID=745,此处写入视频ID;
2. JcScpFile[配置文件]/Player/CuSunV3Set.php会接收以上传过来的FlvID=745,此时,也就是相当于/Player/CuSunV3Set.php?FlvID=745
3. 现在很清楚了,就是在/Player/CuSunV3Set.php?FlvID=745中,程序获取FlvID=745,再进行查询数据库,匹配出对应的配置文件参数

 

例(6.3)-1:使用[ HTML代码参数 ]

第1部分:在html中使用您需要的[ HTML代码参数 ]

<script type="text/javascript" src="images/swfobject.js"></script>
<div class="video" id="CuPlayer"><b>网页视频播放器加载中,请稍后...</b></div>
<script type="text/javascript">
var so = new SWFObject("/Player/player.swf?FlvID=745","ply","520","325","9","#000000");
so.addParam("allowfullscreen","true");
so.addParam("allowscriptaccess","always");
so.addParam("wmode","opaque");
so.addParam("quality","high");
so.addParam("salign","lt");
so.addVariable("JcScpFile","/Player/CuSunV3Set.php");
so.write("CuPlayer");
</script>

 

第2部分,以下是配置文件CuSunV3Set.php代码如下 (提示:注意以下的标红的数字序号):

<?php
require_once("config.php");
@include("My89525_myfunction.php");

$FlvID=chkstr($_GET["FlvID"],2);//①. 获取第一部分中传过来的FlvID
$conn = @mysql_connect($dbhost,$dbusername,$dbpassword) or die ("Can't connect db server");
@mysql_select_db($dbname,$conn) or die ("Can't select db");
@mysql_query("SET NAMES 'gb2312'");
//@mysql_query("SET NAMES 'utf8'");
//’②. 此处对传过来FlvID的值,进行查询 $exec="SELECT * FROM jcplayer where id ='$FlvID' ";
$result=mysql_query($exec);
④. 此处rs匹配结果
$rs=mysql_fetch_object($result);
?>
<Logo_Set
JcScpLogoDisplay = "yes"
JcScpLogoPath = "Images/logo.png"
JcScpLogoPosition = "top-left"
JcScpLogoWidth = "165"
JcScpLogoHeight = "55"
JcScpLogoAlpha = "0.5"
/>
<Flashvars_Set
JcScpServer =""
<!-- ⑤. 赋值给对应的参数,用以传入播放器进行播放。至此传值完毕-->
JcScpVideoPath = "<?php echo $rs->JcScpVideoPath?>"
JcScpVideoPathHD = "<?php echo $rs->JcScpVideoPathHD?>"
JcScpImg ="<?php echo $rs->JcScpImg?>"


ShowJcScpAFront = "yes"
JcScpCountDowns = "10"
JcScpCountDownsPosition = "top-right"
JcScpAFrontW = "645"
......
......