上图
Paste_Image.png Paste_Image.png这个是接收报名的代码
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Flash实训分组</title>
<link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css">
<style type="text/css">
body,
button,
input,
select,
textarea,
h1,
h2,
h3,
h4,
h5,
h6 {
font-family: Microsoft YaHei, '宋体', Tahoma, Helvetica, Arial, "\5b8b\4f53", sans-serif;
}
</style>
</head>
<body>
<!-- 占据设备100%的宽度 -->
<div class="container-fluid">
<h3>Flash实训分组登记</h3>
<!-- <br> -->
<!-- <br> -->
<!-- 具体截至报名时间(2015/11/09 13:30:00)还有
<span id="t_d">00天</span>
<span id="t_h">00时</span>
<span id="t_m">00分</span>
<span id="t_s">00秒</span> -->
<script type="text/javascript">
// function getRTime(){
// var EndTime= new Date('2015/11/09 13:30:00'); //截止时间
// var NowTime = new Date();
// var t =EndTime.getTime() - NowTime.getTime();
// var d=Math.floor(t/1000/60/60/24);
// var h=Math.floor(t/1000/60/60%24);
// var m=Math.floor(t/1000/60%60);
// var s=Math.floor(t/1000%60);
// document.getElementById("t_d").innerHTML = d + "天";
// document.getElementById("t_h").innerHTML = h + "时";
// document.getElementById("t_m").innerHTML = m + "分";
// document.getElementById("t_s").innerHTML = s + "秒";
// }
// setInterval(getRTime,1000);
</script>
<br>
<!-- <br>注意事项:
<br>1.每个学号只能提交一次分组的申请,结果一旦提交便无法修改;如有特殊原因需要修改,请私信小小酥
<br>2.在截止时间之前提交好即为确定分组和题目,请努力完成作品;如果超过截止时间,则会把"暂无分组"的同学进行两两配对,分配到同一个组的同学就互相沟通,努力完成作品 -->
<br>
<br>
<br>
<form action="index.php" method="POST">
<div class="form-group">
<label for="leaderNum">队长学号(必填)</label>
<input type="text" class="form-control" id="leaderNum" name="leaderNum" placeholder="例:1205531107">
</div>
<div class="form-group">
<label for="mateNum">队员学号(选填)</label>
<input type="text" class="form-control" id="mateNum" name="mateNum" placeholder="例:1205531105">
</div>
<div class="form-group">
<label for="title">游戏主题名字(必填)</label>
<input type="text" class="form-control" id="title" name="title" placeholder="例:可爱战机游戏">
</div>
<button type="submit" class="btn btn-default">我已看完并同意注意事项,确认提交</button>
</form>
<br>
<br>
<br>
</div>
</body>
</html>
<?php
$mysql = new SaeMysql();
try{
$c = new SaeCounter();
}catch(Exception $ex){
die($ex->getMessage());
}
$team = $c->get('teamNum');
if (isset($_REQUEST["leaderNum"])
&& isset($_REQUEST["title"])) {
$name = strip_tags( $_REQUEST['leaderNum'] );
$title = strip_tags( $_REQUEST['title'] );
if(strlen($name)<10){
echo "您的学号输入错误";
break;
}
if(strlen($title)<1){
echo "您没有输入主题";
break;
}
$sql = " UPDATE student SET "
//"team = "
//."'"
// .$team
// ."'"
// ." , "
." title = "
."'"
.$title
."'"
." WHERE id = "
."'"
.$name
."'"
//." and team ="
// ."'"
// ."暂无分组"
// ."'"
.";";
echo "<br>";
echo "SQL语句是".$sql."\n";
echo "<br>";
$mysql->runSql($sql);
if ($mysql->errno() != 0)
{
echo "<br>";
echo "格式错误!";
echo "<br>";
die("Error:" . $mysql->errmsg());
echo "<br>";
}
if ($mysql->affectedRows()>0) {
echo "<br>";
echo "同学".$name;
echo "记录提交成功!";//"组号应该为".$team;
echo "<br>";
}else{
echo "<br>";
echo "同学".$name;
echo "您的数据提交失败";
echo "<br>";
die();
}
$c->incr('teamNum');
if (isset($_REQUEST['mateNum'])) {
$name = strip_tags( $_REQUEST['mateNum'] );
$sql = "
UPDATE student SET "
//"team = "
//."'"
//.$team
//."'"
//." , "
." title = "
."'"
.$title
."'"
." WHERE id = "
."'"
.$name
."'"
// ." and team ="
//."'"
//."暂无分组"
//."'"
.";";
echo "SQL语句是".$sql."\n";
$mysql->runSql($sql);
if ($mysql->errno() != 0)
{
echo "<br>";
echo "格式错误!";
echo "<br>";
die("Error:" . $mysql->errmsg());
echo "<br>";
}
if ($mysql->affectedRows()>0) {
echo "<br>";
echo "同学".$name;
echo "记录提交成功!";//组号应该为".$team;
echo "<br>";
}else{
echo "<br>";
echo "同学".$name;
echo "您的数据提交失败";
die();
}
}
}else{
echo "显示结果\n\n";
}
$sql = "SELECT * FROM `student` ORDER BY `team` ASC LIMIT 100";
$data = $mysql->getData( $sql );
echo "<br>";
echo "<br>";
echo "现在的结果是:";
echo "<br>";
echo '<table class="table table-striped">';
echo "<tr><td>学号</td><td>姓名</td><td>组号</td><td>题目</td></tr>";
foreach ($data as $sub1) {
echo "<tr>";
foreach ($sub1 as $sub2) {
echo "<td>".$sub2."</td>";
}
echo "</tr>";
}
echo "</table>";
$mysql->closeDb();
?>
这个是自助上传作品的代码
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Flash实训分组</title>
<link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css">
<style type="text/css">
body,
button,
input,
select,
textarea,
h1,
h2,
h3,
h4,
h5,
h6 {
font-family: Microsoft YaHei, '宋体', Tahoma, Helvetica, Arial, "\5b8b\4f53", sans-serif;
}
</style>
</head>
<body>
<!-- 占据设备100%的宽度 -->
<div class="container-fluid">
<h3>Flash实训作品自助提交系统</h3>
<br>
离提交截至报名时间(2015/12/06 20:00:00)还有
<span id="t_d">00天</span>
<span id="t_h">00时</span>
<span id="t_m">00分</span>
<span id="t_s">00秒</span>
<br>
若需要修改,可进行重复提交,如有任何问题,请联系小小酥
<br>
1.麻烦各位把文件尽量压缩至5MB以内,否则很容易出现浏览器卡死的情况。
<br>
2.各位尽量使用chrome内核的浏览器,如360浏览器的极速模式,搜狗浏览器,QQ浏览器之类的,因为浏览器的左下角会打印出上传的进度的数值。不要使用IE6、不要使用IE6、不要使用IE6,重要的事情说3遍。
<br>
3.实在真的文件太大提交得蛋疼的,请直接联系我。
<br>
<br>
<script type="text/javascript">
function getRTime(){
var EndTime= new Date('2015/12/06 20:00:00'); //截止时间
var NowTime = new Date();
var t =EndTime.getTime() - NowTime.getTime();
var d=Math.floor(t/1000/60/60/24);
var h=Math.floor(t/1000/60/60%24);
var m=Math.floor(t/1000/60%60);
var s=Math.floor(t/1000%60);
document.getElementById("t_d").innerHTML = d + "天";
document.getElementById("t_h").innerHTML = h + "时";
document.getElementById("t_m").innerHTML = m + "分";
document.getElementById("t_s").innerHTML = s + "秒";
}
setInterval(getRTime,1000);
</script>
<div>
<br>
<form action="upload.php" method="POST" enctype="multipart/form-data" target="_self" action-type="form" node-type="form">
<div class="form-group">
<label for="name">请选择小组信息</label>
<select class="form-control" name="name" id="name">
<option>暂未选择</option>
<?php
$mysql = new SaeMysql();
$sql = "SELECT * FROM `student` ORDER BY `team` ASC LIMIT 100";
$data = $mysql->getData( $sql );
$tmp;
foreach ($data as $sub) {
if (empty($tmp[$sub['team']])) {
$tmp[$sub['team']] = "第".$sub['team']."组-".$sub['title']."-成员-".$sub['id'].$sub['name'];
}
else{
$tmp[$sub['team']] = $tmp[$sub['team']]."-".$sub['id'].$sub['name'];
}
}
foreach ($tmp as $key => $value) {
echo "<option>";
echo $value;
echo "</option> \n";
}
?>
</select>
</div>
<div class="form-group">
<label for="name">请选择要上传的文件(请把文件夹打包成zip格式,否则会上传失败)</label>
<input type="file" name="file" class="file" id="file" value="file" />
</div>
<button type="submit" class="btn btn-default">上传文件</button>
</form>
</div>
</div>
</body>
</html>
<?php
use sinacloud\sae\Storage as Storage;
$bucketName = "student";
$s =new Storage();
if($_FILES["file"]["tmp_name"] != NULL){
$tmp = $_FILES['file']['name'];
$array = explode('.',$tmp);
$_start =$array[0];
$_end =$array[1];
if( $_POST['name'] == "暂未选择"){
echo "您还没有选择小组信息,请选择后再提交";
}
else if( $_end != "zip"){
echo "您上传的文件格式是".$_end.",不是zip文件,请用压缩软件,如360压缩(yasuo.360.cn)把需要提交的文件压缩成zip文件之后再提交";
}
else{
$file = $_FILES["file"]["tmp_name"];
$uploadName = $_POST['name'].".zip";
$_url = $s ->putObject($s ->inputFile($file), $bucketName, $uploadName);
if ($_url) {
echo $_POST['name'].",文件上传成功!";
}else{
echo $_POST['name'].",文件上传失败!";
}
}
}
$_list = $s ->getBucket($bucketName);
echo "<br>";
echo '<table class="table table-striped">';
echo "<tr><td>文件名</td><td>文件大小(KB)</td><td>跟新时间</td><td>文件哈希值</td><td>文件下载链接</td></tr>";
foreach ($_list as $go) {
echo "<tr>";
echo "<td>".$go["name"]."</td>";
echo "<td>".$go["bytes"] ."</td>";
echo "<td>".$go["last_modified"]."</td>";
echo "<td>".$go["hash"]."</td>";
echo "<td><a href='".$s ->getUrl($bucketName,$go["name"])."'>点击下载</a></td>";
echo "</tr>";
}
echo "</table>";
?>
网友评论