帮我看下,数据库没内容呐,但是我看着感觉没错呀
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<style type="text/css">
body{background-color:#CCCCCC;
margin:0px;}
.head{height:300px;
text-align:center;}
.gong{height:20px;
background-color:#33CCFF;}
</style>
<body>
<div class="head">
<div class="gong">用户登录</div>
<form method="post" action="" name="myform">
用户<input type="text" name="username"><br>密码<input type="password" name="pw"><br><input type="submit" name="submit" value="提交"><input type="reset" name="reset" value="重置">
<A href="register.php">用户注册</A>
</form>
</div>
</body>
</html><?php
include "comm.php";
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML xmlns="http://www.w3.org/1999/xhtml">
<HEAD><TITLE>在线留言-留言板</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
</HEAD>
<BODY>
<script type="text/javascript">
function check(){
if(myform.name.value==""){
alert("用户名不能为空!");
return false;
}
if(myform.pw1.value=="" | myform.pw2.value==""){
alert("密码不能为空!");
return false;
}
if(myform.pw1.value!=myform.pw2.value){
alert("两次输入的密码不一致!")
return false;
}
return true;
}
</script>
<?php
if(isset($_POST['username'])){
$user = $_POST['username'];
$pw = md5($_POST['pw1']); $conn = mysql_connect("localhost","root","123456");
mysql_select_db("car");
$sql = "insert into car_user (user_name,pw) values('$user','$pw')";
mysql_query("set names 'gb2312'");
mysql_query($sql,$conn);
mysql_close($conn);
get_show_msg("left.html","注册成功");
}
?> <FORM id=myform name=myform action="" method=post onsubmit="return check();">
<INPUT id=name size=10 name=username><br>第一次密码:<INPUT id=pw1 size=30 type=password name=pw1><br>第二次密码<INPUT id=pw2 size=30 type=password name=pw2><br>
<input type="submit" name="submit" value="提交"><input type="reset" name="reset" value="重置">
</FORM>
</BODY>
</HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<style type="text/css">
body{background-color:#CCCCCC;
margin:0px;}
.head{height:300px;
text-align:center;}
.gong{height:20px;
background-color:#33CCFF;}
</style>
<body>
<div class="head">
<div class="gong">用户登录</div>
<form method="post" action="" name="myform">
用户<input type="text" name="username"><br>密码<input type="password" name="pw"><br><input type="submit" name="submit" value="提交"><input type="reset" name="reset" value="重置">
<A href="register.php">用户注册</A>
</form>
</div>
</body>
</html><?php
include "comm.php";
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML xmlns="http://www.w3.org/1999/xhtml">
<HEAD><TITLE>在线留言-留言板</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
</HEAD>
<BODY>
<script type="text/javascript">
function check(){
if(myform.name.value==""){
alert("用户名不能为空!");
return false;
}
if(myform.pw1.value=="" | myform.pw2.value==""){
alert("密码不能为空!");
return false;
}
if(myform.pw1.value!=myform.pw2.value){
alert("两次输入的密码不一致!")
return false;
}
return true;
}
</script>
<?php
if(isset($_POST['username'])){
$user = $_POST['username'];
$pw = md5($_POST['pw1']); $conn = mysql_connect("localhost","root","123456");
mysql_select_db("car");
$sql = "insert into car_user (user_name,pw) values('$user','$pw')";
mysql_query("set names 'gb2312'");
mysql_query($sql,$conn);
mysql_close($conn);
get_show_msg("left.html","注册成功");
}
?> <FORM id=myform name=myform action="" method=post onsubmit="return check();">
<INPUT id=name size=10 name=username><br>第一次密码:<INPUT id=pw1 size=30 type=password name=pw1><br>第二次密码<INPUT id=pw2 size=30 type=password name=pw2><br>
<input type="submit" name="submit" value="提交"><input type="reset" name="reset" value="重置">
</FORM>
</BODY>
</HTML>
解决方案 »
- 上传xls文档,其中一个列的值太长,读取到的变成科学计数法,详细见内容
- 积分严重缺乏,谁给我一点?需要下载很多资料准备毕业设计!
- 各位会php的加下小滴,想请大家帮忙改个小
- Fri Oct 29 16:17:46.356 2010 这是什么时间格式?
- php文本输入问题
- 按日期检索的问题
- 无法获取$_SERVER["HTTP_REFERER"]
- 关于写文件。怎么会这样呢?各位碰过吗?
- 聊天室主显示发言部分自动刷屏,而下框架输入部分不刷新,怎么做到?(50分)
- 有个这样的问题,关于验证码显示不了,我这边 php.ini文件中extention=php.gd2.dll这文件都打开了,但是还是显示不了,有人回答一下不
- 想不明白的PHP正则问题
- 求助:用fckeditor上传的flash不能显示
#js中pw1、pw2未定义,return停掉了,下面的代码就未执行
if(myform.pw1.value=="" | myform.pw2.value==""){
alert("密码不能为空!");
return false;
}
#改为
<input type="password" name="pw1"><br>
#后面添加
<input type="password" name="pw2"><br>#导致php页面
$pw = md5($_POST['pw1']); #没有值,不信你echo出来试试
需改为:
$conn = mysql_connect("localhost","root","123456");
mysql_select_db("car");
$sql = "insert into car_user (user_name,pw) values('$user','$pw')";
mysql_query("set names 'gb2312'");
$res = mysql_query($sql,$conn);
#如果sql未执行成功,将错误打印出来
if(!$res)
die("SQL:{$sql}<br>Error:".mysql_error());
if(mysql_affected_rows() > 0)
get_show_msg("left.html","注册成功");
else
echo "注册失败".mysql_error();
mysql_close($conn);