数据库php登陆注册 数据库php登陆注册失败( 二 )


{
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
?php
echo "diva href=https://www.04ip.com/"forums.php?F=".$row['ID']."\"".$row['forum_name']."/a/div";
echo cutstr($row['forum_description'],24);//最多显示24个字节 , 12个字,多余部分用省略号代替
echo "……";
?
/td
td height=50 bgColor=#fffbecdiv?php echo $row['last_post_time']."by".$row['last_post_author']?/div/td
/tr
?php
}
}
else
{
echo "tr bgColor=#fffbectd colspan=3对不起,论坛尚在创建中……/td/tr";
}
?
tr
td colspan=3input type="checkbox" name="selected" value="https://www.04ip.com/post/1" onclick="All(this,'selected')"/全选/不全选/td
/tr
tr
tdinput type="button" name="del" id="del" value="https://www.04ip.com/post/删除选中项"/
?php
?
/td
/tr
/table
/html
数据库你就自己建,望采纳~
php+mysql怎么做登录注册首先得到提交的数据
链接数据库,查询数据库,查询username 和pwd
提交的username 和 pwd跟数据库查询的username 和pwd做对比,
都相等那就是登陆成功
?php
mysql_connect('localhost','root','123');
mysql_select_db('lx');
mysql_query("SET CHARACTER SET utf8");
mysql_query("SET NAMES utf8");
//数据库lx 表user字段id usernamepwd
//用md5加密,可以自己试试
if(isset($_POST['user'])$_POST['tijiao'] == 'success'){

推荐阅读