一、以下是数据库的写入的html程序,你可以加入密码功能。把密码做成变量发入下面那个写入的php程序。这样就实现了密码保护了:
<html>
<head>
<title>数据库</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
.p9 { font-size: 9pt}
-->
</style>
</head>
<body bgcolor="#FFFFFF">
<div align="center">
<p class="p9">数据库管理程序<br>
<br>
<a href="mysql.php">查看数据库资料 </a></p>
<p class="p9"><a href="ww.php">改资料</a><br>
</p>
<form method="post" action="wsql.php">
<p align="left"><span class="p9">图片url地址
<input type="text" name="url" size="100">
<br>
<br>
图片小图
<input type="text" name="mess" size="100">
<br>
<br>
说明
<input type="text" name="fromx" size="100">
</span></p>
<p align="left"><span class="p9">图片url地址1
<input type="text" name="url1" size="100">
<br>
<br>
图片小图1
<input type="text" name="mess1" size="100">
<br>
<br>
说明1
<input type="text" name="fromx1" size="100">
</span></p>
<p align="left"><span class="p9">图片url地址2
<input type="text" name="url2" size="100">
<br>
<br>
图片小图2
<input type="text" name="mess2" size="100">
<br>
<br>
说明2
<input type="text" name="fromx2" size="100">
</span></p>
<p align="left" class="p9"><span class="p9">图片url地址3
<input type="text" name="url3" size="100">
<br>
<br>
图片小图3
<input type="text" name="mess3" size="100">
<br>
<br>
说明3
<input type="text" name="fromx3" size="100">
</span><br>
<br>
平分秋色水彩画
<input type="radio" name="jpg" value="jpg" checked>
<br>
明星写真
<input type="radio" name="jpg" value="jpg1">
<br>
动漫桌布
<input type="radio" name="jpg" value="jpg2">
<br>
广告创意
<input type="radio" name="jpg" value="jpg3">
<br>
其它类
<input type="radio" name="jpg" value="jpg4">
<br>
<br>
<input type="submit" name="Submit" value="提交">
<br>
</p>
</form>
</div>
</body>
</html>
二、然后是处理这个提交的php程序:
<html>
<head><title>查找</title>
</head>
<body>
<h1>数据库的数据</h1>
<?
mysql_connect("localhost","用户名","密码") or die("无法联接数据库!");
$query="insert into $jpg values ('$id','$url','$mess','$fromx','$url1','$mess1','$fromx1','$url2','$mess2','$fromx2','$url3','$mess3','$fromx3')" ;
$result=mysql_db_query("elong",$query); //执行写入
if (mysql_affected_rows()==1)
{
echo "数据已加放数据库 $jpg 中<br><br>";
echo "<table>n
<tr>n
<td>ID<td>$id</tr>n
<tr>n
<td>url地址<td>$url</tr>n
<tr>n
<td>小图<td>$mess</tr>n
<tr>n
<td>说明<td>$fromx</tr>n
<tr>n
<td>url地址1<td>$url1</tr>n
<tr>n
<td>小图1<td>$mess1</tr>n
<tr>n
<td>说明1<td>$fromx1</tr>n
<tr>n
<td>url地址2<td>$url2</tr>n
<tr>n
<td>小图2<td>$mess2</tr>n
<tr>n
<td>说明2<td>$fromx2</tr>n
<tr>n
<td>url地址3<td>$url3</tr>n
<tr>n
<td>小图3<td>$mess3</tr>n
<tr>n
<td>说明3<td>$fromx3</tr>n
</table>n";
}
else echo "系统出了问题,请重试!:(";
mysql_close();
?>
<a href='set.htm'>回到首页</a>
</body>
</html>
<html>
<head>
<title>数据库</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
.p9 { font-size: 9pt}
-->
</style>
</head>
<body bgcolor="#FFFFFF">
<div align="center">
<p class="p9">数据库管理程序<br>
<br>
<a href="mysql.php">查看数据库资料 </a></p>
<p class="p9"><a href="ww.php">改资料</a><br>
</p>
<form method="post" action="wsql.php">
<p align="left"><span class="p9">图片url地址
<input type="text" name="url" size="100">
<br>
<br>
图片小图
<input type="text" name="mess" size="100">
<br>
<br>
说明
<input type="text" name="fromx" size="100">
</span></p>
<p align="left"><span class="p9">图片url地址1
<input type="text" name="url1" size="100">
<br>
<br>
图片小图1
<input type="text" name="mess1" size="100">
<br>
<br>
说明1
<input type="text" name="fromx1" size="100">
</span></p>
<p align="left"><span class="p9">图片url地址2
<input type="text" name="url2" size="100">
<br>
<br>
图片小图2
<input type="text" name="mess2" size="100">
<br>
<br>
说明2
<input type="text" name="fromx2" size="100">
</span></p>
<p align="left" class="p9"><span class="p9">图片url地址3
<input type="text" name="url3" size="100">
<br>
<br>
图片小图3
<input type="text" name="mess3" size="100">
<br>
<br>
说明3
<input type="text" name="fromx3" size="100">
</span><br>
<br>
平分秋色水彩画
<input type="radio" name="jpg" value="jpg" checked>
<br>
明星写真
<input type="radio" name="jpg" value="jpg1">
<br>
动漫桌布
<input type="radio" name="jpg" value="jpg2">
<br>
广告创意
<input type="radio" name="jpg" value="jpg3">
<br>
其它类
<input type="radio" name="jpg" value="jpg4">
<br>
<br>
<input type="submit" name="Submit" value="提交">
<br>
</p>
</form>
</div>
</body>
</html>
二、然后是处理这个提交的php程序:
<html>
<head><title>查找</title>
</head>
<body>
<h1>数据库的数据</h1>
<?
mysql_connect("localhost","用户名","密码") or die("无法联接数据库!");
$query="insert into $jpg values ('$id','$url','$mess','$fromx','$url1','$mess1','$fromx1','$url2','$mess2','$fromx2','$url3','$mess3','$fromx3')" ;
$result=mysql_db_query("elong",$query); //执行写入
if (mysql_affected_rows()==1)
{
echo "数据已加放数据库 $jpg 中<br><br>";
echo "<table>n
<tr>n
<td>ID<td>$id</tr>n
<tr>n
<td>url地址<td>$url</tr>n
<tr>n
<td>小图<td>$mess</tr>n
<tr>n
<td>说明<td>$fromx</tr>n
<tr>n
<td>url地址1<td>$url1</tr>n
<tr>n
<td>小图1<td>$mess1</tr>n
<tr>n
<td>说明1<td>$fromx1</tr>n
<tr>n
<td>url地址2<td>$url2</tr>n
<tr>n
<td>小图2<td>$mess2</tr>n
<tr>n
<td>说明2<td>$fromx2</tr>n
<tr>n
<td>url地址3<td>$url3</tr>n
<tr>n
<td>小图3<td>$mess3</tr>n
<tr>n
<td>说明3<td>$fromx3</tr>n
</table>n";
}
else echo "系统出了问题,请重试!:(";
mysql_close();
?>
<a href='set.htm'>回到首页</a>
</body>
</html>