PHP实现留言板功能

作为一个PHP的初学者,我试着写了一个留言板,页面有点丑,多多见谅,嘻嘻嘻
#我们写留言板需要用到数据库,所以我们先要建立三个表
user表

friend表

text表

#首先需要写一个注册与登录

##注册
zhuce.html

<meta charset="utf-8">
<title>zhuce</title>
</head>
<body>
<form method="POST" action="zhuce.php">
<div style="margin-left: 500px;margin-top:200px;height: 250px;width: 250px">
<h1>用户注册页面</h1>
用户名:<input type="text" name="username">
<div>密&nbsp;&nbsp;&nbsp;码:<input type="password" name="password">
<div><input type="submit"  name="submit" value="注册"></div>
</div>
</form>
</body>

zhuce.php

<?php
session_start();
header("Content-type: text/html; charset=utf-8"); //处理数据库用户名乱码
$user=$_POST["username"];
$pwd=$_POST["password"];
if($user==""||$pwd=="")
	 {
      	echo "<script>alert('请确认信息完整性!'); history.go(-1);</script>";  
	 }
else 
   	{
	 		
 			$link=mysqli_connect("localhost","root","","liuyan");//连接数据库
	 		mysqli_query($link,"set names utf8"); 
	 		$sql="select username from user where username='$_POST[username]'";
        	$result=mysqli_query($link,$sql);//执行sql语句
    
评论 16
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值