Install. php used by phpfans message board
The Code is as follows:
/*************************************** ******
*
* Program name: php fan message board
* Performance: http://www.phpfans.net/guestbook/
*
* Author: I am not a fish
* Email: deng5765@163.com
* Address: http://www.phpfans.net
* Blog: http://www.phpfans.net/space? 2
* Version: v1.0
* Help: http://www.phpfans.net/guestbook/
**************************************** *****/
If (isset ($ _ POST ['submit ']) {
$ Mydbuser = $ _ POST ['m _ root'];
$ Mydbpw = $ _ POST ['m _ pw '];
$ Mydbname = $ _ POST ['m _ db'];
If (! @ Mysql_connect ("localhost", $ mydbuser, $ mydbpw )){
Echo "the mysql user name or password is incorrect. The modification is returned.
Return ";
Exit;
}
Mysql_query ("set names 'gbk '");
$ Dbsql = "create database if not exists". $ mydbname;
If (! @ Mysql_query ($ dbsql) {echo "check whether you have the permission to create a database"; exit ;}
Echo "database created {$ mydbname} succeeded>
";
Mysql_select_db ($ mydbname );
$ Char = '';
If (mysql_get_server_info ()> '4. 1') $ char = 'default CHARSET = gbk ';
$ SQL = "CREATE TABLE 'post '(
'P _ id' int (255) unsigned not null auto_increment,
'P _ name' varchar (20) not null,
'P _ email 'varchar (20) not null,
'P _ qq' varchar (20) not null,
'P _ homepage' varchar (100) not null,
'P _ image' varchar (8) not null,
'P _ title' varchar (160) not null,
'P _ content' mediumtext not null,
'P _ ip' varchar (15) not null,
'P _ date' datetime not null,
Primary key ('P _ id ')
) ENGINE = MyISAM {$ char };";
If (! @ Mysql_query ($ SQL) {echo "check whether the data table post exists. Delete it first."; exit ;}
Echo "succeeded in creating the data table post>
";
$ SQL = "insert into 'post' VALUES (1, 'I am not a fish', 'deng5765 @ 163.com ', '123', 'HTTP: // www.phpfans.net ', '01', 'Thank you for using the message board of a php enthusiast ','
Thank you very much for your support for the message board of php fans.
If you encounter any problems during use, go
Http://www.phpfans.net/guestbook/ for help
Or give your suggestions. At the same time, you are welcome to visit the php site.
Http://www.phpfans.net
', '2014. 0.0.1', now ())";
If (@ mysql_query ($ SQL) {echo "data table initialized successfully
";}
$ SQL = "CREATE TABLE 'reply '(
'R _ id' int (255) unsigned not null auto_increment,
'P _ id' int (255) not null,
'R _ content' varchar (255) not null,
'R _ rname' varchar (20) not null,
'R _ time' date not null,
Primary key ('R _ id '),
Unique key 'P _ id' ('P _ id ')
) ENGINE = MyISAM {$ char };";
If (! @ Mysql_query ($ SQL) {echo "check whether the data table reply exists. If so, delete it first."; exit ;}
Echo "data table reply created successfully>
";
$ Str =' $ Str. = '$ mydbhost = \ 'localhost \ ''."; // Database Server \ n ";
$ Str. = '$ mydbuser = \ ''. $ mydbuser."'; // database username \ n ";
$ Str. = '$ mydbpw = \'. $ mydbpw. "'; // Database Password \ n ";
$ Str. = '$ mydbname = \ ''. $ mydbname."'; // Database Name \ n ";
$ Str. = '$ mydbcharset = \ 'gbk \ ''."; // database encoding. We do not recommend modifying. \ n ";
$ Str. = '$ admin = \ ''. $ _ POST ['m _ admin'].' \ '; // Administrator name'." \ n ";
$ Str. = '$ adminpw = \ ''. $ _ POST ['m _ adminpw']. '\'; // administrator password '." \ n ";
$ Str. = '$ eachpage = 5; // Number of message lines per page'. "\ n ";
$ Str. = '?> ';
$ Fp = fopen ('include/config. php', 'w ');
If (! $ Fp) {echo "this space does not support the file function. Please manually configure the content on config. php.
";}
Else {
Fwrite ($ fp, $ str );
Fclose ($ fp );
Echo "configuration document config. php updated successfully>
";
Echo "installation completed successfully. For security reasons, please delete insall. php
";
}
Echo'
Go to the Message Board Homepage ';
Exit;
}
?>
Php fan message board _ Installation