BBS (PhP MySQL) Full Version (1)

Source: Internet
Author: User

// This page is "say. php"
<?
Include "signup/MySQL. Inc ";
If ($ id1 ){
$ SQL = "select * from $ table where id = '$ id1'"; // a reply question is displayed.
$ Result = mysql_query ($ SQL) or die (mysql_error ());
$ ROW = mysql_fetch_array ($ result );
$ Title = "re:". $ row ["title"];

}

$ IP = $ remote_addr;
$ SQL = "select * From user_stus where IP = '$ ip'"; // query the current user name
$ Result = mysql_query ($ SQL) or die (mysql_error ());
$ ROW = mysql_fetch_array ($ result );

If (! $ Row) // determine whether the user logs in
{

Echo "<HTML> <Div id = Layer2 align = center Z-index: 1> <br> ";
Echo "<Div id = layer3 align = center Z-index: 2> </div> ";
Echo "<Div align = center> ";
Echo "<p> <font size = 2 color = # ff33cc> Hey !! Please log on first </font> </P> ";
Echo "<p> <font size = 2 color = # ff33cc> <a href = '". $ php_self ."? P = 1 & table = $ table '> return </a> </font> </P> </div>

Exit ();
}

Else $ userid = $ row ["userid"];

If ($ OK)
{

If ($ Title = "" | $ content = "")
{
Echo "<br> Please complete it and submit it ";

}
Else {
$ Id = Time (); // submitArticle
$ Date1 = date ("Y/M/D ");
$ Title = htmlspecialchars ($ title );
$ Content = htmlspecialchars ($ content );

$ SQL = "select * from". $ table;
$ Result = mysql_query ($ SQL) or die (mysql_error ());
$ Row1 = mysql_num_rows ($ result );
$ Row1 ++;

If ($ id1 ){

$ SQL = "insert into bbs_re (ID, userid, date1, title, content) values ('$ id',' $ userid', '$ date1', '$ title ', '$ content ')";
Mysql_query ($ SQL) or die (mysql_error ());
$ SQL = "select * from". $ table. "Where id = '$ id1 '";
$ Result = mysql_query ($ SQL) or die (mysql_error ());
$ Lin = mysql_fetch_array ($ result );
For ($ I = 1; $ I <6; $ I ++)
{
$ Re = "r". $ I;
If (! $ LiN ["$ re"])
Break;
}
$ SQL = "Update". $ table. "set". $ re. "= '$ id' where id =' $ id1 '";

}
Else
$ SQL = "insert ". $ table. "(ID, userid, date1, title, content, row) values ('$ id',' $ userid', '$ date1', '$ title ', '$ content',' $ row1 ')";
$ Result = mysql_query ($ SQL) or die (mysql_error ());

If ($ result)
{

Header ("Location: php3.php? P = 1 & table = $ table ");
Exit;
}
}
}

?>

<HTML>
<Head>
<Title> Xiaoyang </title>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312">
<Script language = "javascript1.2" src = "JS/menu_comment.js"> </SCRIPT>
<Script language = "javascript1.2" src = "JS/fw_menu.js"> </SCRIPT>
<Script language = "JavaScript">
<! --
Function mm_reloadpage (init) {// reloads the window if nav4 resized
If (init = true) with (Navigator) {If (appname = "Netscape") & (parseint (appversion) = 4 )){
Document. mm_pgw = innerwidth; document. mm_pgh = innerheight; onresize = mm_reloadpage ;}}
Else if (innerwidth! = Document. mm_pgw | innerheight! = Document. mm_pgh) location. Reload ();
}
Mm_reloadpage (true );
// -->
</SCRIPT>
</Head>

<Body bgcolor = "# ffffff" text = "#000000">
<Div id = "layer1" style = "position: absolute; left: 31px; top: 1px; width: 560px; Height: 46px; Z-index: 10">
<Script language = "javascript1.2"> fwloadmenus (); </SCRIPT> </div>

<Div id = "layer6" style = "position: absolute; left: 409px; top: 29px; width: 118px; Height: 17px; Z-index: 6 "> </div>
<Div id = "layer5" style = "position: absolute; left: 86px; top: 63px; width: 464px; Height: 303px; Z-index: 7">
<Form name = "form1" method = "Post" Action = "<? Echo $ php_self?> ">
<Table width = "98%" border = "1" cellspacing = "0" cellpadding = "0" bordercolor = "# ff99ff">
<Tr>
<TD width = "26%" Height = "42">
<Div align = "center"> <font size = "2" color = "# ff33ff"> question </font> </div>
</TD>
<TD width = "74%" Height = "42">
<Input type = "text" name = "title" size = "40" value = "<? Echo $ title;?> "Onmouseover =" this.doc ument. form1.title. Focus (); Return true ">
<Input type = "hidden" name = "table" value = "<? Echo $ table;?> ">
<Input type = "hidden" name = "id1" value = "<? Echo $ id1;?> ">
<Br>
</TD>
</Tr>
<Tr>
<TD width = "26%" Height = "172">
<Div align = "center"> <font size = "2" color = "# ff33ff"> content </font> </div>
</TD>
<TD width = "74%" Height = "172">
<Textarea name = "content" Cols = "40" rows = "10" Wrap = "physical" value = "<? Echo $ content;?> "Onmouseover =" this.doc ument. form1.content. Focus () "> </textarea>
</TD>
</Tr>
<Tr>
& Lt; TD width = "26%" & gt;
<Div align = "center">
<Input type = "reset" name = "submit2" value = "Rewrite">
</Div>
</TD>
& Lt; TD width = "74%" & gt;
<Div align = "center">
<Input type = "Submit" name = "OK" value = "">
</Div>
</TD>
</Tr>
</Table>
<P> </P>
</Form>
</Div>
<Div id = "back" style = "position: absolute; left: 455px; top: 30px; width: 85px; Height: 3px; Z-index: 8">
<HR color = "# ff9999" noshade>
</Div>
<Div id = "Goback" style = "position: absolute; left: 461px; top: 23px; width: 120px; Height: 16px; Z-index: 9">
<Div align = "center"> <a href = "php3.php? P = 1 & table = <? Echo $ table;?> "Target =" _ Self "onmouseover =" window. status = ''; return true"> <font size = "2" color = "# ff33ff"> return </font> </a> </div>
</Div>
<P> </P>
<P> </P>
</Body>
</Html>

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.