日韩精品亚洲精品中文字幕乱伦AV|曰韩区二区三区日韩中文字幕五码|ady99久久人人看人人摸人人|动漫一区二区黄99精品视频在线|AV片在线观看亚洲中文国产精品|伦乱在线VA欧美性爱一二区|亚洲无码mv91热色视频|激情六月综合欧美精品中文

當(dāng)前位置:首頁(yè) > 軟件開放 > 正文內(nèi)容

留言板html模板源代碼(留言板html模板源代碼怎么寫)

軟件開放2年前 (2023-04-02)1563

本篇文章給大家談?wù)劻粞园録tml模板源代碼,以及留言板html模板源代碼怎么寫對(duì)應(yīng)的知識(shí)點(diǎn),希望對(duì)各位有所幫助,不要忘了收藏本站喔。

本文目錄一覽:

完整的php&mysql的留言板源代碼,可以運(yùn)行的

input.htm

html

head

meta http-equiv="Content-Language" content="zh-cn"

meta http-equiv="Content-Type" content="text/html; charset=gb2312"

titleinput/title

/head

body

form method="POST" action="receive.php"

p您的姓名: input type="text" name="T1" size="20"/p

p您的性別:男input type="radio" value="0" name="R1"

女input type="radio" name="R1" value="1"/p

p您的EMAIL:input type="text" name="T2" size="35"/p

p您的留言內(nèi)容:/p

p textarea rows="16" name="S1" cols="45"/textarea/p

p /p

p input type="submit" value="提交" name="B1"

input type="reset" value="重置" name="B2"/p

/form

/body

/html

receive.php

?php

$user='root';

$password='123';

$db='guestbook';

$table='gbook';

$ip=getenv(REMOTE_ADDR);

$sql = "INSERT INTO `guestbook`.`gbook` (`id`, `name`, `sex`, `email`, `info`, `ip`, `time_at`) VALUES (NULL, '$T1', '$R1', '$T2', '$S1', '$ip', NOW());";

$connect=mysql_connect('localhost',$user,$password);

mysql_select_db($db);

mysql_query($sql);

$result=mysql_query("select * from $table");

while ($arr=mysql_fetch_array($result))

{

if ($arr[2]==0)

$gender='先生';

else

$gender='女士';

?

html

head

meta http-equiv="Content-Language" content="zh-cn"

meta http-equiv="Content-Type" content="text/html; charset=gb2312"

titleReceive/title

/head

body style="background-attachment: fixed"

table border="1" width="100%" id="table1" bgcolor="#FFFFFF"

tr

td bordercolor="#FFFFFF" bgcolor="#C0C0C0"?=$arr[6]?(?=$arr[5]?)p?=$arr[1]? ?=$gender?a href="?=$arr[3]?"?=$arr[3]?/a

寫到:/td

/tr

tr

td?=$arr[4]?p /p

pa href="del.php?id=?=$arr[0]?"[刪除]/a

a href="modify.php?id=?=$arr[0]?"[修改]/a]/td

/tr

/table

/body

/html

?php

echo 'p';

echo 'p';

}

?

html

head

meta http-equiv="Content-Language" content="zh-cn"

meta http-equiv="Content-Type" content="text/html; charset=gb2312"

title新建網(wǎng)頁(yè) 1/title

/head

body

pa href="input.htm"繼續(xù)留言/a/p

/body

/html

del.php

?php

$user='root';

$password='123';

$db='guestbook';

$table='gbook';

$sql="DELETE FROM $table WHERE id=$id";

$connect=mysql_connect('localhost',$user,$password);

mysql_select_db($db);

$result=mysql_query($sql);

if ($result)

echo "刪除成功";

else

echo "刪除失敗";

?

html

head

meta http-equiv="Content-Language" content="zh-cn"

meta http-equiv="Content-Type" content="text/html; charset=gb2312"

title新建網(wǎng)頁(yè) 1/title

/head

body

pa href="receive.php"返回首頁(yè)/a/p

/body

/html

modify.php

?php

$user='root';

$password='123';

$db='guestbook';

$table='gbook';

$ip=getenv(REMOTE_ADDR);

$connect=mysql_connect('localhost',$user,$password);

mysql_select_db($db);

$result=mysql_query("select * from $table where id=$id");

$arr=mysql_fetch_array($result);

?

html

head

meta http-equiv="Content-Language" content="zh-cn"

meta http-equiv="Content-Type" content="text/html; charset=gb2312"

titleinput/title

/head

body

form method="POST" action="modify_ok.php?id=?=$id?"

p您的姓名: input type="text" name="T1" size="20" value="?=$arr[1]?"/p

p您的性別:

?php

if ($arr[2]==0) echo '男input type="radio" value="0" name="R1" checked

女input type="radio" name="R1" value="1"/p';

else echo '男input type="radio" value="0" name="R1"

女input type="radio" name="R1" value="1" checked/p';

?

p您的EMAIL:input type="text" name="T2" size="35" value="?=$arr[3]?"/p

p您的留言內(nèi)容:/p

p textarea rows="16" name="S1" cols="45" ?=$arr[4]?/textarea/p

p /p

p input type="submit" value="修改" name="B1"

input type="reset" value="重置" name="B2"/p

/form

/body

/html

modify_ok.php

?php

$user='root';

$password='123';

$db='guestbook';

$table='gbook';

$connect=mysql_connect('localhost',$user,$password);

mysql_select_db($db)

$sql = "UPDATE `guestbook`.`gbook` SET `name` = '$T1', `sex` = '$R1', `email` = '$T2', `info` = '$S1' WHERE `gbook`.`id` = '$id' LIMIT 1;";

$result=mysql_query($sql);

if ($result)

echo "修改成功";

else

echo "修改失敗";

?

html

head

meta http-equiv="Content-Language" content="zh-cn"

meta http-equiv="Content-Type" content="text/html; charset=gb2312"

title新建網(wǎng)頁(yè) 1/title

/head

body

pa href="input.htm"繼續(xù)留言/a/p

/body

/html

開源里有沒(méi)有留言板的源代碼,JAVA的

絕對(duì)開源,絕對(duì)明了的留言板,便于學(xué)習(xí)的源碼

用JAVA寫的留言板原代碼

/*

* guestbookServlet.java

*

* */

import javax.servlet.*;

import javax.servlet.http.*;

import java.sql.*;

import java.util.Date;

/**

*

* */

public class guestbookServlet extends HttpServlet {

boolean debug=false;

String sDBDriver;

Connection conn=null;

ResultSet rs=null;

/** Initializes the servlet.

*/

public void init(ServletConfig config) throws ServletException {

super.init(config);

if(debug)

sDBDriver=new String("sun.jdbc.odbc.JdbcOdbcDriver");

else

sDBDriver=new String("org.gjt.mm.mysql.Driver");

try{

Class.forName(sDBDriver);

}

catch(java.lang.ClassNotFoundException e){

System.err.println("Driver類初始化:"+e.getMessage());

}

}

/** Destroys the servlet.

*/

public void destroy() {

}

/** Processes requests for both HTTP codeGET/code and codePOST/code methods.

* @param request servlet request

* @param response servlet response

*/

protected void processRequest(HttpServletRequest request, HttpServletResponse response)

throws ServletException, java.io.IOException {

response.setContentType("text/html;charset=gb2312");

java.io.PrintWriter out = response.getWriter();

boolean empty=true;

boolean noResult=true;

String sqlStr;

int currentPage=0;

int totalPage=0;

int reccount=0;

ResultSet myrs=null;

String username=request.getParameter("username");

String email=request.getParameter("email");

String ucontent=request.getParameter("ucontent");

String ipage=request.getParameter("ipage");

if(ipage==null||ipage.length()==0)

currentPage=1;

else

currentPage=Integer.parseInt(ipage);

if((username==null||username.length()==0)||(ucontent==null||ucontent.length()==0))empty=true;

else empty=false;

Date myDate=new Date();

//String intime=new String(String.valueOf(myDate.getYear()+1990)+String.valueOf(myDate.getMonth()));

String year=String.valueOf(myDate.getYear()+1900);

String month=String.valueOf(myDate.getMonth()+1);

if(month.length()==1)

month=new String("0"+month);

String days=String.valueOf(myDate.getDate());

if(days.length()==1)

days=new String("0"+days);

String hours=String.valueOf(myDate.getHours());

if(hours.length()==1)

hours=new String("0"+hours);

String minutes=String.valueOf(myDate.getMinutes());

if(minutes.length()==1)

minutes=new String("0"+minutes);

String intime=year+"-"+month+"-"+days+" "+hours+":"+minutes;

if(email==null||email.length()==0)

email=new String("");

if(!empty){

//username=convert(username);

//email=convert(email);

//ucontent=convert(ucontent);

sqlStr="insert into Mintegbook(Mname,Memail,Mcontent,Mtime,Mid) values("+username+","+email+","+ucontent+","+intime+",1)";

getDsnConn();

executeInsert(sqlStr);

}

sqlStr=new String("select Mname,Memail,Mcontent,Mtime from Mintegbook order by Mtime DESC");

getDsnConn();

reccount=getRecordCount("Mintegbook");

if(reccount==0)

noResult=true;

else

noResult=false;

if(!noResult){

int ipageSize=10;

totalPage=getTotalPage("Mintegbook",ipageSize);

if(currentPagetotalPage)

currentPage=totalPage;

int cursor=(currentPage-1)*ipageSize+1;

try{

myrs=executeScrollableQuery(sqlStr);

myrs.absolute(cursor);

}

catch(SQLException e){

noResult=true;

}

}

out.println("HTMLHEADTITLE我的Servlet留言板/TITLE");

out.println("META http-equiv="Content-Type" content="text/html; charset=gb2312"");

out.println("STYLE type="text/css"");

out.println("!--");

out.println(".mytext { font-family: "宋體"; font-size: 12px}");

out.println(" --");

out.println("/STYLE");

out.println("/HEAD");

out.println("BODY bgcolor="#FFFFFF" text="#000000"");

out.println("TABLE width="600" border="0" cellspacing="0" cellpadding="0" align="CENTER" class="mytext"");

out.println("TRTD height="22" | a href=""我的主頁(yè)/a | 我的Servlet留言板(A href="mailto:yf188@21cn.com"川石/A制作)/TD/TR");

out.println("TRTD height="1" bgcolor="#999933"/TD/TR");

out.println("/TABLE");

out.println("BR");

out.println("TABLE width="600" border="0" cellspacing="0" cellpadding="0" align="CENTER" class="mytext"");

out.println("TRTD height="8"/TD/TR");

out.println("TRTD height="18" bgcolor="#f7f7f7"DIV align="right"");

out.println("共有 "+reccount + " 條留言 ");

out.println(" 當(dāng)前第font color=#ff0000"+currentPage+"/font/共 "+totalPage+" 頁(yè) ");

if(currentPage1)

out.println(" a href=guestbookServlet?ipage=1首頁(yè)/a a href=guestbookServlet?ipage="+(currentPage-1)+"上一頁(yè)/a ");

else

out.println(" 首頁(yè) 上一頁(yè) ");

if(currentPagetotalPage)

out.println(" a href=guestbookServlet?ipage="+(currentPage+1)+"下一頁(yè)/a a href=guestbookServlet?ipage="+totalPage+"末頁(yè)/a ");

else

out.println(" 下一頁(yè) 末頁(yè) ");

out.println("/DIV/TD/TR");

out.println("/TABLE");

out.println("BR");

//這里是顯示留言內(nèi)容

if(!noResult){

String dname;

String demail;

String dcontent;

String dtime;

Date temptime;

try{

do{

dname=new String(myrs.getString("Mname"));

demail=new String(myrs.getString("Memail"));

dcontent=new String(myrs.getString("Mcontent"));

try{

dtime=new String(myrs.getObject("Mtime").toString());

}

catch(java.lang.NullPointerException e){

dtime=new String("2001-04-06 12:30");

}

if(dname==null)

dname=new String("川石");

if(demail==null)

demail=new String("yf188@21cn.com");

if(dcontent==null)

dcontent=new String("test");

if(dtime==null)

dtime=new String("2001-04-06 12:30");

dname=convert(dname);

dcontent=convert(dcontent);

//temptime=myrs.getDate("Mtime");

/*

String tempyear=String.valueOf(temptime.getYear()+1900);

String tempmonth=String.valueOf(temptime.getMonth()+1);

if(tempmonth.length()==1)

tempmonth=new String("0"+tempmonth);

String tempdays=String.valueOf(temptime.getDate());

if(tempdays.length()==1)

tempdays=new String("0"+tempdays);

String tempminute=String.valueOf(temptime.getMinutes());

if(tempminute.length()==1)

tempminute=new String("0"+tempminute);

String temphours=String.valueOf(temptime.getHours());

if(temphours.length()==1)

temphours=new String("0"+temphours);

String dtime=tempyear+" 年 "+ tempmonth +" 月 "+ tempdays +" 日 " + temphours+ " 時(shí) "+ tempminute + " 分 ";

*/

out.println("TABLE width="600" border="0" cellspacing="0" cellpadding="4" align="CENTER" class="mytext"");

out.println("TRTD姓名 A href="mailto:"+demail+"""+dname+"/A 留言時(shí)間:"+dtime+"/TD/TR");

out.println("TRTD height="10"/TD/TR");

out.println("TRTD height="10""+dcontent+"/TD/TR");

out.println("/TABLE");

out.println("HR width="600" size="1"");

}while(myrs.next());}

catch(SQLException e){

out.println("error found");

}

}

else{

out.println("還沒(méi)有留言!");

}

//結(jié)束

out.println("FORM name="form1" method="post" action="guestbookServlet"");

out.println("TABLE width="600" border="0" cellspacing="0" cellpadding="4" align="CENTER" class="mytext"");

out.println("TRTD width="80"姓名:/TDTDINPUT type="text" name="username"*/TD/TR");

out.println("TRTDEmail:/TDTDINPUT type="text" name="email"*/TD/TR");

out.println("TRTD留言:/TDTDTEXTAREA name="ucontent" cols="65" rows="4"/TEXTAREA/TD/TR");

out.println("/TABLE");

out.println("TABLE width="400" border="0" cellspacing="0" cellpadding="6" align="CENTER" class="mytext"");

out.println("TRTD height="15" width="200" /TDTD /TD/TR");

out.println("TRTDDIV align="RIGHT"INPUT type="button" name="Button" value=" 提 交 " style="cursor:hand" onclick="javascript:check()"/DIV/TD");

out.println("TDINPUT type="reset" name="Submit2" value=" 重 置 "/TD/TR");

out.println("/TABLE");

out.println("/FORM");

out.println("TABLE width="400" border="0" cellspacing="0" cellpadding="4" align="CENTER" class="mytext"");

out.println("TRTD width="15" /TD/TR");

out.println("TRTDDIV align="LEFT"/DIV/TD/TR");

out.println("TRTD /TD/TR");

out.println("/TABLE");

out.println("/BODY");

out.println("/HTML");

out.println("SCRIPT language="javascript"");

out.println("function check(){");

out.println("if(form1.username.value.length1||form1.ucontent.value.length1)");

out.println("{alert(姓名和留言是必須有的!);}else{form1.submit();}}");

out.println("/SCRIPT");

out.close();

}

/** Handles the HTTP codeGET/code method.

* @param request servlet request

* @param response servlet response

*/

protected void doGet(HttpServletRequest request, HttpServletResponse response)

throws ServletException, java.io.IOException {

processRequest(request, response);

}

/** Handles the HTTP codePOST/code method.

* @param request servlet request

* @param response servlet response

*/

protected void doPost(HttpServletRequest request, HttpServletResponse response)

throws ServletException, java.io.IOException {

processRequest(request, response);

}

protected void getDsnConn(){

String sqlUrl="jdbc:mysql://10.0.0.1/你申請(qǐng)用戶名?user=你的名字password=你的帳號(hào)";

try{

if(debug)

conn=DriverManager.getConnection("jdbc:odbc:ODBC源","用戶名","密碼口令");

else

conn=DriverManager.getConnection(sqlUrl);

}

catch(SQLException es){

System.err.println("和庫(kù)連接時(shí)出錯(cuò):"+es.getMessage());

}

}

protected void executeInsert(String sqlStr){

try{

Statement stmt=conn.createStatement();

stmt.executeUpdate(sqlStr);

}

catch(SQLException es){

System.err.println("執(zhí)行插入時(shí):"+es.getMessage());

}

}

protected void executeUpdate(String sqlStr){

try{

Statement stmt=conn.createStatement();

stmt.executeUpdate(sqlStr);

}

catch(SQLException e){

System.err.println("error in query record");

}

}

//查尋

protected ResultSet executeQuery(String sqlStr){

rs=null;

try{

Statement stmt=conn.createStatement();

rs=stmt.executeQuery(sqlStr);

}

catch(SQLException ex){

System.err.println("執(zhí)行查尋出錯(cuò):"+ex.getMessage());

}

return rs;

}

protected ResultSet executeScrollableQuery(String sqlStr){

rs=null;

try{

Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);

rs=stmt.executeQuery(sqlStr);

}

catch(SQLException e){

System.err.println("執(zhí)行動(dòng)態(tài)查尋出錯(cuò)");

}

return rs;

}

//得到表記錄總數(shù)

protected int getRecordCount(String sTableName){

rs=null;

int CountResult=0;

String sqlStr="select count(*) from "+sTableName;

try{

Statement stmt=conn.createStatement();

rs=stmt.executeQuery(sqlStr);

if(rs.next())

CountResult=rs.getInt(1);

rs=null;

stmt.close();

}

catch(SQLException ex){

System.err.println(ex.getMessage());

}

return CountResult;

}

//得到記錄總頁(yè)數(shù)

protected int getTotalPage(String sTableName,int iPageSize){

int totalPage;

int totalRecNum=getRecordCount(sTableName);

if(totalRecNum%iPageSize==0)

totalPage=totalRecNum/iPageSize;

else

totalPage=totalRecNum/iPageSize+1;

return totalPage;

}

protected String convert(String InputStr){

String converted=new String();

byte[] bytes;

try{

bytes=InputStr.getBytes("ISO8859-1");

converted=new String(bytes,"GB2312");

}

catch(java.io.UnsupportedEncodingException e){

System.out.print("error");

}

return converted;

}

/** Returns a short description of the servlet.

*/

public String getServletInfo() {

return "Short description";

}

}

HTML做出來(lái)了一個(gè)留言板界面,但是想要實(shí)現(xiàn)功能還需要怎么操作???

簡(jiǎn)單易懂的就選php(因?yàn)槲揖投@個(gè)哈哈~),用php的話你需要網(wǎng)上下載一個(gè)wamp,安裝,一般安裝在隨便一個(gè)盤的根目錄下,如D:/這樣。比如你裝在D盤,那么在D盤的根目錄會(huì)生成一個(gè)wamp文件夾,這個(gè)文件夾里面有個(gè)www文件夾,www里面就是你要寫代碼放的地方,然后你打開瀏覽器,輸入網(wǎng)址:localhost或者127.0.0.1,出現(xiàn)php界面應(yīng)該就是安裝成功了。你注意電腦屏幕右下角有個(gè)綠色的W標(biāo)志,就是成功啦~

接下來(lái)就是編寫php語(yǔ)言用來(lái)連接數(shù)據(jù)庫(kù)啦

關(guān)于留言板html模板源代碼和留言板html模板源代碼怎么寫的介紹到此就結(jié)束了,不知道你從中找到你需要的信息了嗎 ?如果你還想了解更多這方面的信息,記得收藏關(guān)注本站。

掃描二維碼推送至手機(jī)訪問(wèn)。

版權(quán)聲明:本文由飛速云SEO網(wǎng)絡(luò)優(yōu)化推廣發(fā)布,如需轉(zhuǎn)載請(qǐng)注明出處。

本文鏈接:http://www.atlasseeker.com/post/15068.html

“留言板html模板源代碼(留言板html模板源代碼怎么寫)” 的相關(guān)文章

軟件開發(fā)報(bào)價(jià)表(軟件開發(fā)報(bào)價(jià)表怎么做)

軟件開發(fā)報(bào)價(jià)表(軟件開發(fā)報(bào)價(jià)表怎么做)

今天給各位分享軟件開發(fā)報(bào)價(jià)表的知識(shí),其中也會(huì)對(duì)軟件開發(fā)報(bào)價(jià)表怎么做進(jìn)行解釋,如果能碰巧解決你現(xiàn)在面臨的問(wèn)題,別忘了關(guān)注本站,現(xiàn)在開始吧!本文目錄一覽: 1、軟件怎么開發(fā)要多少錢 2、開發(fā)一款視頻直播App軟件需要多少錢 3、app開發(fā)報(bào)價(jià)單,開發(fā)一個(gè)APP要多少錢 4、定制開發(fā)軟件一般要...

常德軟件開發(fā)(常德軟件開發(fā)中職學(xué)校)

常德軟件開發(fā)(常德軟件開發(fā)中職學(xué)校)

本篇文章給大家談?wù)劤5萝浖_發(fā),以及常德軟件開發(fā)中職學(xué)校對(duì)應(yīng)的知識(shí)點(diǎn),希望對(duì)各位有所幫助,不要忘了收藏本站喔。 本文目錄一覽: 1、常德職業(yè)技術(shù)學(xué)院專業(yè)軟件開發(fā)專業(yè)好賺錢嗎 2、常德市沅夢(mèng)網(wǎng)絡(luò)科技有限公司怎么樣? 3、常德市樂(lè)學(xué)軟件開發(fā)有限公司怎么樣? 常德職業(yè)技術(shù)學(xué)院專業(yè)軟件開發(fā)專業(yè)好賺...

免費(fèi)交友軟件不需充值暢聊不用登陸(不充值聊天交友軟件)

免費(fèi)交友軟件不需充值暢聊不用登陸(不充值聊天交友軟件)

今天給各位分享免費(fèi)交友軟件不需充值暢聊不用登陸的知識(shí),其中也會(huì)對(duì)不充值聊天交友軟件進(jìn)行解釋,如果能碰巧解決你現(xiàn)在面臨的問(wèn)題,別忘了關(guān)注本站,現(xiàn)在開始吧!本文目錄一覽: 1、不用充值的免費(fèi)交友軟件有沒(méi)有? 2、免費(fèi)交友聊天不花錢軟件有哪些? 3、免費(fèi)無(wú)限暢聊的聊天軟件 不用充值的免費(fèi)交友軟件...

如何自己創(chuàng)造游戲(如何自己創(chuàng)作一個(gè)游戲)

如何自己創(chuàng)造游戲(如何自己創(chuàng)作一個(gè)游戲)

今天給各位分享如何自己創(chuàng)造游戲的知識(shí),其中也會(huì)對(duì)如何自己創(chuàng)作一個(gè)游戲進(jìn)行解釋,如果能碰巧解決你現(xiàn)在面臨的問(wèn)題,別忘了關(guān)注本站,現(xiàn)在開始吧!本文目錄一覽: 1、如何自己創(chuàng)作一個(gè)游戲 2、如何自己制作游戲 3、怎么創(chuàng)造游戲 4、如何自制游戲? 5、如何制作游戲 如何自己創(chuàng)作一個(gè)游戲 自...

哈薩克直播平臺(tái)App下載(哈薩克直播軟件下載)

哈薩克直播平臺(tái)App下載(哈薩克直播軟件下載)

今天給各位分享哈薩克直播平臺(tái)App下載的知識(shí),其中也會(huì)對(duì)哈薩克直播軟件下載進(jìn)行解釋,如果能碰巧解決你現(xiàn)在面臨的問(wèn)題,別忘了關(guān)注本站,現(xiàn)在開始吧!本文目錄一覽: 1、女王直播蘋果怎么下載 2、有沒(méi)有在線觀看的直播 3、看直播的軟件有哪些 4、直播app哪個(gè)好用? 5、哈薩克語(yǔ)電影應(yīng)用軟...

梵客家裝公司地址(梵客家裝公司在哪)

梵客家裝公司地址(梵客家裝公司在哪)

今天給各位分享梵客家裝公司地址的知識(shí),其中也會(huì)對(duì)梵客家裝公司在哪進(jìn)行解釋,如果能碰巧解決你現(xiàn)在面臨的問(wèn)題,別忘了關(guān)注本站,現(xiàn)在開始吧!本文目錄一覽: 1、北京的裝修公司太多了,排前靠前的有哪些? 2、北京前十公裝公司有哪些? 3、北京裝修公司口碑十大排名 4、北京附近裝修公司推薦 北京的...