日期:2014-05-17  浏览次数:20822 次

帮忙写一下代码 江湖救急

登录上显示操作用户名 还能与其他网页链接

------解决方案--------------------
http://article.pchome.net/content-175657.html
------解决方案--------------------
http://blog.csdn.net/abcjennifer/article/details/5577283
------解决方案--------------------
给你我的php代码,你自己改改就好了

<div>
<fieldset>
<!--user login form-->
<legend>Login</legend>
<form name="LoginForm" method="post" action="login.php" onSubmit="return InputCheck(this)">
<p>
<label for="username" class="label">Username:</label>
<input id="username" name="username" type="text" class="input" />
<p/>
<p>
<label for="password" class="label">Password:</label>
<input id="password" name="password" type="password" class="input" />
<p/>
<p>
<input type="submit" name="submit" value="Submit" class="left" />
</p>
<?php
echo 'Click <a href="userreg.php">here</a> to register.<br />';
?>
</form>
</fieldset>
</div>


<?php
session_start();
?>

<HTML>
<head>
<title>Login</title>
<link rel="stylesheet" href="all.css" media="screen">
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
</head >
<body>
<a href="../index.php"><img src="../pic/logo.png"></a>
<br>
<!--navigation bar-->
<a href="../index.php">Home</a> <span> > </span> <a>Login</a>
<br>
<br>
</body >
</HTML>

<?php
//user logged out
if(isset($_GET["action"]) && $_GET['action'] == "logout"){
unset($_SESSION['userid']);
unset($_SESSION['username']);
echo 'Logout! <br/> Click <a href="userlogin.php">here</a> to login.<br />';
echo 'Click <a href="userreg.php">here</a> to register.<br />';
exit;
}

if(!isset($_POST['submit'])){
exit('Forbidden!');
}
//check if user logged in
$username = $_POST['username'];
$password = $_POST['password'];
include('database.php');

$check_query = mysql_query("SELECT username FROM&