这是我最近一个项目中用的,自己改改<?php
/*--
文件名: stuphoto_into.php
作者: 心云意水
最后修改时间: February 24, 2003
用途: 学生照片导入脚本。
*/
require("../include/sucheck.php"); //检查用户的身份合法性
require("../include/conn.php"); //建立数据库连接
$tit="学生照片导入";
if($Submit=="上传...")
{
$sname=str_replace(chr(32),"",$sname);
If($photo!= "none")
{$PSize = filesize($photo);
$mysqlPicture = addslashes( fread(fopen($photo, "r"), $PSize));
$result=mysql_query("select num from info_stu where sid='$sid' and usname='$sname'",$pcon);
$row=mysql_fetch_array($result);
if($row)
{ $result=mysql_query("update info_stu set photo='$mysqlPicture' where num=".$row["num"]) or die("SQL 处理失败");
if($result)
$stutxt="恭喜,照片上传成功!";
else
$stutxt="<font color='red'>照片上传失败</font>";
}
else
$stutxt="<font color='red'>无此学生信息</font>,请先添加该同学的基本信息";
}
else
$stutxt="<font color='red'>照片上传失败</font>";
if($type=="add")
include("stuinto.php");
if($type=="edit")
include("stulist.php");
}?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>学生照片导入</title>
<link href="../include/sucss.css" rel="stylesheet" type="text/css">
<link href="../../css/document.css" rel="stylesheet" type="text/css">
</head><body bgcolor="#D3D3A9">
<script>
if (self.name==top.name)
top.location.replace("../index.php");
</script>
<table width="570" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="170" bgcolor="#999A67"> <table width="170" height="1" border="0" cellpadding="5" cellspacing="0" class="allborder">
<tr>
<td width="42" height="1" bgcolor="#D3D3A9" style="border-right:1px solid #000000;"> </td>
<td width="106" class="dshadow"><div align="center">
<?=$tit?>
</div></td>
</tr>
</table></td>
<td width="20"> </td>
<td class="text"> </td>
</tr>
</table>
<table width="570" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="233"> </td>
<td width="367" align="center">
<?php
if ($stutxt)
echo($stutxt);
?>
</td>
</tr>
</table>
<table width="570" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table width="80%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="9%" height="15" align="center"> </td>
<td width="91%" align="center">注意:图片(110*90)不能超过64k</td>
</tr>
</table>
<table width="80%" height="2" border="0" cellpadding="0" cellspacing="0" class="tbborder" style="border-top-width: 0px;">
<tr>
<td height="2" bgcolor="#7D7E54" ></td>
</tr>
</table>
<table width="80%" border="0" cellpadding="0" cellspacing="0" class="kuang1">
<!--基本信息导入-->
<tr>
<td align="center">
<form action="stuphoto_into.php" method="post" enctype="multipart/form-data" name="frmphoto" onSubmit="return checkfrmphoto(this)">
<table width="100%" height="87" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="15%" align="center" valign="middle"> </td>
<td width="85%" align="center" valign="middle"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="34%">请输入学号:
<input name="sid" type="text" class="inputtxt" id="sid3" size="6" maxlength="6"></td>
<td width="66%">请输入姓名:
<input name="sname" type="text" class="inputtxt" id="sname3" size="6" maxlength="10"></td>
</tr>
</table></td>
</tr>
<tr>
<td align="center" valign="middle"><label for="radio6"></label>
</td>
<td valign="middle">
<label for="radio6">请选择图片文件:</label>
<input name="photo" type="file" class="kuang1" id="photo"></td>
</tr>
<tr>
<td align="center" valign="middle">
<script language="JavaScript" src="../../js/stu.js" type="text/JavaScript">
</script> </td>
<td align="center" valign="middle"><input name="Submit" type="submit" class="kuang1" style="border: 1px solid #000000;height:17" value="上传..."></td>
</tr>
</table>
</form>
</td>
</tr>
<!--照片导入-->
<tr>
<td align="center">
<table width="80%%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
<td> </td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html><?php
/*--
文件名: stuinsert.php
作者: 心云意水
最后修改时间: January 22, 2003
用途: 学生信息导入脚本。
*/
require("../include/sucheck.php"); //检查用户的身份合法性
require("../include/conn.php"); //建立数据库连接if($photo)
{ If($photo!= "none")
{$PSize = filesize($photo);
$mysqlPicture = addslashes( fread(fopen($photo, "r"), $PSize));
$result=mysql_query("select num from info_stu where sid='$sid'");
$row=mysql_fetch_row($result);
if($row)
{ $result=mysql_query("update info_stu set photo='$mysqlPicture' where sid='$sid'") or die("SQL 处理失败");
if($result)
$stutxt="恭喜,照片上传成功!";
else
$stutxt="<font color='red'>照片上传失败</font>";
}
else
$stutxt="<font color='red'>无此学号的同学</font>,请先添加该同学的基本信息";
}
else
$stutxt="<font color='red'>照片上传失败</font>";
if($type=="add")
include("stuinto.php");
if($type=="edit")
include("stulist.php");
}?>
/*--
文件名: stuphoto_into.php
作者: 心云意水
最后修改时间: February 24, 2003
用途: 学生照片导入脚本。
*/
require("../include/sucheck.php"); //检查用户的身份合法性
require("../include/conn.php"); //建立数据库连接
$tit="学生照片导入";
if($Submit=="上传...")
{
$sname=str_replace(chr(32),"",$sname);
If($photo!= "none")
{$PSize = filesize($photo);
$mysqlPicture = addslashes( fread(fopen($photo, "r"), $PSize));
$result=mysql_query("select num from info_stu where sid='$sid' and usname='$sname'",$pcon);
$row=mysql_fetch_array($result);
if($row)
{ $result=mysql_query("update info_stu set photo='$mysqlPicture' where num=".$row["num"]) or die("SQL 处理失败");
if($result)
$stutxt="恭喜,照片上传成功!";
else
$stutxt="<font color='red'>照片上传失败</font>";
}
else
$stutxt="<font color='red'>无此学生信息</font>,请先添加该同学的基本信息";
}
else
$stutxt="<font color='red'>照片上传失败</font>";
if($type=="add")
include("stuinto.php");
if($type=="edit")
include("stulist.php");
}?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>学生照片导入</title>
<link href="../include/sucss.css" rel="stylesheet" type="text/css">
<link href="../../css/document.css" rel="stylesheet" type="text/css">
</head><body bgcolor="#D3D3A9">
<script>
if (self.name==top.name)
top.location.replace("../index.php");
</script>
<table width="570" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="170" bgcolor="#999A67"> <table width="170" height="1" border="0" cellpadding="5" cellspacing="0" class="allborder">
<tr>
<td width="42" height="1" bgcolor="#D3D3A9" style="border-right:1px solid #000000;"> </td>
<td width="106" class="dshadow"><div align="center">
<?=$tit?>
</div></td>
</tr>
</table></td>
<td width="20"> </td>
<td class="text"> </td>
</tr>
</table>
<table width="570" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="233"> </td>
<td width="367" align="center">
<?php
if ($stutxt)
echo($stutxt);
?>
</td>
</tr>
</table>
<table width="570" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table width="80%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="9%" height="15" align="center"> </td>
<td width="91%" align="center">注意:图片(110*90)不能超过64k</td>
</tr>
</table>
<table width="80%" height="2" border="0" cellpadding="0" cellspacing="0" class="tbborder" style="border-top-width: 0px;">
<tr>
<td height="2" bgcolor="#7D7E54" ></td>
</tr>
</table>
<table width="80%" border="0" cellpadding="0" cellspacing="0" class="kuang1">
<!--基本信息导入-->
<tr>
<td align="center">
<form action="stuphoto_into.php" method="post" enctype="multipart/form-data" name="frmphoto" onSubmit="return checkfrmphoto(this)">
<table width="100%" height="87" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="15%" align="center" valign="middle"> </td>
<td width="85%" align="center" valign="middle"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="34%">请输入学号:
<input name="sid" type="text" class="inputtxt" id="sid3" size="6" maxlength="6"></td>
<td width="66%">请输入姓名:
<input name="sname" type="text" class="inputtxt" id="sname3" size="6" maxlength="10"></td>
</tr>
</table></td>
</tr>
<tr>
<td align="center" valign="middle"><label for="radio6"></label>
</td>
<td valign="middle">
<label for="radio6">请选择图片文件:</label>
<input name="photo" type="file" class="kuang1" id="photo"></td>
</tr>
<tr>
<td align="center" valign="middle">
<script language="JavaScript" src="../../js/stu.js" type="text/JavaScript">
</script> </td>
<td align="center" valign="middle"><input name="Submit" type="submit" class="kuang1" style="border: 1px solid #000000;height:17" value="上传..."></td>
</tr>
</table>
</form>
</td>
</tr>
<!--照片导入-->
<tr>
<td align="center">
<table width="80%%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
<td> </td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html><?php
/*--
文件名: stuinsert.php
作者: 心云意水
最后修改时间: January 22, 2003
用途: 学生信息导入脚本。
*/
require("../include/sucheck.php"); //检查用户的身份合法性
require("../include/conn.php"); //建立数据库连接if($photo)
{ If($photo!= "none")
{$PSize = filesize($photo);
$mysqlPicture = addslashes( fread(fopen($photo, "r"), $PSize));
$result=mysql_query("select num from info_stu where sid='$sid'");
$row=mysql_fetch_row($result);
if($row)
{ $result=mysql_query("update info_stu set photo='$mysqlPicture' where sid='$sid'") or die("SQL 处理失败");
if($result)
$stutxt="恭喜,照片上传成功!";
else
$stutxt="<font color='red'>照片上传失败</font>";
}
else
$stutxt="<font color='red'>无此学号的同学</font>,请先添加该同学的基本信息";
}
else
$stutxt="<font color='red'>照片上传失败</font>";
if($type=="add")
include("stuinto.php");
if($type=="edit")
include("stulist.php");
}?>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货