Phpfans install.php_php instance used in the message board

Source: Internet
Author: User
Tags create database

Copy Code code as follows:
<?php
/*********************************************
*
* Program Name: PHP fans message Board
* Demo: http://www.phpfans.net/guestbook/
*
* Author: I'm not a fish
* email:deng5765@163.com
* Website: 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 username or password is incorrect." Returns the modified. <br><a href=\ "#\" onclick=\ "window.history.back (); \" > Return </a> ";
Exit
}
mysql_query ("Set names ' GBK '");
$dbsql = "CREATE DATABASE IF not EXISTS". $mydbname;
if (! @mysql_query ($dbsql)) {echo "Please check that you have permissions to build the database"; exit;}
echo "CREATE database {$mydbname} successful >><br>";
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 not NULL,
' p_email ' varchar not NULL,
' P_QQ ' varchar not NULL,
' p_homepage ' varchar not NULL,
' P_image ' varchar (8) Not NULL,
' P_title ' varchar (160) Not NULL,
' P_content ' Mediumtext not NULL,
' p_ip ' varchar not NULL,
' P_date ' datetime not NULL,
PRIMARY KEY (' p_id ')
) Engine=myisam {$char}; ";
if (! @mysql_query ($sql)) {echo Please check that the data sheet post exists, please delete it first. "; Exit;}
echo "Create a data table post success >><br>";

$sql = INSERT into ' post ' VALUES (1, ' I'm not a fish ', ' deng5765@163.com ', ' 245821218 ', ' http://www.phpfans.net ', ' 01 ', ' Thank you for using PHP hobby Message board ', '
<P> Thank you for your support for the PHP fan message board </P>
<P> encounter any problems in use, please go to </P>
<p><a href=\ "http://www.phpfans.net/guestbook/\" >http://www.phpfans.net/guestbook/</A> get help </P>
<P> make your suggestions. Welcome to the PHP enthusiasts station </P>
<p><a href=\ "yun_qi_img/smile28.gif\" ></P> ', ' 127.0.0.1 ', Now ()) ";
if (@mysql_query ($sql)) {Echo Initialization data table success <br>;}

$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 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] Please check that the datasheet reply exists, please delete it first. "; Exit;}
echo "Create datasheet reply success >><br>";

$str = ' <?php '. \ n ";
$str. = ' $mydbhost = ' localhost\ '. '; /database server \ n ";
$str. = ' $mydbuser = '. $mydbuser. "'; /database user name \ n ";
$str. = ' $MYDBPW = '. $mydbpw. "'; /Database password \ n ";
$str. = ' $mydbname = '. $mydbname. "'; /database name \ n ";
$str. = ' $mydbcharset = ' gbk\ '. '; /database encoding, not recommended for modification. \ n ";
$str. = ' $admin = '. $_post[' m_admin '. ' \//Admin name '. ' \ n ";
$str. = ' $ADMINPW = '. $_post[' M_ADMINPW '. ' \//admin password '. ' \ n ";
$str. = ' $eachpage = 5;//per page Displays the number of message bars '. \ 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 the config.php <br>";}
else{
Fwrite ($fp, $STR);
Fclose ($FP);
echo "Configure document config.php update success >><br><br>";
echo "The installation was completed successfully. For security reasons, please delete insall.php<br>";
}
Echo '
<a href= "index.php" > Enter Message board Home </a> ';
Exit
}
?>
<meta http-equiv= "Content-type" content= "text/html; CHARSET=GBK "/>
<title>php Fan Message Board _ installation </title>
<link type= "Text/css" href= "Guest.css" rel= "stylesheet" >

<body>
<center>
<?php require_once (' header.html ');? >
<table id= "ptable" class= "Tableboder" cellpadding= "0" cellspacing= "1" >
<form id= "Form1" Name= "Form1" method= "Post" action= "" >
<tr>
&LT;TD colspan= "3" class= "header" > Installing PHP Enthusiasts Message Board </td>
</tr>
<tr>
<td> Database Server:</td>
<td><input name= "M_host" type= "text" id= "m_host" value= "localhost" ></td>
<td> database server address, generally for localhost</td>
</tr>
<tr>
&LT;TD width= > Database user name:</td>
&LT;TD width= "266" ><input name= "M_root" type= "text" id= "M_root"/></td>
&LT;TD width= "280" > Database account username </td>
</tr>
<tr>
<td> Database Password:</td>
<td><input name= "M_PW" type= "password" id= "M_PW"/></td>
<td> Database account password </td>
</tr>
<tr>
<td> Database name:</td>
<td><input name= "m_db" type= "text" id= "m_db" ></td>
<td> There is no automatic creation </td>
</tr>
<tr>
<td> Message board administrator name:</td>
<td><input name= "M_admin" type= "text" id= "M_admin" ></td>
<td> </td>
</tr>
<tr>
<td> Message Board Admin password:</td>
<td><input name= "M_ADMINPW" type= "text" id= "M_ADMINPW" ></td>
<td> </td>
</tr>
<tr>
&LT;TD colspan= "3" ><input type= "Submit" name= "Submit" value= "Install"/>
After installation so configuration can be modified in include/config.php </td>
</tr>
</form>
</table>

<?php require_once (' footer.html ');? >
</center>
</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.