Location: PHPKode > projects > QuickTalk Forum > quicktalk/install/qtf_setup_2.php
<?php

// QuickTalk 2.5 build:20100924

session_start();

if ( !isset($_SESSION['qtf_setup_lang']) ) $_SESSION['qtf_setup_lang']='en';

include('qtf_lang_'.$_SESSION['qtf_setup_lang'].'.php');
include('../bin/config.php'); if ( $qtf_dbsystem=='sqlite' ) $qtf_database = '../'.$qtf_database;

$strAppl     = 'QuickTalk 2.5';
$strPrevUrl  = 'qtf_setup_1.php';
$strNextUrl  = 'qtf_setup_3.php';
$strPrevLabel= $L['Back'];
$strNextLabel= $L['Next'];

// --------
// HTML START
// --------

include('qtf_setup_hd.php');

if ( isset($_POST['ok']) )
{
  include('../bin/qt_lib_db.php');
  include('../bin/qtf_fn_base.php');  

  if ( isset($_SESSION['qtf_dbopwd']) )
  {
  $qtf_user = $_SESSION['qtf_dbologin'];
  $qtf_pwd = $_SESSION['qtf_dbopwd'];
  }
  $_SESSION['qtf_boardmail'] = strip_tags(trim($_POST['boardmail']));

  define('TABDOMAIN', $qtf_prefix.'qtadomain');
  define('TABSECTION', $qtf_prefix.'qtaforum');
  define('TABUSER', $qtf_prefix.'qtauser');
  define('TABTOPIC', $qtf_prefix.'qtatopic');
  define('TABPOST', $qtf_prefix.'qtapost');
  define('TABSETTING', $qtf_prefix.'qtasetting');
  define('TABLANG', $qtf_prefix.'qtalang');

  $oDB = new cDB($qtf_dbsystem,$qtf_host,$qtf_database,$qtf_user,$qtf_pwd,$qtf_port,$qtf_dsn);
  
  if ( empty($oDB->error) )
  {    
    // Install the tables
    $strTable = TABSETTING;
    echo "A) {$L['Installation']} SETTING... ";
    include('qtf_setup_setting.php');
    echo $L['Done'],', ',$L['Default_setting'],'<br/>';
    $strTable = TABDOMAIN;
    echo "B) {$L['Installation']} DOMAIN... ";
    include('qtf_setup_domain.php');
    echo $L['Done'],', ',$L['Default_domain'],'<br/>';
    $strTable = TABSECTION;
    echo "C) {$L['Installation']} FORUM... ";
    include('qtf_setup_section.php');
    echo $L['Done'],', ',$L['Default_section'],'<br/>';
    $strTable = TABTOPIC;
    echo "D) {$L['Installation']} TOPIC... ";
    include('qtf_setup_topic.php');
    echo $L['Done'],'<br/>';
    $strTable = TABPOST;
    echo "E) {$L['Installation']} POST... ";
    include('qtf_setup_post.php');
    echo $L['Done'],'<br/>';
    $strTable = TABUSER;
    echo "F) {$L['Installation']} USER... ";
    include('qtf_setup_user.php');
    echo $L['Done'],', ',$L['Default_user'],'<br/>';
    $strTable = TABLANG;
    echo "G) {$L['Installation']} LANG... ";
    include('qtf_setup_lang.php');
    echo $L['Done'],'<br/>';
    if ($result==FALSE)
    {
      echo '<div class="setup_err">',sprintf ($L['E_install'],$strTable,$qtf_database,$qtf_user),'</div>';
    }
    else
    {
      echo '<div class="setup_ok">',$L['S_install'],'</div>';
      $_SESSION['qtfInstalled'] = true;
      // save the url
      $strURL = ( empty($_SERVER['SERVER_HTTPS']) ? "http://" : "https://" ).$_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
      $strURL = substr($strURL,0,-24);
      $oDB->Query('UPDATE '.TABSETTING.' SET setting="'.$strURL.'" WHERE param="site_url"');
      // save the board email
      if ( isset($_SESSION['qtf_boardmail']) ) $oDB->Query('UPDATE '.TABSETTING.' SET setting="'.$_SESSION['qtf_boardmail'].'" WHERE param="admin_email"');
    }
  }
  else
  {
    echo '<div class="setup_err">',sprintf ($L['E_connect'],$qtf_database,$qtf_host),'</div>';
  }

}
else
{
  echo '
  <table cellspacing="0">
  <tr valign="top">
  <td width="475" style="padding:5px">
  <form method="post" name="install" action="qtf_setup_2.php">',$L['Board_email'],' <input name="boardmail" value="',(isset($_SESSION['qtf_boardmail']) ? $_SESSION['qtf_boardmail'] : ''),'" size="34" maxlength="100"/>
  <h2>',$L['Install_db'],'</h2>
  <p class="small">',$L['Upgrade2'],'</p>
  <p>',sprintf($L['Create_tables'],$qtf_database),'&nbsp;<input type="submit" name="ok" value="',$L['Ok'],'"/></p>
  </form>
  </td>
  <td class="hidden"><div class="setup_help">',$L['Help_2'],'</div></td>
  </tr>
  </table>
  ';
}

// --------
// HTML END
// --------

include('qtf_setup_ft.php');

?>
Return current item: QuickTalk Forum