A paging forum

Source: Internet
Author: User
Tags date count mail printf reset
-------------------------------Forum--------------------------
Data tables
CREATE TABLE guest (ID int not NULL auto_increment,primary key (ID), title varchar, email varchar (), homepage varchar ( , name varchar (), text text,relay int,r_time date)

CREATE TABLE relay (ID int NOT NULL auto_increment,primary key (ID), title int,email varchar (), name varchar (), text text)
-------------------------index.php--------------------------
<style>td{font-family: "The song Body"; Font-size:13pt}body{font-family: "The song Body"; Font-size:13pt}select{font-family: "The song Body"; Font-size:13pt}a{color:blue; Font-family: "The song Body"; font-size:13pt; Text-decoration:none}</style>
<div> <p align=center><font size=14><b> website complete manual </font></p> </div>
<?php

$db =mysql_connect ("localhost", "* * *", "* * *");

mysql_select_db ("* * *", $db);

@ $result = mysql_query ("SELECT * from guest ORDER BY id Desc", $db);

$i = 0;
while ($myrow = Mysql_fetch_row ($result)) {
$guestbook [$i][0] = $myrow [0];
$guestbook [$i][1] = $myrow [1];
$guestbook [$i][2] = $myrow [2];
$guestbook [$i][3] = $myrow [4];
$guestbook [$i][4]= $myrow [6];
$guestbook [$i][5]= $myrow [7];
$i + +;
//Read into array
Mysql_close ($DB);

echo "-----------------------------altogether [";

if ($q!= "") {
$page = $q;
} else {
$page = 0;
}

$i =count ($guestbook);
$msgnum = 20; 20 pens per page
$start = $page * $MSGNUM;
$end = $start + $msgnum;
if ($end > $i) $end = $i;
$totalpage = $i/$msgnum;


for ($i =0; $i < $totalpage; $i + +) {
if ($i!= $page) {
echo "<a href=index.php?q= $i > $i </a>";
} else {
echo "$i";
}
}
echo "] page-----------------------------<br>; printf ("<p align=right><a href=111.php> Add Theme </a></p>");
echo "<br>";
echo "<table width=700 hight=560 align=center border=1 >";
echo "<tr>"; echo "<td align=center width=200 bgcolor=aaaaaa border=1 style=border:1px solid RGB (3,2,1) > Themes & Lt;/td> ";
echo "<td align=center width=200 bgcolor=aaaaaa border=1 style=border:1px solid RGB (3,2,1) > E-mail </td>";
echo "<td align=center width=80 bgcolor=aaaaaa border=1 style=border:1px solid RGB (3,2,1) > </td>";
echo "<td align=center width=60 bgcolor=aaaaaa border=1 style=border:1px solid RGB (3,2,1) > Reply </td>";
echo "<td align=center width=200 bgcolor=aaaaaa border=1 style=border:1px solid RGB (3,2,1) > Last reply time </td>";
echo "</tr>";
for ($i = $start; $i < $end; $i + +) {
$id = $guestbook [$i][0];

echo "<tr >"; echo "<td align=center width=200 bgcolor=bbbbbb border=0 style=border:1px RGB (solid) >";
echo "<a href=444.php?id= $id >"; echo $guestbook [$i][1]; echo "</a>"; echo "</td>";
echo "<td align=center width=200 bgcolor=bbbbbb border=0 style=border:1px RGB (solid) >";
echo "<a Href=mailto:". $guestbook [$i][2]. "  > "; echo $guestbook [$i][2];echo "</a>"; echo "</td>";

echo "<td align=center width=80 bgcolor=bbbbbb border=0 style=border:1px RGB (solid) >";
echo $guestbook [$i][3]; echo "</td>";
echo "<td align=center width=60 bgcolor=bbbbbb border=0 style=border:1px RGB (solid) >";
echo $guestbook [$i][4]; echo "</td>";
echo "<td align=center width=200 bgcolor=bbbbbb border=0 style=border:1px RGB (solid) >";
echo $guestbook [$i][5]; echo "</td>";
echo "</tr>";


}
echo "</table>";

echo "<br>";

printf ("<a href=111.php> Add Theme </a>");


?>
------------------------------444.php--------------------------------
<style>td{font-family: "The song Body"; Font-size:13pt}body{font-family: "The song Body"; Font-size:13pt}select{font-family: "The song Body"; Font-size:13pt}a{color:blue; Font-family: "The song Body"; font-size:13pt; Text-decoration:none}</style>
<?php

$db =mysql_connect ("localhost", "* * *", "* * *");

mysql_select_db ("* * *", $db);

@ $result = mysql_query ("SELECT * from guest where id= ' $id '", $db);

echo "<table width=700 align=center border=1 >";
$myrow = Mysql_fetch_row ($result);
echo "<tr higth=20>"; echo "<td align=center width=700 bgcolor=888888 border=1 style=border:1px solid rgb (3,2,1) > Theme: "; echo $myrow [1]; echo "</td>"; echo "</tr>";

$msg =base64_decode ($myrow [5]);

$msg = Ereg_replace ("", "", $msg); Space handling
$msg =nl2br ($msg); Line Wrap Processing
if ($myrow [3]!= "") {$myrow [3]=] <a href=http://$myrow [3]> $myrow [3]</a> ";}
Else
{$myrow [3]=] I haven't settled on the internet yet.}
echo "<tr higth=60>"; echo "<td width=700 bgcolor=bbbbbb border=1 style=border:1px solid RGB (3,2,1) >"; echo $msg; echo "</td>"; echo "</tr>";
echo "<tr higth=20>"; echo "<td align=center width=700 Bgcolor=bbbbee border=1 style=border:1px solid RGB (3,2,1) > Homepage:"; Echo $myrow [3]; echo "</td></tr>";
echo "<tr higth=20>"; echo "<td align=center width=700 bgcolor=888888 border=1 style=border:1px solid rgb (3,2,1)  > "; echo "Reply List"; echo "</td>"; echo "</tr>";

$num = $myrow [6];
@ $result 1 = mysql_query ("SELECT * from relay where title= ' $id ' ORDER by id DESC", $db);
$i = 0;
while ($myrow 1 = mysql_fetch_row ($result 1)) {
$guestbook [$i][0] = $myrow 1[1];
$guestbook [$i][1] = $myrow 1[2];
$guestbook [$i][2] = $myrow 1[3];
$guestbook [$i][3]= $myrow 1[4];

$i + +;
}
Mysql_close ($DB);

if ($q!= "") {
$page = $q;
} else {
$page = 0;
}

$i =count ($guestbook);
$msgnum = 5; 5 pens per page
$start = $page * $MSGNUM;
$end = $start + $msgnum;
if ($end > $i) $end = $i;
$totalpage = $i/$msgnum;




for ($i = $start; $i < $end; $i + +) {
$t = $guestbook [$i][0];

echo "<tr >"; echo "<td align=center width=700 bgcolor=aaaaaa border=0 style=border:1px RGB (solid) >";
echo "Re:";  echo $myrow [1];      echo "</td>"; echo "</tr>";
echo "<tr >"; echo "<td align=center width=700 bgcolor=bbbbbb border=0 style=border:1px RGB (solid) >";
echo $guestbook [$i][2];         echo "</td>"; echo "</tr>";
echo "<tr >"; echo "<td align=center width=700 Bgcolor=bbbbee border=0 style=border:1px solid RGB (3,2,1) > E-mail:";
echo "<a Href=mailto:". $guestbook [$i][1]. "  > ";     echo $guestbook [$i][1];echo "</a>"; echo "</td>"; echo "</tr>";
$msg =base64_decode ($guestbook [$i][3]);
$msg = Ereg_replace ("", "", $msg);
$msg =nl2br ($msg);

echo "<tr >"; echo "<td width=700 bgcolor=bbbbbb border=0 style=border:1px solid RGB (3,2,1) >";
Echo $msg;         echo "</td>"; echo "</tr>";
}



echo "</table>"; echo "<br>";   echo "<br>"; echo "-------------------------------altogether [";
for ($i =0; $i < $totalpage; $i + +) {
if ($i!= $page) {
echo "<a href=444.php?q= $i &id= $id > $i </a>";
} else {
echo $i;
}
The echo "] page---------------------------------; echo "<br>";
echo "<a href=333.php?t= $id &num= $num > Reply </a>"; echo "<br>";
echo "<a href=index.php> browse Theme </a>";
?>
--------------------------------333.php-----------------------------


<?php
if (! $t) {
if ($text = = "" & $email = = "" & $name = = "") {echo "* must be filled"; echo "<a href=333.php?t= $title &name= $name &email= $email &text= $text &num= $num > Return </a> "; }
else {if (eregi () ^[_.0-9a-z-]+@ ([0-9a-z][0-9a-z-]+.) +[a-z]{2,3}$ ", $email)) {
$text = Base64_encode ($text); Verify email address is legal
$db =mysql_connect ("localhost", "* * *", "* * *");
$time =date ("y-m-d");
mysql_select_db ("* * *", $db);
$sql = "INSERT into relay values (', ' $title ', ' $email ', ' $name ', ' $text ')";

$result = mysql_query ($sql);
$num = $num +1;
$sql = "Update guest set relay= ' $num ', r_time= ' $time ' where id= ' $title '";
$result =mysql_query ($sql);
Mysql_close ();


echo "<meta Http-equiv=refresh content= ' 1; url=444.php?id= $title ' > ';


}
else {echo "Invalid mail address"; echo "<a href=333.php?t= $title &name= $name &text= $text &num= $num > Return </a>";
}     }
Else
{?> <form action= "333.php" method= "POST" >
<table border=0 cellpadding=2 width=395>

<tr>

&LT;TD width=20%><input type=hidden name=title value= " echo $t?> "></td></tr>
<tr>
&LT;TD Nowrap><font color=004080> called:*</font></td>
&LT;TD width=10%><input type=text name=name size=10 value= " echo $name?> "></td>
</tr>
<tr>
&LT;TD nowrap><font color=004080> Mail:*</font></td>
&LT;TD width=20%><input type=text name=email size=20 value= " echo $email?> "></td>
</tr>
<tr>

&LT;TD width=20%><input type=hidden name=num value= " echo $num?> "></td>
</tr>

<tr>
&LT;TD Nowrapvalign=top><font color=004080> Content:*</font></td>
&LT;TD width=80% colspan=3><textarea rows=5 name=text cols=50;? echo $text;?></textarea></td>
</tr>

<tr>
&LT;TD width=100% colspan=4 align=center>
<input type=submit value= "send out" >
<input type=reset value= "Erase" >
</td>
</tr> </table>

</FORM>;? }

?>
<body>
-----------------------------------www.php--------------------------
<HTML>
<HEAD>
<?php

if ($title!= "" & $email!= "" & $name!= "") {
if (Eregi (^[_.0-9a-z-]+@) ([0-9a-z][0-9a-z-]+.) +[a-z]{2,3}$ ", $email)) {
$text = Base64_encode ($text); Verify email address is legal
$db =mysql_connect ("localhost", "* * *", "* * *");
$time =date ("y-m-d");
mysql_select_db ("* * *", $db);
$sql = "INSERT into guest values (', ' $title ', ' $email ', ' $homepage ', ' $name ', ' $text ', ', ' $time ')";

$result = mysql_query ($sql); Mysql_close ();



echo "<meta Http-equiv=refresh content= ' 1; url=index.php ' > ';



}
Else
{echo "Mail address is invalid"; echo "<a href=111.php?title= $title &&homepage= $homepage &name= $name &text= $text      > Return </a> ";} }

else {echo "* must fill"; echo "<a href=111.php?title= $title &email= $email &homepage= $homepage &name= $name & text= $text > Return </a> ";}

Mysql_close ($DB)
printf ("Message successful <a href=222.php> Press this return </a>");
?>
</HEAD>
<BODY>
</BODY>
</HTML>
--------------------------------111.php---------------------------
<body>
<form action= "www.php" method= "POST" >
<table border=0 cellpadding=2 width=395>
<tr>
&LT;TD Nowrap><font color=004080> Title:*</font></td>
&LT;TD width=20%><input type=text name=title size=30 value= " echo $title?> "></td></tr><tr>
&LT;TD nowrap><font color=004080> Mail:*</font></td>
&LT;TD width=20%><input type=text name=email size=30 value= " echo $email?> "></td>
</tr>
<tr>
&LT;TD Nowrap><font color=004080> Home:</font></td>
&LT;TD width=25%><input type=text name=homepage size=30 value= " echo $homepage?> "></td>
</tr>
<tr>
&LT;TD Nowrap><font color=004080> called:*</font></td>
&LT;TD width=10%><input type=text name=name size=10 value= " echo $name?> "></td>
</tr>
<tr>
&LT;TD Nowrapvalign=top><font color=004080> Content:</font></td>
&LT;TD width=80% colspan=3><textarea rows=5 name=text cols=50;? echo $text;?></textarea></td>
</tr>

<tr>
&LT;TD width=100% colspan=4 align=center>
<input type=submit value= "send out" >
<input type=reset value= "Erase" >
</td>
</tr> </table>

</FORM>
</body>


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.