Imitating Oso forums (4)

Source: Internet
Author: User

Reply. php (used to reply to a topic)
<HTML> <Link href = "mypic/style.css" rel = stylesheet type = text/CSS> <? PHP
If (! $ Cook_user)
{Echo "<script language = 'javascript '> ";
Echo "parent. Location. href = 'index. php '";
Echo "</SCRIPT> ";}
Else {include ("Connect. Inc. php ");
$ Query = "select * From my_user where user = '". $ cook_user. "' and Password = '". $ cook_password ."'";
$ Res = mysql_query ($ query );
If (! $ Res)
{Echo "<script language = 'javascript '> ";
Echo "parent. Location. href = 'index. php '";
Echo "</SCRIPT> ";}
Include "Connect. Inc. php ";
If ($ content) {$ content = str_replace ("'", "mysinglequotes", $ content );
$ Content = htmlspecialchars ($ content );
$ Content = nl2br ($ content );
$ Query = "insert into guestbook (name, type, content, icon, time_open, time_close, answer_count, answer_name, main_id) values ('". $ cook_user. "', 0 ,'". $ content. "',". $ icon. ", now (), now (), 1 ,'". $ cook_user. "',". $ theme_id. ")";
$ Res = mysql_query ($ query );
If ($ res)
{$ Query = "Update guestbook set time_close = now (), answer_count = answer_count + 1, answer_name = '". $ cook_user. "'where id =". $ theme_id;
$ Res = mysql_query ($ query );
If ($ res)
{Echo "<script language = 'javascript '> ";
Echo "parent. Location. href = 'Post _ end. php '";
Echo "</SCRIPT> ";}}}}
?>
<Script language = JavaScript>
<! --
VaR submitcount = 0;
Function check_com (){
If (document. Form. theme. value. Length = 0 ){
Submitcount --;
Alert ("the topic cannot be blank! Nyou must supply a subject .");
Return false;
}

If (document. Form. content. value. Length = 0 ){
Submitcount --;
Alert ("add content cannot be blank! Nyou must supply a message .");
Return false;
}
Return true;
}
// -->
</SCRIPT>
<Body bgcolor = # cccc99 bottommargin = 0 leftmargin = 0 topmargin = 0 marginwidth = "0" marginheight = "0">
<Form method = "Post" Action = "reply. php" name = "form" onsubmit = "Return check_com ()">
<Script language = Javascript
Src = "mypic/X. js"> </SCRIPT>
<Tr>
<TD valign = top>
<Table align = center border = 0 cellpadding = 4 cellspacing = 0 width = 100%>
<Tbody>
<Tr>
<TD class = mid width = 20%> reply topic <br> </TD>
<TD class = mid> <a class = title
Href = "read. php? Theme_id = <? PHP echo $ theme_id?> ">
<? PHP
$ Query = "select theme from guestbook where id =". $ theme_id;
$ Res = mysql_query ($ query );
$ ROW = mysql_fetch_row ($ res );
Echo $ row [0];
?>
</A> <br> </TD> </tr>
<Tr>
<TD class = mid valign = top> emoticons </TD>
<TD> <input checked name = icon type = radio value = 1> Align = abscenter Height = 18
Src = "mypic/icon1.gif"
Width = 18> <input name = icon type = radio value = 2> Align = abscenter Height = 18
Src = "mypic/icon2.gif"
Width = 18> <input name = icon type = radio value = 3> Align = abscenter Height = 18
Src = "mypic/icon3.gif"
Width = 18> <input name = icon type = radio value = 4> Align = abscenter Height = 18
Src = "mypic/icon4.gif"
Width = 18> <input name = icon type = radio value = 5> Align = abscenter Height = 18
Src = "mypic/icon5.gif"
Width = 18> <input name = icon type = radio value = 6> Align = abscenter Height = 18
Src = "mypic/icon6.gif"
Width = 18> <input name = icon type = radio value = 7> Align = abscenter Height = 18
Src = "mypic/icon7.gif"
Width = 18> <br> <input name = icon type = radio value = 8> Align = abscenter Height = 18
Src = "mypic/icon8.gif"
Width = 18> <input name = icon type = radio value = 9> Align = abscenter Height = 18
Src = "mypic/icon9.gif"
Width = 18> <input name = icon type = radio value = 10> Align = abscenter Height = 18
Src = "mypic/icon10.gif"
Width = 18> <input name = icon type = radio value = 11> Align = abscenter Height = 18
Src = "mypic/icon11.gif"
Width = 18> <input name = icon type = radio value = 12> Align = abscenter Height = 18
Src = "mypic/icon12.gif"
Width = 18> <input name = icon type = radio value = 13> Align = abscenter Height = 18
Src = "mypic/icon13.gif"
Width = 18> <input name = icon type = radio value = 14> Align = abscenter Height = 18
Src = "mypic/icon14.gif"
Width = 18> </TD> </tr>
<Tr>
<TD class = mid valign = top> <input type = "hidden" name = "theme_id" size = "12" class = "stedit" value = "<? PHP echo $ theme_id?> ">
Add content </TD>
<TD> <textarea Cols = 50 name = content rows = 6> </textarea> </TD> </tr>
<Tr>
<TD> </TD>
<TD> <input name = submit onclick = "Return checksubmit ()" type = submit value = "">
<Input name = reset type = reset value = "clear"> </TD> </tr>
</Form>
<Tr>
<TD colspan = 2> <br> <font color = #797979>
<Li> last five posts in this topic (sorted by post time in reverse order) </font> </LI> </TD> </tr> </tbody> </table>
<Table align = center bgcolor = #000000 border = 0 cellpadding = 4 cellspacing = 1
Width = 100% type = "codeph" text = "/codeph">
<Tbody>
<Tr bgcolor = #666666>
<TD width = "10%"> <font color = # ffffff> operator </font> </TD>
<TD width = "90%"> <font color = # ffffff> internal capacity </font> </TD> </tr>
<? PHP
$ Query = "select * From guestbook where main_id =". $ theme_id. "Or Id =". $ theme_id. "order by time_open DESC limit 5 ";
$ Res = mysql_query ($ query );
Function tdbackcolor (){
Static $ colorstr;
If ($ colorstr = "# ededed "){
$ Colorstr = "# dedede ";
} Else {
$ Colorstr = "# ededed ";
}
Return ($ colorstr );
}
For ($ I = 1; $ I <= 5; $ I ++)
{$ ROW = @ mysql_fetch_array ($ res );
If (! $ Row) break;
$ Colorstr = tdbackcolor ();
Echo "<tr bgcolor =". $ colorstr. "> ";
Echo "<TD valign = top>". $ row ['name']. "</TD> ";
$ Content = str_replace ("mysinglequotes", "'", $ row ['content']);
Echo "<TD>". $ content. "</TD> </tr> ";
}
?>
</Tbody> </table>
</Tbody> </table>
</Form>
</Html>

[This article is copyrighted by the author and osuo. If you need to reprint it, please indicate the author and its source]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.