Home  >  Article  >  Backend Development  >  The Eleventh Day of PHP Practice_PHP Tutorial

The Eleventh Day of PHP Practice_PHP Tutorial

WBOY
WBOYOriginal
2016-07-14 10:11:101093browse

今天学习了做安装包
这里是HTML模板
[html]
 
 
 
   
  瀑布流留言板管理系统 
   
 
 
 

 
 
   
 
     
 
       

瀑布流记事本安装包

 
     
 
   
 
 
 
 
   
 
     
 
         
       
 
           
          你的数据库所在IP,一般是localhost 
       
 
     
 
 
 
     
 
         
       
 
           
          你的MySQL帐户。 
 
 
       
 
     
 
 
 
     
 
         
       
 
           
          你的MySQL密码。 
       
 
     
 
 
 
     
 
         
       
 
           
          你的数据库名称,请先确认此数据库存在。 
       
 
     
 
 
 
 
 
     
 
         
       
 
           
          设置网站的标题 
       
 
     
 
 
 
 
 
     
 
         
       
 
           
          登陆后台所用的用户名 
       
 
     
 
 
 
     
 
         
       
 
           
          登陆后台所用的密码 
       
 
     
 
 
 
     
 
       
 
         
       
 
     
 
   
 
 
 
 
 
     
     
 
 
 
 
 




 
  瀑布流留言板管理系统
 





   

     

       

瀑布流记事本安装包


     

   


   


     

       
       

         
          你的数据库所在IP,一般是localhost
       

     


     


       
       

         
          你的MySQL帐户。


       


     


     


       
       

         
          你的MySQL密码。
       

     


     


       
       

         
          你的数据库名称,请先确认此数据库存在。
       

     

 


     


       
       

         
          设置网站的标题
       

     

 


     


       
       

         
          登陆后台所用的用户名
       

     


     


       
       

         
          登陆后台所用的密码
       

     


     


       

       
       

     

   



   
   

 



下面是php代码
[php]
     
    //var_dump($_POST);  
    $server =$_POST['m_server']; 
    $userName=$_POST['m_userName']; 
    $password=$_POST['m_password']; 
    $dbName=$_POST['m_dbName']; 
     
    $adminUser=$_POST['adminUser']; 
    $adminPassword=md5($_POST['adminPassword']); 
    $title=$_POST['c_title']; 
 
 
 
 
 
 
    include '../function.php'; 
 
 
    $c=config_get('../config.php'); 
    $c['dbServer']=$server; 
    $c['dbUserName']=$userName; 
    $c['dbPassword']=$password; 
    $c['dbName']=$dbName; 
    $c['title']=$title; 
    $c['footer']='已经滚动到底部了'; 
    //$c['adminUser']=$adminUser;  
    //$c['adminPassword']=$adminPassword;  
    config_set("../config.php",$c); 
 
 
    //var_dump($GLOBALS);  
    $conn=mysql_connect($server,$userName,$password)or die("mysql连接失败 错误信息:" . mysql_error()); 
 
 
    /**
* Select the database, if it does not exist, it will be automatically created
​*/ 
    if(!mysql_select_db($dbName)){ 
        $query='CREATE DATABASE '.$dbName; 
        $result = mysql_query($query)or die("1Invalid query: " . mysql_error()); 
        if(!$result){ 
            echo "创建数据库失败,请手动创建 {$dbName}"; 
            exit(); 
        } 
        mysql_select_db($dbName); 
    } 
 
 
    /**
* Create a data table for message recording
​*/ 
    $query="CREATE TABLE IF NOT EXISTS `data` ( 
  `id` int(11) NOT NULL AUTO_INCREMENT, 
  `time` int(10) NOT NULL, 
  `userName` varchar(200) COLLATE utf8_unicode_ci NOT NULL, 
  `content` text COLLATE utf8_unicode_ci NOT NULL, 
  `email` varchar(40) COLLATE utf8_unicode_ci NOT NULL, 
  PRIMARY KEY (`id`) 
  ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=26"; 
 
 
    $result = mysql_query($query)or die("创建数据表 'data' 失败 错误信息:" . mysql_error()); 
 
 
    /**
* Create user table for user management
​*/ 
    $query="CREATE TABLE IF NOT EXISTS `user` ( 
      `id` int(11) NOT NULL AUTO_INCREMENT, 
      `userName` text NOT NULL, 
      `password` varchar(40) NOT NULL, 
      `time` int(11) NOT NULL, 
      PRIMARY KEY (`id`) 
    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2"; 
 
 
    $result = mysql_query($query)or die("创建数据表 'user' 失败 错误信息:" . mysql_error()); 
 
 
 
 
    //插入user表用户  
    $query="INSERT INTO `user` (`id`, `userName`, `password`, `time`)  
            VALUES (1, '{$adminUser}', '{$adminPassword}', 1369417030)"; 
 
 
    $result = mysql_query($query); 
    if (!$result) { 
        echo ("'user'表,插入数据失败 错误信息:".mysql_error()); 
    } 
 
 
    echo "安装成功"; 
 
 
    //header("Localhost: ./admin.php?m=admin&a=index");  
    //echo "<script>window.location.href='../admin.php?m=admin&a=login';</script>";  
/*
 
 
*/ 
 
 
 ?> 

 
 //var_dump($_POST);
 $server =$_POST['m_server'];
 $userName=$_POST['m_userName'];
 $password=$_POST['m_password'];
 $dbName=$_POST['m_dbName'];
 
 $adminUser=$_POST['adminUser'];
 $adminPassword=md5($_POST['adminPassword']);
 $title=$_POST['c_title'];

 

 


 include '../function.php';


 $c=config_get('../config.php');
 $c['dbServer']=$server;
 $c['dbUserName']=$userName;
 $c['dbPassword']=$password;
 $c['dbName']=$dbName;
 $c['title']=$title;
 $c['footer']='已经滚动到底部了';
 //$c['adminUser']=$adminUser;
 //$c['adminPassword']=$adminPassword;
 config_set("../config.php",$c);


 //var_dump($GLOBALS);
 $conn=mysql_connect($server,$userName,$password)or die("mysql连接失败 错误信息:" . mysql_error());


 /**
* Select the database, if it does not exist, it will be automatically created
​*/
 if(!mysql_select_db($dbName)){
  $query='CREATE DATABASE '.$dbName;
  $result = mysql_query($query)or die("1Invalid query: " . mysql_error());
  if(!$result){
   echo "创建数据库失败,请手动创建 {$dbName}";
   exit();
  }
  mysql_select_db($dbName);
 }


 /**
* Create a data table for message recording
​*/
 $query="CREATE TABLE IF NOT EXISTS `data` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `time` int(10) NOT NULL,
  `userName` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
  `content` text COLLATE utf8_unicode_ci NOT NULL,
  `email` varchar(40) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`id`)
  ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=26";


 $result = mysql_query($query)or die("创建数据表 'data' 失败 错误信息:" . mysql_error());


 /**
* Create user table for user management
​*/
 $query="CREATE TABLE IF NOT EXISTS `user` (
   `id` int(11) NOT NULL AUTO_INCREMENT,
   `userName` text NOT NULL,
   `password` varchar(40) NOT NULL,
   `time` int(11) NOT NULL,
   PRIMARY KEY (`id`)
 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2";


 $result = mysql_query($query)or die("创建数据表 'user' 失败 错误信息:" . mysql_error());

 


 //插入user表用户
 $query="INSERT INTO `user` (`id`, `userName`, `password`, `time`)
   VALUES (1, '{$adminUser}', '{$adminPassword}', 1369417030)";


 $result = mysql_query($query);
 if (!$result) {
  echo ("'user'表,插入数据失败 错误信息:".mysql_error());
 }


 echo "安装成功";


 //header("Localhost: ./admin.php?m=admin&a=index");
 //echo "<script>window.location.href='../admin.php?m=admin&a=login';</script>";
/*


*/


 ?>


 

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/477375.htmlTechArticleToday I learned how to make an installation package. Here is the HTML template [html] !DOCTYPE html html lang=en head meta http- equiv=Content-Type content=text/html; charset=utf-8 / titleWaterfall Message Board Management System...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn