Skip to content

Commit

Permalink
add trans validate
Browse files Browse the repository at this point in the history
  • Loading branch information
JoouA committed Sep 25, 2017
1 parent 2119878 commit 66800b6
Show file tree
Hide file tree
Showing 3 changed files with 181 additions and 2 deletions.
3 changes: 2 additions & 1 deletion download.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@
}
$filename=basename($path);
$file=fopen($path,"r");
$ext = strrchr($filename,'.');
header("Content-type:text/html;charset=utf-8");
header("Content-type:application/octet-stream");
header("Accept-ranges:bytes");
header("Accept-length:".filesize($path));
header("Content-Disposition:attachment;filename=".$filename);
header("Content-Disposition:attachment;filename=".md5($filename).$ext);
echo fread($file,filesize($path));
fclose($file);
exit;
Expand Down
175 changes: 175 additions & 0 deletions js/chk.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,179 @@ function logout () {
}else{
return false;
}
}

function trans_video_chk(){
var pic = document.getElementsByName('picture');
if (pic[0].value == ""){
alert('照片信息不能为空!');
this.list.picture.focus();
return false;
}

var media = document.getElementsByName('address');
if(media[0].value == ""){
alert('上传数据不能为空!');
this.list.picture.focus();
return false;
}

if (this.list.names.value == ""){
alert('歌曲名称不能为空!');
this.list.names.focus();
return false;
}

if (this.list.actor.value == ""){
alert('演唱者不能为空!');
this.list.actor.focus();
return false;
}

if (this.list.actortype.value == ""){
alert('演唱者类型不能为空!');
this.list.actortype.focus();
return false;
}

if (this.list.ci.value == ""){
alert('作词不能为空!');
this.list.ci.focus();
return false;
}

if (this.list.qu.value == ""){
alert('作曲不能为空!');
this.list.qu.focus();
return false;
}

if (this.list.publisher.value == ""){
alert('发行商不能为空!');
this.list.publisher.focus();
return false;
}

if (this.list.language.value == ""){
alert('语言不能为空!');
this.list.language.focus();
return false;
}

if (this.list.style.value == ""){
alert('二级分类不能为空!');
this.list.style.focus();
return false;
}

if (this.list.type.value == ""){
alert('一级分类不能为空!');
this.list.type.focus();
return false;
}
if (this.list.from.value == ""){
alert('发行国家不能为空!');
this.list.from.focus();
return false;
}
if (this.list.publishtime.value == ""){
alert('发行时间不能为空!');
this.list.publishtime.focus();
return false;
}
if (this.list.remark.value == ""){
alert('简要介绍不能为空!');
this.list.remark.focus();
return false;
}
}

function trans_audio_chk(){
var pic = document.getElementsByName('picture');
if (pic[0].value == ""){
alert('照片信息不能为空!');
this.list.picture.focus();
return false;
}

var media = document.getElementsByName('address');
if(media[0].value == ""){
alert('上传数据不能为空!');
this.list.picture.focus();
return false;
}

if (this.list.names.value == ""){
alert('电影名称不能为空!');
this.list.names.focus();
return false;
}

if (this.list.grade.value == ""){
alert('等级不能为空!');
this.list.grade.focus();
return false;
}

if (this.list.publisher.value == ""){
alert('发行商不能为空!');
this.list.publisher.focus();
return false;
}

if (this.list.actor.value == ""){
alert('主要演员不能为空!');
this.list.actor.focus();
return false;
}

if (this.list.director.value == ""){
alert('导演不能为空!');
this.list.director.focus();
return false;
}

if (this.list.marker.value == ""){
alert('制片人不能为空!');
this.list.marker.focus();
return false;
}

if (this.list.language.value == ""){
alert('语言不能为空!');
this.list.language.focus();
return false;
}

if (this.list.style.value == ""){
alert('二级分类不能为空!');
this.list.style.focus();
return false;
}

if (this.list.type.value == ""){
alert('一级分类不能为空!');
this.list.type.focus();
return false;
}
if (this.list.from.value == ""){
alert('发行国家不能为空!');
this.list.from.focus();
return false;
}
if (this.list.publishtime.value == ""){
alert('发行时间不能为空!');
this.list.publishtime.focus();
return false;
}
if (this.list.news.value == ""){
alert('是否新品不能为空!');
this.list.publishtime.focus();
return false;
}
if (this.list.remark.value == ""){
alert('简要介绍不能为空!');
this.list.remark.focus();
return false;
}
}
5 changes: 4 additions & 1 deletion trans.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
include "inc/func.php";
$types = htmlspecialchars(trim(@$_GET['types']))?htmlspecialchars(trim(@$_GET['types'])):'Audio';
?>
<script type="text/javascript" src="js/chk.js"></script>
<div align="center">
<table width="558" height="110" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
Expand Down Expand Up @@ -64,7 +65,9 @@
<tr>
<td height="30" colspan="2">
<div align="center">
<input name="Submit" type="submit" value="添加">
<input name="Submit" type="submit" value="添加" <?php
if ($types=="Audio"){ echo "onclick=\"return trans_audio_chk();\"";}elseif ($types=="Video"){ echo "onclick=\"return trans_video_chk();\"";} ?>
>
(*是必填项)
<input name="Submit2" type="button" value="返回" onClick="javascript:top.window.close()">
</div>
Expand Down

0 comments on commit 66800b6

Please sign in to comment.