代码语言
.
CSharp
.
JS
Java
Asp.Net
C
MSSQL
PHP
Css
PLSQL
Python
Shell
EBS
ASP
Perl
ObjC
VB.Net
VBS
MYSQL
GO
Delphi
AS
DB2
Domino
Rails
ActionScript
Scala
代码分类
文件
系统
字符串
数据库
网络相关
图形/GUI
多媒体
算法
游戏
Jquery
Extjs
Android
HTML5
菜单
网页交互
WinForm
控件
企业应用
安全与加密
脚本/批处理
开放平台
其它
【
PHP
】
音频播放器
作者:
李敬塔
/ 发布于
2012/12/5
/
1007
<?php /**** **createDate:2009-01-11 **author:李敬塔 *****/ session_start(); include_once("../class/DB_SQL.php"); include_once("../funlib/security.inc.php"); $user_id=$userinfo["User_Id"]; $school_id=$schoolinfo["School_Id"]; $user_grade=$userinfo["User_Grade"]; $user_class=$userinfo["User_Class"]; $user_name=$userinfo["User_Name"]; $user_permit=$userinfo["User_Permit"]; $db=new DB_Sql(); $db->connect(); if($_POST['act']=="up"){ $sql="SELECT * FROM homework_questionrepository where title='$title'"; $db->query($sql); if($db->nf()){ echo "<script>alert(\"该标题已存在,请使用其它的标题\");history.back();</script>";exit; } $path=$_FILES['video_file']['name']; $type=$_FILES['video_file']['type']; if($type!="audio/mpeg"){ echo "<script>alert('作业只能上传音频文件!');history.back();</script>";exit; }; $path1=getcwd()."\\Video\\".$path; if(file_exists($path1)){ echo "<script>alert(\"该作业文件已经存在,您可以直接调用!\");history.back();</script>";exit; } move_uploaded_file($_FILES["video_file"]['tmp_name'],$path1); $sql="INSERT INTO homework_questionrepository(title,videofile_url,user_id,user_name,up_datetime)values('$title','$path','$user_id','$user_name',CURRENT_TIMESTAMP)"; $db->query($sql); echo "<script>alert('文件上传成功!');history.back();</script>"; } if($_POST["act"]=="submit_homework"){ $sql="SELECT id FROM homework_onsubmit_status WHERE user_id='$user_id' and hqr_id='$hqr_id'"; $db->query($sql); if($db->nf()){ echo "<script>alert(\"该作业你已提交!\");history.back();</script>";exit; } $sql="INSERT INTO homework_onsubmit_status(hqr_id,user_id,school_id,user_grade,user_class,record_datetime)values($hqr_id,'$user_id','$school_id',$user_grade,$user_class,CURRENT_TIMESTAMP)"; $db->query($sql); echo "<script>alert('作业提交成功!');history.back();</script>"; } if($_GET["act"]=="del"){ if(file_exists($delpath)){ unlink($delpath); } $sql="DELETE FROM homework_questionrepository WHERE id=$hqr_id"; $db->query($sql); echo "<script>alert('题目删除成功!');history.back();</script>"; } $sql="SELECT * FROM homework_questionrepository ORDER BY up_datetime DESC"; $db->query($sql); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>HomeWork</title> <script> // from is check; function checkfrom(myform){ if(myform.title.value.length<=0){ alert("请指定作业标题!"); myform.title.select(); return false; }else if(myform.video_file.value.length<=0){ alert("请选择作业文件!"); myform.video_file.select(); return false; } myform.submit(); } //音量控制 function setVolume(num) { var firstSound=document.getElementById("firstSound") tnum=firstSound.Volume+num if(tnum>0){tnum=0;} if(tnum<-10000){tnum=-10000;} firstSound.Volume=tnum; } //当前播放的对象 var curr_play="";var curr_index=0; var curr_volume_add=""; var curr_volume_minus=""; var curr_stop_play=""; //播放 function play_video(){ var video_obj=document.getElementById("firstSound"); video_obj.play(); curr_play==""?"":curr_play.src="images/home_work/2.gif"; curr_play==""?"":curr_play.disabled=true; curr_volume_add==""?"":curr_volume_add.style.display=""; curr_volume_minus==""?"":curr_volume_minus.style.display=""; curr_stop_play==""?"":curr_stop_play.style.display=""; } //初始化 function init_video(index,play_obj,path){ curr_play==""?"":curr_play.src="images/home_work/1.gif"; curr_play==""?"":curr_play.disabled=false; curr_volume_add==""?"":curr_volume_add.style.display="none"; curr_volume_minus==""?"":curr_volume_minus.style.display="none"; curr_stop_play==""?"":curr_stop_play.style.display="none"; curr_volume_add=document.getElementById("volume_add"+index.toString()); curr_volume_minus=document.getElementById("volume_minus"+index.toString()); curr_stop_play=document.getElementById("stop_play"+index.toString()); curr_play=play_obj;curr_index=index; var video_obj=document.getElementById("firstSound"); video_obj.Filename=path; setTimeout("play_video()",160); } var run=true; function pause_run(obj){ if(curr_play==null || curr_play=="")return; var video_obj=document.getElementById("firstSound"); if(run==true){video_obj.pause();run=false;obj.value='播放';}else{ video_obj.play();run=true;obj.value='暂停'; } } </script> <script event="EndOfStream(lResult)" for="firstSound" language="javascript"> curr_play==""?"":curr_play.src="images/home_work/1.gif"; curr_play==""?"":curr_play.disabled=false; curr_volume_add==""?"":curr_volume_add.style.display="none"; curr_volume_minus==""?"":curr_volume_minus.style.display="none"; curr_stop_play==""?"":curr_stop_play.style.display="none"; alert("播放完毕, <? echo $user_name ?> 同学你的作业已完成,按确定提交!"); if(curr_index>0) document.forms[curr_index].submit(); </script> </head> <body> <form action="" name="myform" method="post" enctype="multipart/form-data"> <? if($user_permit>=16){ ?> <input type="hidden" name="act" value="up" /> <table cellpadding="0" cellspacing="0" border="0"> <tr><td align='right'>作业文件标题:</td><td><input type="text" name="title" id="title" ></td></tr> <tr><td align='right'>选择要上传的文件:</td><td><input type="file" name="video_file" id="video_file" ></td></tr> <tr><td colspan="2" align="center"><input type="button" value="上传" onclick="checkfrom(myform);"><input type="reset" value="取消"></td></tr> </table> <? } ?> </form> <embed src="Video/流星雨.mp3" hidden="true" autostart="false" loop="false" ShowStatusBar='0' name="firstSound" id="firstSound" ShowAudioControls='0' ShowCaptioning='0' mastersound> <table border="0" cellpadding="0" cellspacing="3" align=""> <? $path1=getcwd(); $path1=str_replace("\\","/",$path1); $path1.="/Video/"; while($rows=$db->affected_array()){ $index++; ?> <form action="" name="myforms<? echo $index ?>" method="post"> <input type="hidden" name="act" value="submit_homework"/> <input type="hidden" name="hqr_id" value="<? echo $rows["Id"]; ?>"/> </form> <tr> <td style="color:blue;"> <? echo $rows["Title"]; ?> </td> <td style="font-size:12px;"> <? echo $rows["Up_DateTime"]; ?> </td><td><img src="images/home_work/1.gif" id="play<? echo $index ?>" name="play<? echo $index ?>" title="播放" onclick="javascript:init_video(<? echo $index ?>,this,'<? echo $path1.$rows["VideoFile_URL"]; ?>')" width="20"><input type="button" onclick="setVolume(200)" value="音量+" style="cursor:pointer;display:none;" id="volume_add<? echo $index ?>" name="volume_add<? echo $index ?>" /> <input type="button" onclick="setVolume(-200)" value="音量-" style="cursor:pointer;display:none;" name="volume_minus<? echo $index ?>" id="volume_minus<? echo $index ?>" /> <input type="button" onclick="pause_run(this)" value="暂停" style="cursor:pointer;display:none;" name="stop_play<? echo $index ?>" id="stop_play<? echo $index ?>" /><? if($user_permit>=16){ ?><a href="HomeWork_SubmitState.php?act=see_state&hqr_id=<? echo $rows["Id"]?>" >完成情况</a><a href="HomeWork.php?act=del&hqr_id=<? echo $rows["Id"]?>&delpath=<? echo $path1.$rows["VideoFile_URL"]; ?>" >删除</a><? } ?> </td> </tr> <? } ?> </table> </body> </html>
试试其它关键字
播放器
同语言下
.
用net匹配并替换iOS标准的emoji表情符号
.
处理带Emoji表情的的字符串
.
获取微信昵称时 过滤特殊字符
.
通过判断上传文件的头字符来判断文件的类型
.
模拟百度URL加密解密算法
.
以太坊检查地址是否合法
.
实现crontab解析类
.
获取每个月的开始和结束时间
.
图片上传工具类
.
APP手机应用信息采集
可能有用的
.
C#实现的html内容截取
.
List 切割成几份 工具类
.
SQL查询 多列合并成一行用逗号隔开
.
一行一行读取txt的内容
.
C#动态修改文件夹名称(FSO实现,不移动文件)
.
c# 移动文件或文件夹
.
c#图片添加水印
.
Java PDF转换成图片并输出给前台展示
.
网站后台修改图片尺寸代码
.
处理大图片在缩略图时的展示
李敬塔
贡献的其它代码
(
13
)
.
PHP模拟登录获取邮箱联系人地址
.
HTML节点交换(兼容FF/IE)
.
js数组分页
.
兼容FF的右键菜单
.
实现textarea内字符串选择查询替换功能
.
SQL的形式操作文件
.
可以传对像的setTimeout函数
.
音频播放器
.
仿 MSN网站首页弹出式欢迎词(兼容Firefox/IE)
.
支持IE、FF纯js 颜色选择器
Copyright © 2004 - 2024 dezai.cn. All Rights Reserved
站长博客
粤ICP备13059550号-3