php提交留言去数据库 php无数据库留言板( 二 )


?
body
form action="register.php" method="post"
table border=1 align=center width=500
tr
td height=40 bgColor=#DFFFDF colspan=2会员注册[a href="https://www.04ip.com/post/login.php"返回登录页/a]/td
/tr
tr
td height=40 bgColor=#fffbec 会员ID/td
tdinput type="text" name="username" id="username"//td
/tr
tr
td height=40 bgColor=#fffbec密码/td
tdinput type="password" name="password" id="password"//td
/tr
tr
td height=40 bgColor=#fffbec确认密码/td
td
input type="password" name="realpass" id="realpass"/
/td
/tr
tr
td height=40 bgColor=#fffbecEMAIL/td
tdinput type="text" name="email" id="email"/
/tr
tr
td height=40 bgColor=#fffbec/td
tdinput type="submit" name="submit" value="https://www.04ip.com/post/注册"/input type="reset" value="https://www.04ip.com/post/重置"/td
/tr
/table
/form
/body
主页显示:index.php
?php
include("conn.php");
function cutstr($str,$cutleng)
{
$str = $str; //要截取的字符串
$cutleng = $cutleng; //要截取的长度
$strleng = strlen($str); //字符串长度
if($cutleng$strleng)return $str;//字符串长度小于规定字数时,返回字符串本身
$notchinanum = 0; //初始不是汉字的字符数
for($i=0;$i$cutleng;$i++)
{
if(ord(substr($str,$i,1))=128)
{
$notchinanum++;
}
}
if(($cutleng%2==1)($notchinanum%2==0)) //如果要截取奇数个字符 , 所要截取长度范围内的字符必须含奇数个非汉字,否则截取的长度加一
{
$cutleng++;
}
if(($cutleng%2==0)($notchinanum%2==1)) //如果要截取偶数个字符,所要截取长度范围内的字符必须含偶数个非汉字 , 否则截取的长度加一
{
$cutleng++;
}
return substr($str,0,$cutleng);
}
?
html
head
script type="text/javascript"
function All(e, itemName)
{
var aa = document.getElementsByName(itemName);
for (var i=0; iaa.length; i++)
aa[i].checked = e.checked; //得到那个总控的复选框的选中状态
}
function Item(e, allName)
{
var all = document.getElementsByName(allName)[0];
if(!e.checked) all.checked = false;
else
{
var aa = document.getElementsByName(e.name);
for (var i=0; iaa.length; i++)
if(!aa[i].checked) return;
all.checked = true;
}
}
/script
/head
?php
include("conn.php");
if(isset($_POST['del']))
{
$mm = $_POST["selected"];
$id =implode(",",$mm);
$sql = "delete from forums where id in(".$id.")";
//echo $sql;
$result=mysql_query($sql);
echo $result?"删除成功":"删除失败";
}
?
table style="BORDER-BOTTOM-WIDTH: 1px; BORDER-COLLAPSE: collapse" cellSpacing=0 cellPadding=0 width=600 align=center border=1 bordercolor=#ddddff
tralign=middle
td height=40 bgColor=#DFFFDF colspan=3论坛列表/td
/tr
tr
td colspan=3a href="https://www.04ip.com/post/login.php" style="float:right"[退出系统]/aa href="https://www.04ip.com/post/add_forum.php" style="float:right"[添加论坛]/a/td
td/td
/tr
tralign=middle
td height=40 bgColor=#DFFFDF width=80状态/td
td height=40 bgColor=#DFFFDF论坛/td
td height=40 bgColor=#DFFFDF最后更新/td
/tr
?php
$sql="select * from forums";
$result=mysql_query($sql);
$num=mysql_num_rows($result);
if($num0)
{
while($row=mysql_fetch_array($result)){
?
tr align=middle
td bgColor=#fffbecinput type="checkbox" name="selected" value="https://www.04ip.com/post/1"//td
td height=50 bgColor=#fffbec width=300

推荐阅读