comparison install/step3.php @ 32:01a8fdc0cebb

testing: Web base setting page.
author Sushi-k <epgrec@park.mda.or.jp>
date Mon, 27 Jul 2009 18:48:51 +0900
parents
children a935b4789aff
comparison
equal deleted inserted replaced
31:6bb8f29c80c0 32:01a8fdc0cebb
1 <?php
2 include_once("../config.php");
3 include_once("../Smarty/Smarty.class.php");
4 include_once("../DBRecord.class.php");
5 include_once("../Settings.class.php");
6 include_once("../reclib.php" );
7
8 $settings = Settings::factory();
9 $settings->post(); // いったん保存する
10 $settings->save();
11
12 // データベース接続チェック
13 $dbh = @mysql_connect( $settings->db_host, $settings->db_user, $settings->db_pass );
14 if( $dbh == false ) {
15 jdialog( "MySQLに接続できません。ホスト名/ユーザー名/パスワードを再チェックしてください", "step2.php" );
16 exit();
17 }
18
19 $sqlstr = "use ".$settings->db_name;
20 $res = @mysql_query( $sqlstr );
21 if( $res == false ) {
22 jdialog( "データベース名が異なるようです", "step2.php" );
23 exit();
24 }
25
26 // DBテーブルの作成
27
28 try {
29 $rec = new DBRecord( $settings->tbl_prefix . RESERVE_TBL );
30 $rec->createTable( RESERVE_STRUCT );
31
32 $rec = new DBRecord( $settings->tbl_prefix . PROGRAM_TBL );
33 $rec->createTable( PROGRAM_STRUCT );
34
35 $rec = new DBRecord( $settings->tbl_prefix . CHANNEL_TBL );
36 $rec->createTable( CHANNEL_STRUCT );
37
38 $rec = new DBRecord( $settings->tbl_prefix . CATEGORY_TBL );
39 $rec->createTable( CATEGORY_STRUCT );
40
41 $rec = new DBRecord( $settings->tbl_prefix . KEYWORD_TBL );
42 $rec->createTable( KEYWORD_STRUCT );
43 }
44 catch( Exception $e ) {
45 jdialog("テーブルの作成に失敗しました。データベースに権限がない等の理由が考えられます。", "step2.php" );
46 exit();
47 }
48
49 $smarty = new Smarty();
50 $smarty->template_dir = "../templates/";
51 $smarty->compile_dir = "../templates_c/";
52 $smarty->cache_dir = "../cache/";
53
54 $smarty->assign( "settings", $settings );
55 $smarty->assign( "install_path", INSTALL_PATH );
56 $smarty->assign( "post_to", "step4.php" );
57 $smarty->assign( "sitetitle", "インストールステップ3" );
58
59 $smarty->display("envSetting.html");
60 ?>