MySQL-based forum (6) _php Tutorial

Source: Internet
Author: User
# post.php
Require ("config.inc.php");
$sql = "SELECT * from Boardinfo where name= ' $board '";
$sql _result=mysql_query ($sql);
$sql _row=mysql_fetch_array ($sql _result);
?>


<title>Post new posts</title>
















Posting Sub

(You must register to post a new topic, otherwise you can only view the topic.)

If you are not yet registered, please click here to go to the registration page.


Your posts will be published in the section








# query.php
Require ("func.php");
$sql = "SELECT * from Boardinfo";
$sql _result=mysql_query ($sql);
?>


<title>Main</title>



















forum posts Query



Forum Information





# query_list.php
Require ("func.php");
if (!empty ($query _str)) {

if (!is_board_exits ($board)) {
$board = "Computer";
}
if ($title) {
$submit = "title";
}
ElseIf ($cont) {
$submit = "cont";
}
ElseIf ($writer) {
$submit = "Writer";
}
else {
$submit = "title";
}
$sql = "SELECT * from $board where ($submit like '% $query _str% ')";
$temp =mysql_query ($sql);
$sum =mysql_num_rows ($temp);
if ($sum!=0) {
$sql = "SELECT * from Boardinfo where name= ' $board '";
$sql _result=mysql_query ($sql);
$sql _row=mysql_fetch_array ($sql _result);
$chinesename = $sql _row[chinesename];
Setcookie ("Jl_forum[chinesename]", $chinesename);
$sql = "SELECT name from user where slaveboard= ' $board '";
$sql _result=mysql_query ($sql);
?>


<title>List</title>















Layout: echo $chinesename;
?>
Moderator: While ($sql _row=mysql_fetch_array ($sql _result))
{
echo "$sql _row[name]". ";
}
# Select a message record;

$totalpage =ceil ($sum/$pagesize);
# pagination
if ($page <1 or Empty ($page)) {
$page = 1;
}
ElseIf ($page > $totalpage) {
$page = $totalpage;
}
ElseIf ($totalpage ==0) {
$page = 0;
}
$offset = ($page-1) * $pagesize;
$sql = "SELECT * from $board the WHERE ($submit like '% $query _str% ') the ORDER by id desc limit $offset, $pagesize";
$sql _result=mysql_query ($sql);
?>
Query to Records ") ' >


























while ($sql _row=mysql_fetch_array ($sql _result)) {echo " "; Echo "; Echo "; Echo "; Echo "; Echo "; } ? >
Response Topic Time Popularity
";
echo "[*]";
Echo
$sql _row[title]$sql _row[writetime]$sql _row[hits]







}
Else
{
Show_error (10);
}
}
else {
Show_error (9);
}
# read.php
Require ("func.php");
if ($re) {
$sql = "Select SlaveID from $board where id= $id";
$sql _result=mysql_query ($sql);
$sql _row=mysql_fetch_array ($sql _result);
if ($sql _row[slaveid]!=0) {
Show_error (1);
$founderr = 1;
}
if (!check_user_password ($name, $password)) {
Show_error (4);
$founderr = 1;
}
if (empty ($title)) {
Show_error (2);
$founderr = 1;
}
if ($QM) {
$QM =EXPL_QM ($name);
}
if (! $founderr) {
Re_doc ($board, $id);
Setcookie ("Jl_forum[name]", $name);
$sql = "SELECT * from $board where id= $id";
$sql _result=mysql_query ($sql);
$sql _row=mysql_fetch_array ($sql _result);
$title = $sql _row[title];
$writer = $sql _row[writer];
$cont = $sql _row[cont];
$writetime = $sql _row[writetime];
$hits = $sql _row[$hits];
$FROMIP = $sql _ROW[FROMIP];
$sql = "SELECT * from $board where slaveid= $id";
$sql _result=mysql_query ($sql);
# $sql _row=mysql_fetch_array ($sql _result);
}

}
ElseIf ($add) {
if (!is_board_exits ($board)) {
Show_error (7);
$founderr = 1;
}
if (empty ($title)) {
Show_error (2);
$founderr = 1;
}
if (!check_user_password ($name, $password)) {
Show_error (4);
$founderr = 1;
}
if ($QM) {
$QM =EXPL_QM ($name);
}
if (! $founderr) {
Add_doc ($board);
$add = 1;
Setcookie ("Jl_forum[name]", $name);
}
}
else {
if (!is_board_exits) {
Show_error (7);
}
Add_one_hit ($board, $id);
$sql = "SELECT * from $board where id= $id";
$sql _result=mysql_query ($sql);
$sql _row=mysql_fetch_array ($sql _result);
$title = $sql _row[title];
$writer = $sql _row[writer];
$cont = $sql _row[cont];
$writetime = $sql _row[writetime];
$hits = $sql _row[$hits];
$FROMIP = $sql _ROW[FROMIP];
$sql = "SELECT * from $board where slaveid= $id";
$sql _result=mysql_query ($sql);
# $sql _row=mysql_fetch_array ($sql _result);
}
?>


<title><?php echo $title;? ></title>























Title:
Author: ( ) ">" >
※ Source: [from: ]



if ($add!=1) {
while ($sql _row=mysql_fetch_array ($sql _result)) {
?>













Title:
Author: ( ) ">" >
※ Source: [from: ]

}
?>




http://www.bkjia.com/PHPjc/316374.html www.bkjia.com true http://www.bkjia.com/PHPjc/316374.html techarticle # post.php PHP require (config.inc.php); $sql =select * from Boardinfo where name= ' $board '; $sql _result=mysql_query ($ SQL); $sql _row=mysql_fetch_array ($sql _result);? HTML head title hair ...

  • 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.