Mysql-based Forum (7) # sendmsg. php
Require "func. php ";
If ($ b1 ){
If (is_user_exits ($ fromname) and check_user_password ($ fromname, $ password )){
Sendmsg ();
Echo "successful!
";
}
Else {
$ Founderr = 1;
Echo "incorrect username/password! ";
}
}
Else {
?>
Send message
}
?>
###############
# Setup. php
# This is the initialization program. it is only executed for the first time after the upload and must be deleted to avoid errors.
#################
Require "func. php ";
Echo "initialize database
";
Echo "establish database connection... OK!
";
Echo "create table boardinfo ...";
$ SQL = "CREATE TABLE boardinfo (name varchar (50) NOT NULL, chinesename varchar (50) NOT NULL )";
Mysql_query ($ SQL) or die ("error ");
Echo "OK!
";
Echo "create table user ...";
$ SQL = "CREATE TABLE user (id int (11) NOT NULL auto_increment, name varchar (50) NOT NULL, sex varchar (6), realname varchar (20 ), password varchar (16) not null, address varchar (40), oicq varchar (10), homepage varchar (50), score int (11), phone varchar (20 ), email varchar (50), regtime varchar (20), qm text, slaveboard varchar (50), primary key (id ))";
Mysql_query ($ SQL) or die ("error ");
Echo "OK!
";
Echo "create table message ...";
$ SQL = "create table message (id int (11) NOT NULL auto_increment, name varchar (50), fromname varchar (50), writetime varchar (20), cont longtext, primary key (id ))";
Mysql_query ($ SQL) or die ("error ");
Echo "OK!
";
Echo "initialize the layout" personal computer "...";
Create_board_table ('computer ', 'PC ');
Echo "OK!
";
Echo "set up! ";
Echo"
Leng Qing madman (computer madman )";
?>
# Userinfo. php
User information
If (! Isset ($ name )){
?>
}
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 );
?>
Details |
User name: |
Real name: |
Gender: |
Address: |
Tel: |
OICQ: |
Email: "> |
Home page: "target =" _ blank "> |
Registration time: |
Current points: |
}
Else {
Echo "enter the correct and valid user name ";
}
}
Include "footer. php";?>
# Viewmsg. 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 );
?>
View messages