留言板相關功能

2022-09-14 07:06:11 字數 3621 閱讀 8020

下面是**

"zh

">

使用者名稱:"

text

" name="

name

" id="

name

" />

密碼:"

password

" name="

mima

" id="

mima

" />

"submit

" value="

登陸" onclick="

denglu()

"/>

接下來是登入處理頁面:

<?php 

session_start();

$type =$_post['

type'];

$name =$_post['

name'];

$mima =$_post['

mima'];

$conn =new mysqli("

localhost

","root

","","

ceshi3");

$conn->connect_error?die("

鏈結失敗

"):""

; $sql = "

select * from yuangong where username = ''";

$result = $conn->query($sql);

$attr = $result->fetch_all();

if($attr[0][1] ==$mima)

else

?>

接下來進行跳轉,跳轉到系統主頁的收件箱頁面包含已讀未讀等功能。

"zh

">"

tuichu.php

">退出系統

class="

daohang

">

class="

liebiao

" onclick="

shoujian()

" >收件箱

class="

liebiao

" onclick="

fajian()

">發件箱

class="

neirong

" >

class="

container

">

class="

modal fade

" id="

mymodal

">

class="

modal-dialog

">

class="

modal-content

">

class="

modal-header

">

class="

modal-title

">內容

"button

"class="

close

" data-dismiss="

modal

">×

class="

modal-body

">

class="

modal-footer

">

"button

"class="

btn btn-secondary

" data-dismiss="

modal

">關閉

接下來是系統的處理頁面

<?php 

session_start();

$type =$_post['

type'];

$conn = new mysqli("

localhost

","root

","","

ceshi3");

$conn->connect_error?die("

鏈結失敗

"):""

;

switch

($type)' or recever='all'";

$result = $conn->query($sql);

$attr =$result->fetch_all();

echo json_encode($attr);

break

;

case

"yuedu":

$bb = $_post['bb'

]; $sql = "

update liuyan set states = 1 where ids = ''";

$result = $conn->query($sql);

//$attr =$result->fetch_all();

$name = $_session["

name

"];

$sql = "

select * from liuyan where recever = '' or recever='all'";

$result = $conn->query($sql);

$attr = $result->fetch_all();

echo json_encode($attr);

break

; }

?>

最後這是乙個退出頁面:返回登入頁面

<?php 

session_start();

unset($_session[

"uid

"]);

header(

"location:zhuye.php");

?>

最後  乙個註冊的驗證:

"zh

">註冊賬號:

"username

" type="

text

" />密碼:

"mima

" type="

text

"/>

"tianjia()

">提交

輸入使用者名稱時   實時後台資料監測使用者名稱是否被占用;下面是處理頁面

<?php 

$username =$_post['

username'];

$conn =new mysqli("

localhost

","root

","","

ceshi3");

$conn->connect_error?die("

鏈結失敗

"):""

; $sql = "

select count(*) from yuangong where username = ''";

$result = $conn->query($sql);

$attr = $result->fetch_all();

echo $attr[

0][0

];?>

實現留言板功能

登入 登入資訊處理 登入處理 登入首頁 首頁 處理 注意事項及其解決辦法 1.當乙個變數需要每個頁面都需要用到時候 一 定義乙個變數傳給每個頁面 名字最好相同 二 session uid 變數 在每個頁面都寫,寫的頁面通用乙個變數 2.資料庫傳值問題 當資料庫字元長度規定長度為0時不能傳值 字元型別...

留言板骨架

顯示頁 form action lyb index.php index insert.html method post input name text type text value 表單提交 action位址要換成thinkphp裡的u方法,也就是去控制器裡找方法,這個方法負責接收post來的資料...

PHP留言板 一看就會的留言板

1.資料庫建立乙個message表用來儲存資料 2.連線資料庫 我是原生代pdo host 127.0.0.1 port 3306 埠 username root 使用者名稱 password root 密碼 dbname 表名 dsn mysql dbname dbname host host 拼...