MySQL based forum (7)
Last Update:2017-02-28
Source: Internet
Author: User
# sendmsg.php
<?php
Require "func.php";
if ($b 1) {
if (Is_user_exits ($fromname) and Check_user_password ($fromname, $password)) {
Sendmsg ();
echo "Success!" <br><form method= "POST" ><input type= button "value=" closes window "name=" B1 "></form>";
}
else {
$founderr = 1;
echo Username/Password Error! ";
}
}
else {
?>
<title> Send Message </title>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<link rel= "stylesheet" type= "Text/css" href= "Css/index.css" >
<body bgcolor= "#eeeeee" >
<form method= "POST" action= "<?php echo $php _self;? > ">
<table width= "98%" border= "1" cellspacing= "0" cellpadding= "0" bordercolorlight= "#000000" bordercolordark= "#FFFFFF ">
<TR align= "center" >
<TD colspan= "2" > To <a href= "userinfo.php?name=<?php echo $name;? > "target=" _blank "><?php echo $name;? ></a>
Send a message </td>
</tr>
<tr>
<TD align= "Right" width= "27%" > Your username:</td>
<TD width= "73%" >
<input type= "text" name= "FromName" size= "" maxlength= "" value= "<?php echo $jl _forum[name];? > ">
* </td>
</tr>
<tr>
<TD align= "Right" width= "27%" > Your password:</td>
<TD width= "73%" >
<input type= "password" name= "password" size= "" "Maxlength=" >
* </td>
</tr>
<tr>
<TD align= "Right" width= "27%" valign= "top" > Content:</td>
<TD width= "73%" >
<textarea name= "cont" wrap= "VIRTUAL" cols= "" rows= "3" ></textarea>
<input type= "hidden" name= toname "value=" <?php echo $name;? > ">
<br>
<input type= "Submit" Name= "B1" value= "Send" >
<input type= "button" Name= "Submit" value= "Cancel" >
</td>
</tr>
</table>
</form>
</body>
<?php
}
?>
###############
# setup.php
# This is the initialization program, only after uploading for the first time, and then must delete to avoid errors
#################
<?php
Require "func.php";
echo "echo "Establish database connection ...ok!<br>";
echo "Set up table Boardinfo ...";
$sql = "CREATE TABLE boardinfo (name varchar NOT NULL, chinesename varchar)";
mysql_query ($sql) or Die ("error");
echo "Ok!<br>";
echo "CREATE table user ...";
$sql = "CREATE TABLE user (id int (one) not NULL auto_increment, name varchar (x) not NULL, sex varchar (6), Realname varchar (2 0), password varchar not NULL, address varchar (a), Oicq varchar (a), homepage varchar (), score Int (one), phone Varc Har, email varchar (m), Regtime varchar, QM text, Slaveboard varchar (x), PRIMARY KEY (ID)) ";
mysql_query ($sql) or Die ("error");
echo "Ok!<br>";
echo "Create a table message ... ";
$sql = "CREATE TABLE message (ID int (one) not NULL auto_increment, name varchar (m), FromName varchar (), Writetime Varch AR, cont longtext, PRIMARY KEY (ID)) ";
mysql_query ($sql) or Die ("error");
echo "Ok!<br>";
echo "Initialize the layout of the PC";
Create_board_table (' computer ', ' personal computer ');
echo "Ok!<br><br>";
echo "echo "<br><br> cold Crazy (computer maniac)";
?>
# # Userinfo.php
<title> User Information </title>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<link rel= "stylesheet" type= "Text/css" href= "Css/index.css" >
<body bgcolor= "#FFFFFF" background= "Image/bg.gif" >
<?php include "header.php";
if (!isset ($name)) {
?>
<form method= "POST" action= "<?php echo $php _self;? > ">
<table width= "90%" border= "1" cellspacing= "0" cellpadding= "1" align= "center" bordercolorlight= "#CCCCCC" bordercolordark= "#FFFFFF" >
<TR align= "center" >
<td> Please enter the user name you wish to see </td>
</tr>
<TR align= "center" >
<td>
<input type= "text" name= "name" size= "Maxlength=" >
</td>
</tr>
<TR align= "center" >
<td>
<input type= "Submit" Name= "B1" value= "View Information" >
</td>
</tr>
</table>
</form>
<?php
}
else {
Require "func.php";
if (Is_user_exits ($name)) {
$sql = "SELECT * from user where name= ' $name '";
$sql _result=mysql_query ($sql);
$row =mysql_fetch_array ($sql _result);
?>
<br>
<table width= "90%" border= "1" cellspacing= "0" cellpadding= "1" align= "center" bordercolorlight= "#CCCCCC" bordercolordark= "#FFFFFF" >
<tr>
<td><b> Detailed information </b></td>
</tr>
<tr>
<td> User name: <?php echo $row [name];? ></td>
</tr>
<tr>
<td> real name: <?php echo $row [realname];? ></td>
</tr>
<tr>
<td> sex: <?php echo $row [sex];? ></td>
</tr>
<tr>
<td> add: <?php echo $row [address];? ></td>
</tr>
<tr>
<td> Tel: <?php echo $row [phone];? ></td>
</tr>
<tr>
<td>oicq:<?php echo $row [OICQ];? ></td>
</tr>
<tr>
<td>email:<a href= "mailto:<?php echo $row [Email];? > "><?php echo $row [email];? ></a></td>
</tr>
<tr>
<td> Home: <a href= "<?php echo $row [homepage];? > "target=" _blank "><?php echo $row [homepage];? ></a></td>
</tr>
<tr>
<td> Registration time: <?php echo $row [Regtime];? ></td>
</tr>
<tr>
<td> Current points: <?php echo $row [score];? ></td>
</tr>
</table>
<br>
<?php
}
else {
echo "Please enter the correct legal existence of the user name";
}
}
Include "footer.php"; >
</body>
# viewmsg.php
<?php
Require "func.php";
if (Is_user_exits ($JL _forum[name]) and Check_user_password ($jl _forum[name], $JL _forum[password)) {
if (Isset ($job)) {
if (Is_this_user ($id)) {
Delmsg ($id);
}
}
$name = $jl _forum[name];
$sql = "SELECT * from message where name= ' $name '";
$sql _result=mysql_query ($sql);
$sum =mysql_num_rows ($sql _result);
?>
<title> View Message </title>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<link rel= "stylesheet" type= "Text/css" href= "Css/index.css" >
<script language= "JavaScript" >
function sendmsg (name) {window.open ("sendmsg.php?name=" +name, "", "height=200,width=500,resizable=yes,scrollb Ars=yes,status=no,toolbar=no,menubar=no,location=no ");
}
</script>
<body bgcolor= "#FFFFFF" background= "Image/bg.gif" >
<p> you currently have a total of <b><?php echo $sum;? ></b> message </p>
<table width= "98%" border= "1" cellspacing= "0" cellpadding= "0" bordercolorlight= "#CCCCCC" bordercolordark= "#FFFFFF ">
<?php
while ($sql _row=mysql_fetch_array ($sql _result)) {
?>
<tr bgcolor= "#eeeeee" >
<td><a href= "javascript:sendmsg (' <?php echo $sql _row[fromname]"? > ') "><?php echo $sql _row[fromname];? ></a>
In <?php Echo $sql _row[writetime];? > <a href= "<?php echo" $php _self?job=del&id= $sql _row[id] ";? > "> Delete </a></td>
</tr>
<tr>
<td><?php echo $sql _row[cont];? ></td>
</tr>
<tr>
<td> </td>
</tr>
<?php
}
?>
</table>
<p> </p>
</body>
<?php
}
else {
Show_error (4);
}
?> turn from: Dynamic Network production guide www.knowsky.com