php實戰第十一天_PHP教程

來源:互聯網
上載者:User
今天學習了做安裝包
這裡是HTML模板
[html]




瀑布流留言板管理系統








瀑布流記事本安裝包






















瀑布流留言板管理系統







瀑布流記事本安裝包











下面是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());


/**
* 選擇資料庫,如果不存在則自動建立
*/
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);
}


/**
* 建立data表,用於留言記錄
*/
$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());


/**
* 建立user表,用於使用者管理
*/
$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 "";
/*


*/


?>


//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());


/**
* 選擇資料庫,如果不存在則自動建立
*/
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);
}


/**
* 建立data表,用於留言記錄
*/
$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());


/**
* 建立user表,用於使用者管理
*/
$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 "";
/*


*/


?>


http://www.bkjia.com/PHPjc/477375.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/477375.htmlTechArticle今天學習了做安裝包 這裡是HTML模板 [html] !DOCTYPE html html lang=en head meta http-equiv=Content-Type content=text/html; charset=utf-8 / title瀑布流留言板管理系...

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    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.