显示ID 问个问题,比如我现在登录csdn这个论坛吧!,登录后自动跳转到csdn首页吧!如何在首页上面显示自己所登录的ID如(欢迎inthello(显示我这个用户名) 我的:收件箱资源博客空间设置|帮助|退出) 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你多增加个id查询不就行了。比如你取出sql里的用户记录,字段分别是:id,username,psw,logintime……取出的时候,把username也显示出来不就可以了 登录验证的时候登录通过 将用户名赋值给 全局变量 例如$_SESSION['username'] 然后在需要的页面读取这个变量. 不会啊。。帮忙做个示范<?phpinclude "comm.php";?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>无标题文档</title></head><link rel="stylesheet" type="text/css" href="css.css"><body><script type="text/javascript">function check(){ if(myform.username.value==""){ alert("用户名不能为空!"); return false; } if(myform.pw.value=="" | myform.pw1.value==""){ alert("密码不能为空!"); return false; } if(myform.pw.value!=myform.pw1.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("e7"); $sql = "insert into e7_user (user_name,pw) values('$user','$pw')"; mysql_query("set names 'gb2312'"); mysql_query($sql,$conn); mysql_close($conn); get_show_msg("index.htm","注册成功"); }?> <div id="warp"> <div id="head"></div> <div id="mainbav"> <ul> <li><a href="index.htm">首页</a></li> </ul> </div> <div id="content"> <div class="conte"> <form action="" method="post" id="myform" name="myform" onsubmit="return check();"><table width="600" height="300" border="1" cellspacing="1" cellpadding="1" align="center"> <tr> <td align="center">游戏账号注册</td> </tr> <tr> <td> 账号注册:<input type="text" name="username" id="username"></td> </tr> <tr> <td> 密码:<input type="password" name="pw" id="pw"></td> </tr> <tr> <td>再次确定密码:<input type="password" name="pw1" id="pw1"></td> </tr> <tr> <td align="center"><input type="submit" id="sub" value="确定"></td> </tr></table></form> </div> </div> </div></body></html> 建议你去网上下载一套 php用户注册系统 来研究研究。 http://www.5idev.com/p-php_user_login.shtml 二次开发思路求指导 phpexcel编写技巧 正则高手来解决一下(50)分.在线等 谁有好的php防SQL注入通用代码,谢谢 php curl模拟提交 请教一个类实例化的疑难问题 PHP拨号程序的ADSL table内循环(smarty) WINDOWS2003下PHP网站总是出错 怎么用PHP写一个图片社交app的后台? 问一个比较弱弱的问题 急。PHP,ADODB 类库,如何连接oracle数据库并查询出数据
id,username,psw,logintime……
取出的时候,把username也显示出来不就可以了
<?php
include "comm.php";
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<link rel="stylesheet" type="text/css" href="css.css">
<body>
<script type="text/javascript">
function check(){
if(myform.username.value==""){
alert("用户名不能为空!");
return false;
}
if(myform.pw.value=="" | myform.pw1.value==""){
alert("密码不能为空!");
return false;
}
if(myform.pw.value!=myform.pw1.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("e7");
$sql = "insert into e7_user (user_name,pw) values('$user','$pw')";
mysql_query("set names 'gb2312'");
mysql_query($sql,$conn);
mysql_close($conn);
get_show_msg("index.htm","注册成功");
}
?>
<div id="warp">
<div id="head"></div>
<div id="mainbav">
<ul>
<li><a href="index.htm">首页</a></li>
</ul>
</div>
<div id="content">
<div class="conte">
<form action="" method="post" id="myform" name="myform" onsubmit="return check();">
<table width="600" height="300" border="1" cellspacing="1" cellpadding="1" align="center">
<tr>
<td align="center">游戏账号注册</td>
</tr>
<tr>
<td> 账号注册:<input type="text" name="username" id="username"></td>
</tr>
<tr>
<td> 密码:<input type="password" name="pw" id="pw"></td>
</tr>
<tr>
<td>再次确定密码:<input type="password" name="pw1" id="pw1"></td>
</tr>
<tr>
<td align="center"><input type="submit" id="sub" value="确定"></td>
</tr>
</table>
</form>
</div>
</div>
</div>
</body>
</html>